LCOV - code coverage report
Current view: top level - pencil/include/layout - layout_relationship_iter.inl (source / functions) Coverage Total Hit
Test: crystal-facet-uml_v1.63.2_covts Lines: 0.0 % 37 0
Test Date: 2025-05-01 10:10:14 Functions: 0.0 % 6 0

            Line data    Source code
       1              : /* File: layout_relationship_iter.inl; Copyright and License: see below */
       2              : 
       3              : #include "u8/u8_trace.h"
       4              : #include <assert.h>
       5              : 
       6            0 : static inline void layout_relationship_iter_init( layout_relationship_iter_t *this_,
       7              :                                                   layout_visible_set_t *items,
       8              :                                                   const universal_array_index_sorter_t *order )
       9              : {
      10            0 :     assert( items != NULL );
      11            0 :     assert( order != NULL );
      12            0 :     (*this_).next_idx = 0;
      13            0 :     (*this_).length = universal_array_index_sorter_get_count( order );
      14            0 :     (*this_).items = items;
      15            0 :     (*this_).order = order;
      16            0 : }
      17              : 
      18            0 : static inline void layout_relationship_iter_init_from_processed( layout_relationship_iter_t *this_,
      19              :                                                                  const layout_relationship_iter_t *that )
      20              : {
      21            0 :     (*this_).next_idx = 0;
      22            0 :     (*this_).length = (*that).next_idx;
      23            0 :     (*this_).items = (*that).items;
      24            0 :     (*this_).order = (*that).order;
      25            0 : }
      26              : 
      27            0 : static inline void layout_relationship_iter_copy( layout_relationship_iter_t *this_,
      28              :                                                   const layout_relationship_iter_t *original )
      29              : {
      30            0 :     (*this_).next_idx = (*original).next_idx;
      31            0 :     (*this_).length = (*original).length;
      32            0 :     (*this_).items = (*original).items;
      33            0 :     (*this_).order = (*original).order;
      34            0 : }
      35              : 
      36            0 : static inline void layout_relationship_iter_destroy( layout_relationship_iter_t *this_ )
      37              : {
      38            0 :     (*this_).next_idx = 0;
      39            0 :     (*this_).length = 0;
      40            0 :     (*this_).items = NULL;
      41            0 :     (*this_).order = NULL;
      42            0 : }
      43              : 
      44            0 : static inline bool layout_relationship_iter_has_next( const layout_relationship_iter_t *this_ )
      45              : {
      46              :     /* check that the size of the array has not shrinked */
      47              :     /* It should not have changed at all, but this cannot be checked here. */
      48            0 :     assert( (*this_).length <= universal_array_index_sorter_get_count( (*this_).order ) );
      49              : 
      50            0 :     return ( (*this_).next_idx < (*this_).length );
      51              : }
      52              : 
      53            0 : static inline layout_relationship_t *layout_relationship_iter_next_ptr( layout_relationship_iter_t *this_ )
      54              : {
      55            0 :     layout_relationship_t *result = NULL;
      56            0 :     if ( layout_relationship_iter_has_next( this_ ) )
      57              :     {
      58            0 :         uint32_t array_index = universal_array_index_sorter_get_array_index( (*this_).order, (*this_).next_idx );
      59            0 :         assert( array_index < layout_visible_set_get_relationship_count( (*this_).items ) );
      60            0 :         result = layout_visible_set_get_relationship_ptr( (*this_).items, array_index );
      61            0 :         (*this_).next_idx ++;
      62              :     }
      63            0 :     return result;
      64              : }
      65              : 
      66              : 
      67              : /*
      68              : Copyright 2025-2025 Andreas Warnke
      69              : 
      70              : Licensed under the Apache License, Version 2.0 (the "License");
      71              : you may not use this file except in compliance with the License.
      72              : You may obtain a copy of the License at
      73              : 
      74              :     http://www.apache.org/licenses/LICENSE-2.0
      75              : 
      76              : Unless required by applicable law or agreed to in writing, software
      77              : distributed under the License is distributed on an "AS IS" BASIS,
      78              : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      79              : See the License for the specific language governing permissions and
      80              : limitations under the License.
      81              : */
        

Generated by: LCOV version 2.0-1