LCOV - code coverage report
Current view: top level - libs/bsw/shed/src - ops_internal.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 93.3 % 15 14
Test Date: 2026-07-31 12:54:17 Functions: 100.0 % 1 1

            Line data    Source code
       1              : /********************************************************************************
       2              :  * Copyright (c) 2024 Accenture
       3              :  *
       4              :  * This program and the accompanying materials are made available under the
       5              :  * terms of the Apache License Version 2.0 which is available at
       6              :  * https://www.apache.org/licenses/LICENSE-2.0
       7              :  *
       8              :  * SPDX-License-Identifier: Apache-2.0
       9              :  ********************************************************************************/
      10              : 
      11              : #include "shed/ops_internal.h" // IWYU pragma: export
      12              : 
      13              : #include <etl/error_handler.h>
      14              : 
      15              : #include <algorithm>
      16              : 
      17              : namespace shed
      18              : {
      19              : namespace internal
      20              : {
      21           19 : void move_while_impl(
      22              :     internal::multi_list::idx_type* const begin,
      23              :     internal::multi_list::idx_type* end,
      24              :     multi_list* const ml,
      25              :     size_t const dst,
      26              :     ::etl::delegate<bool(size_t, size_t)> const pred,
      27              :     ::etl::delegate<move_op(size_t)> const csfr)
      28              : {
      29           19 :     ETL_ASSERT(end >= begin, ETL_ERROR_GENERIC("shed: invalid range"));
      30           19 :     if (begin == end)
      31              :     {
      32            0 :         return;
      33              :     }
      34           19 :     ETL_ASSERT(begin != nullptr, ETL_ERROR_GENERIC("shed: invalid range"));
      35           19 :     std::make_heap(begin, end, pred);
      36              : 
      37           19 :     ETL_ASSERT(ml != nullptr, ETL_ERROR_GENERIC("shed: null multi_list"));
      38              : 
      39           56 :     while (begin != end)
      40              :     {
      41           49 :         std::pop_heap(begin, end, pred);
      42           49 :         --end;
      43              : 
      44           49 :         auto const r = csfr(*end);
      45           48 :         if ((r == move_op::MOVE) || (r == move_op::MOVE_DONE))
      46              :         {
      47           14 :             ml->move_idx(*end, dst);
      48              :         }
      49           48 :         if ((r == move_op::SKIP_DONE) || (r == move_op::MOVE_DONE))
      50              :         {
      51           11 :             return;
      52              :         }
      53              :     }
      54              : }
      55              : 
      56              : } // namespace internal
      57              : } // namespace shed
        

Generated by: LCOV version 2.0-1