Line data Source code
1 : /* File: ctrl_controller.inl; Copyright and License: see below */
2 :
3 55 : static inline ctrl_classifier_controller_t *ctrl_controller_get_classifier_control_ptr ( ctrl_controller_t *this_ )
4 : {
5 55 : return &( (*this_).classifiers );
6 : }
7 :
8 61 : static inline ctrl_diagram_controller_t *ctrl_controller_get_diagram_control_ptr ( ctrl_controller_t *this_ )
9 : {
10 61 : return &( (*this_).diagrams );
11 : }
12 :
13 3 : static inline u8_error_t ctrl_controller_transaction_begin ( ctrl_controller_t *this_ )
14 : {
15 : /* do not sent notifications while an explicitly requested transaction is active */
16 3 : data_change_notifier_enable_stealth_mode( data_database_get_notifier_ptr( (*this_).database ) );
17 :
18 3 : return data_database_transaction_begin( (*this_).database );
19 : }
20 :
21 3 : static inline u8_error_t ctrl_controller_transaction_commit ( ctrl_controller_t *this_ )
22 : {
23 3 : const u8_error_t result = data_database_transaction_commit( (*this_).database );
24 :
25 : /* do sent notifications when committing an explicitly requested transaction */
26 3 : data_change_notifier_disable_stealth_mode( data_database_get_notifier_ptr( (*this_).database ) );
27 :
28 3 : return result;
29 : }
30 :
31 : /* ================================ interface for undo redo ================================ */
32 :
33 146 : static inline u8_error_t ctrl_controller_undo ( ctrl_controller_t *this_, data_stat_t *io_stat )
34 : {
35 146 : assert ( NULL != io_stat );
36 146 : return ctrl_undo_redo_list_undo( &((*this_).undo_redo_list), io_stat );
37 : }
38 :
39 16 : static inline u8_error_t ctrl_controller_redo ( ctrl_controller_t *this_, data_stat_t *io_stat )
40 : {
41 16 : assert ( NULL != io_stat );
42 16 : return ctrl_undo_redo_list_redo( &((*this_).undo_redo_list), io_stat );
43 : }
44 :
45 3 : static inline u8_error_t ctrl_controller_get_undo_iterator ( const ctrl_controller_t *this_,
46 : ctrl_undo_redo_iterator_t *out_undo_iterator )
47 : {
48 3 : assert ( NULL != out_undo_iterator );
49 3 : return ctrl_undo_redo_list_get_undo_iterator( &((*this_).undo_redo_list), out_undo_iterator );
50 : }
51 :
52 0 : static inline u8_error_t ctrl_controller_get_redo_iterator ( const ctrl_controller_t *this_,
53 : ctrl_undo_redo_iterator_t *out_redo_iterator )
54 : {
55 0 : assert ( NULL != out_redo_iterator );
56 0 : return ctrl_undo_redo_list_get_redo_iterator( &((*this_).undo_redo_list), out_redo_iterator );
57 : }
58 :
59 : /* ================================ interface for database file ================================ */
60 :
61 30 : static inline u8_error_t ctrl_controller_repair_database ( ctrl_controller_t *this_,
62 : bool modify_db,
63 : uint32_t *out_err,
64 : uint32_t *out_fix,
65 : utf8stream_writer_t *out_english_report )
66 : {
67 : const u8_error_t result
68 30 : = ctrl_consistency_checker_repair_database( &((*this_).consistency_checker),
69 : modify_db,
70 : out_err,
71 : out_fix,
72 : out_english_report
73 : );
74 30 : return result;
75 : }
76 :
77 : /*
78 : Copyright 2016-2025 Andreas Warnke
79 :
80 : Licensed under the Apache License, Version 2.0 (the "License");
81 : you may not use this file except in compliance with the License.
82 : You may obtain a copy of the License at
83 :
84 : http://www.apache.org/licenses/LICENSE-2.0
85 :
86 : Unless required by applicable law or agreed to in writing, software
87 : distributed under the License is distributed on an "AS IS" BASIS,
88 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
89 : See the License for the specific language governing permissions and
90 : limitations under the License.
91 : */
|