LCOV - code coverage report
Current view: top level - ctrl/include - ctrl_diagram_trigger.inl (source / functions) Coverage Total Hit
Test: crystal-facet-uml_v1.70.2_covts Lines: 100.0 % 51 51
Test Date: 2026-05-03 11:56:31 Functions: 100.0 % 5 5

            Line data    Source code
       1              : /* File: ctrl_diagram_trigger.inl; Copyright and License: see below */
       2              : 
       3              : #include <assert.h>
       4              : 
       5           47 : static inline void ctrl_diagram_trigger_init ( ctrl_diagram_trigger_t *this_,
       6              :                                                consistency_classifier_t *classifier,
       7              :                                                consistency_feature_t *feature,
       8              :                                                consistency_lifeline_t *lifeline,
       9              :                                                consistency_relationship_t *relationship )
      10              : {
      11           47 :     assert( classifier != NULL );
      12           47 :     assert( feature != NULL );
      13           47 :     assert( lifeline != NULL );
      14           47 :     assert( relationship != NULL );
      15           47 :     (*this_).classifier = classifier;
      16           47 :     (*this_).feature = feature;
      17           47 :     (*this_).lifeline = lifeline;
      18           47 :     (*this_).relationship = relationship;
      19           47 : }
      20              : 
      21           47 : static inline void ctrl_diagram_trigger_destroy ( ctrl_diagram_trigger_t *this_ )
      22              : {
      23           47 :     (*this_).classifier = NULL;
      24           47 :     (*this_).feature = NULL;
      25           47 :     (*this_).lifeline = NULL;
      26           47 :     (*this_).relationship = NULL;
      27           47 : }
      28              : 
      29            9 : static inline u8_error_t ctrl_diagram_trigger_post_update_diagram_type( ctrl_diagram_trigger_t *this_,
      30              :                                                                         const data_diagram_t *updated_diagram,
      31              :                                                                         consistency_stat_t *io_stat )
      32              : {
      33            9 :     assert( NULL != updated_diagram );
      34            9 :     assert( NULL != io_stat );
      35            9 :     u8_error_t result = U8_ERROR_NONE;
      36            9 :     result |= consistency_lifeline_delete_lifelines( (*this_).lifeline, updated_diagram, io_stat );
      37            9 :     result |= consistency_lifeline_create_lifelines( (*this_).lifeline, updated_diagram, io_stat );
      38            9 :     result |= consistency_feature_delete_invisibles_in_diagram( (*this_).feature, updated_diagram, io_stat );
      39            9 :     int32_t deleted_relationships = 0;
      40            9 :     result |= consistency_relationship_delete_invisibles_in_diagram( (*this_).relationship,
      41              :                                                                      updated_diagram,
      42              :                                                                      &deleted_relationships
      43              :                                                                    );
      44            9 :     consistency_stat_subtract_relationships( io_stat, deleted_relationships );
      45            9 :     return result;
      46              : }
      47              : 
      48           62 : static inline u8_error_t ctrl_diagram_trigger_post_create_diagramelement( ctrl_diagram_trigger_t *this_,
      49              :                                                                           const data_diagramelement_t *new_diagramelement,
      50              :                                                                           data_id_t *out_created_lifeline )
      51              : {
      52           62 :     assert( new_diagramelement != NULL );
      53           62 :     assert( out_created_lifeline != NULL );
      54           62 :     u8_error_t result = U8_ERROR_NONE;
      55           62 :     if ( DATA_ROW_VOID == data_diagramelement_get_focused_feature_row( new_diagramelement ) )
      56              :     {
      57           60 :         data_row_t lifeline_row = DATA_ROW_VOID;
      58           60 :         result = consistency_lifeline_create_a_lifeline( (*this_).lifeline, new_diagramelement, &lifeline_row );
      59           60 :         if (( result == U8_ERROR_NONE )&&( lifeline_row != DATA_ROW_VOID ))
      60              :         {
      61           13 :             data_id_init( out_created_lifeline, DATA_TABLE_FEATURE, lifeline_row );  /* lifelines are stored as feature */
      62              :         }
      63              :         else
      64              :         {
      65           47 :             *out_created_lifeline = DATA_ID_VOID;
      66              :         }
      67              :     }
      68              :     else
      69              :     {
      70              :         /* the caller stated an focused_feature_row already, therefore a lifeline was already linked */
      71            2 :         *out_created_lifeline = DATA_ID_VOID;
      72              :     }
      73           62 :     return result;
      74              : }
      75              : 
      76            9 : static inline u8_error_t ctrl_diagram_trigger_post_delete_diagramelement( ctrl_diagram_trigger_t *this_,
      77              :                                                                           const data_diagramelement_t *deleted_diagramelement,
      78              :                                                                           consistency_stat_t *io_stat
      79              :                                                                         )
      80              : {
      81            9 :     assert( NULL != deleted_diagramelement );
      82            9 :     assert( NULL != io_stat );
      83            9 :     u8_error_t result_err = U8_ERROR_NONE;
      84            9 :     result_err |= consistency_lifeline_delete_a_lifeline( (*this_).lifeline, deleted_diagramelement, io_stat );
      85            9 :     result_err |= consistency_classifier_delete_unreferenced_classifier( (*this_).classifier,
      86              :                                                                          deleted_diagramelement,
      87              :                                                                          io_stat
      88              :                                                                        );
      89            9 :     const data_row_t classifier_id = data_diagramelement_get_classifier_row( deleted_diagramelement );
      90            9 :     result_err |= consistency_feature_delete_invisibles_of_classifier( (*this_).feature, classifier_id, io_stat );
      91            9 :     int32_t deleted_relationships = 0;
      92            9 :     result_err |= consistency_relationship_delete_invisibles_at_classifier( (*this_).relationship,
      93              :                                                                             classifier_id,
      94              :                                                                             &deleted_relationships
      95              :                                                                           );
      96            9 :     consistency_stat_subtract_relationships( io_stat, deleted_relationships );
      97            9 :     return result_err;
      98              : }
      99              : 
     100              : 
     101              : /*
     102              : Copyright 2018-2026 Andreas Warnke
     103              : 
     104              : Licensed under the Apache License, Version 2.0 (the "License");
     105              : you may not use this file except in compliance with the License.
     106              : You may obtain a copy of the License at
     107              : 
     108              :     http://www.apache.org/licenses/LICENSE-2.0
     109              : 
     110              : Unless required by applicable law or agreed to in writing, software
     111              : distributed under the License is distributed on an "AS IS" BASIS,
     112              : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     113              : See the License for the specific language governing permissions and
     114              : limitations under the License.
     115              : */
        

Generated by: LCOV version 2.0-1