Line data Source code
1 : /* File: ctrl_diagram_trigger.inl; Copyright and License: see below */
2 :
3 : #include <assert.h>
4 :
5 42 : static inline void ctrl_diagram_trigger_init ( ctrl_diagram_trigger_t *this_,
6 : consistency_drop_invisibles_t *drop_invisibles,
7 : consistency_lifeline_t *lifeline )
8 : {
9 42 : assert( drop_invisibles != NULL );
10 42 : assert( lifeline != NULL );
11 42 : (*this_).drop_invisibles = drop_invisibles;
12 42 : (*this_).lifeline = lifeline;
13 42 : }
14 :
15 42 : static inline void ctrl_diagram_trigger_destroy ( ctrl_diagram_trigger_t *this_ )
16 : {
17 42 : (*this_).drop_invisibles = NULL;
18 42 : (*this_).lifeline = NULL;
19 42 : }
20 :
21 5 : static inline u8_error_t ctrl_diagram_trigger_post_update_diagram_type( ctrl_diagram_trigger_t *this_,
22 : const data_diagram_t *updated_diagram )
23 : {
24 5 : u8_error_t result = U8_ERROR_NONE;
25 5 : result |= consistency_lifeline_delete_lifelines( (*this_).lifeline, updated_diagram );
26 5 : result |= consistency_lifeline_create_lifelines( (*this_).lifeline, updated_diagram );
27 5 : return result;
28 : }
29 :
30 33 : static inline u8_error_t ctrl_diagram_trigger_post_create_diagramelement( ctrl_diagram_trigger_t *this_,
31 : const data_diagramelement_t *new_diagramelement )
32 : {
33 33 : u8_error_t result = U8_ERROR_NONE;
34 33 : if ( DATA_ROW_VOID == data_diagramelement_get_focused_feature_row_id( new_diagramelement ) )
35 : {
36 32 : result = consistency_lifeline_create_a_lifeline( (*this_).lifeline, new_diagramelement );
37 : }
38 33 : return result;
39 : }
40 :
41 5 : static inline u8_error_t ctrl_diagram_trigger_post_delete_diagramelement( ctrl_diagram_trigger_t *this_,
42 : const data_diagramelement_t *deleted_diagramelement )
43 : {
44 5 : u8_error_t result_err = U8_ERROR_NONE;
45 5 : result_err |= consistency_lifeline_delete_a_lifeline ( (*this_).lifeline, deleted_diagramelement );
46 5 : result_err |= consistency_drop_invisibles_delete_unreferenced_classifier ( (*this_).drop_invisibles, deleted_diagramelement );
47 5 : result_err |= consistency_drop_invisibles_delete_invisible_relationships ( (*this_).drop_invisibles, deleted_diagramelement );
48 5 : return result_err;
49 : }
50 :
51 :
52 : /*
53 : Copyright 2018-2025 Andreas Warnke
54 :
55 : Licensed under the Apache License, Version 2.0 (the "License");
56 : you may not use this file except in compliance with the License.
57 : You may obtain a copy of the License at
58 :
59 : http://www.apache.org/licenses/LICENSE-2.0
60 :
61 : Unless required by applicable law or agreed to in writing, software
62 : distributed under the License is distributed on an "AS IS" BASIS,
63 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
64 : See the License for the specific language governing permissions and
65 : limitations under the License.
66 : */
|