Line data Source code
1 : /* File: xmi_diagram_info_map.inl; Copyright and License: see below */ 2 : 3 : #include "u8/u8_trace.h" 4 : #include "u8/u8_log.h" 5 : #include <assert.h> 6 : #include <stdlib.h> 7 : 8 : extern const xmi_diagram_info_t xmi_diagram_info_map_unknown_type; 9 : 10 0 : static inline u8_error_t xmi_diagram_info_map_get_diagram ( const xmi_diagram_info_map_t *this_, 11 : data_diagram_type_t diagram_type, 12 : const xmi_diagram_info_t **out_diagram_info ) 13 : { 14 0 : assert( NULL != out_diagram_info ); 15 0 : const xmi_diagram_info_t * result = NULL; 16 : 17 0 : switch ( diagram_type ) 18 : { 19 0 : case DATA_DIAGRAM_TYPE_LIST: 20 : { 21 0 : result = &((*this_)[XMI_DIAGRAM_INFO_MAP_INDEX_LIST]); 22 0 : assert ( (*result).data_type_checksum == (int)DATA_DIAGRAM_TYPE_LIST ); 23 : } 24 0 : break; 25 : 26 0 : case DATA_DIAGRAM_TYPE_BOX_DIAGRAM: 27 : { 28 0 : result = &((*this_)[XMI_DIAGRAM_INFO_MAP_INDEX_BOX]); 29 0 : assert ( (*result).data_type_checksum == (int)DATA_DIAGRAM_TYPE_BOX_DIAGRAM ); 30 : } 31 0 : break; 32 : 33 0 : case DATA_DIAGRAM_TYPE_SYSML_BLOCK_DEFINITION_DIAGRAM: 34 : { 35 0 : result = &((*this_)[XMI_DIAGRAM_INFO_MAP_INDEX_BLOCK_DEFINITION]); 36 0 : assert ( (*result).data_type_checksum == (int)DATA_DIAGRAM_TYPE_SYSML_BLOCK_DEFINITION_DIAGRAM ); 37 : } 38 0 : break; 39 : 40 0 : case DATA_DIAGRAM_TYPE_SYSML_INTERNAL_BLOCK_DIAGRAM: 41 : { 42 0 : result = &((*this_)[XMI_DIAGRAM_INFO_MAP_INDEX_INTERNAL_BLOCK]); 43 0 : assert ( (*result).data_type_checksum == (int)DATA_DIAGRAM_TYPE_SYSML_INTERNAL_BLOCK_DIAGRAM ); 44 : } 45 0 : break; 46 : 47 0 : case DATA_DIAGRAM_TYPE_SYSML_PARAMETRIC_DIAGRAM: 48 : { 49 0 : result = &((*this_)[XMI_DIAGRAM_INFO_MAP_INDEX_PARAMETRIC]); 50 0 : assert ( (*result).data_type_checksum == (int)DATA_DIAGRAM_TYPE_SYSML_PARAMETRIC_DIAGRAM ); 51 : } 52 0 : break; 53 : 54 0 : case DATA_DIAGRAM_TYPE_SYSML_REQUIREMENTS_DIAGRAM: 55 : { 56 0 : result = &((*this_)[XMI_DIAGRAM_INFO_MAP_INDEX_REQUIREMENTS]); 57 0 : assert ( (*result).data_type_checksum == (int)DATA_DIAGRAM_TYPE_SYSML_REQUIREMENTS_DIAGRAM ); 58 : } 59 0 : break; 60 : 61 0 : case DATA_DIAGRAM_TYPE_UML_USE_CASE_DIAGRAM: 62 : { 63 0 : result = &((*this_)[XMI_DIAGRAM_INFO_MAP_INDEX_USE_CASE]); 64 0 : assert ( (*result).data_type_checksum == (int)DATA_DIAGRAM_TYPE_UML_USE_CASE_DIAGRAM ); 65 : } 66 0 : break; 67 : 68 0 : case DATA_DIAGRAM_TYPE_UML_ACTIVITY_DIAGRAM: 69 : { 70 0 : result = &((*this_)[XMI_DIAGRAM_INFO_MAP_INDEX_ACTIVITY]); 71 0 : assert ( (*result).data_type_checksum == (int)DATA_DIAGRAM_TYPE_UML_ACTIVITY_DIAGRAM ); 72 : } 73 0 : break; 74 : 75 0 : case DATA_DIAGRAM_TYPE_UML_STATE_MACHINE_DIAGRAM: 76 : { 77 0 : result = &((*this_)[XMI_DIAGRAM_INFO_MAP_INDEX_STATE_MACHINE]); 78 0 : assert ( (*result).data_type_checksum == (int)DATA_DIAGRAM_TYPE_UML_STATE_MACHINE_DIAGRAM ); 79 : } 80 0 : break; 81 : 82 0 : case DATA_DIAGRAM_TYPE_UML_SEQUENCE_DIAGRAM: 83 : { 84 0 : result = &((*this_)[XMI_DIAGRAM_INFO_MAP_INDEX_SEQUENCE]); 85 0 : assert ( (*result).data_type_checksum == (int)DATA_DIAGRAM_TYPE_UML_SEQUENCE_DIAGRAM ); 86 : } 87 0 : break; 88 : 89 0 : case DATA_DIAGRAM_TYPE_UML_COMMUNICATION_DIAGRAM: 90 : { 91 0 : result = &((*this_)[XMI_DIAGRAM_INFO_MAP_INDEX_COMMUNICATION]); 92 0 : assert ( (*result).data_type_checksum == (int)DATA_DIAGRAM_TYPE_UML_COMMUNICATION_DIAGRAM ); 93 : } 94 0 : break; 95 : 96 0 : case DATA_DIAGRAM_TYPE_UML_TIMING_DIAGRAM: 97 : { 98 0 : result = &((*this_)[XMI_DIAGRAM_INFO_MAP_INDEX_TIMING]); 99 0 : assert ( (*result).data_type_checksum == (int)DATA_DIAGRAM_TYPE_UML_TIMING_DIAGRAM ); 100 : } 101 0 : break; 102 : 103 0 : case DATA_DIAGRAM_TYPE_INTERACTION_OVERVIEW_DIAGRAM: 104 : { 105 0 : result = &((*this_)[XMI_DIAGRAM_INFO_MAP_INDEX_INTERACTION_OVERVIEW]); 106 0 : assert ( (*result).data_type_checksum == (int)DATA_DIAGRAM_TYPE_INTERACTION_OVERVIEW_DIAGRAM ); 107 : } 108 0 : break; 109 : 110 0 : case DATA_DIAGRAM_TYPE_UML_DEPLOYMENT_DIAGRAM: 111 : { 112 0 : result = &((*this_)[XMI_DIAGRAM_INFO_MAP_INDEX_DEPLOYMENT]); 113 0 : assert ( (*result).data_type_checksum == (int)DATA_DIAGRAM_TYPE_UML_DEPLOYMENT_DIAGRAM ); 114 : } 115 0 : break; 116 : 117 0 : case DATA_DIAGRAM_TYPE_UML_COMPONENT_DIAGRAM: 118 : { 119 0 : result = &((*this_)[XMI_DIAGRAM_INFO_MAP_INDEX_COMPONENT]); 120 0 : assert ( (*result).data_type_checksum == (int)DATA_DIAGRAM_TYPE_UML_COMPONENT_DIAGRAM ); 121 : } 122 0 : break; 123 : 124 0 : case DATA_DIAGRAM_TYPE_UML_COMPOSITE_STRUCTURE_DIAGRAM: 125 : { 126 0 : result = &((*this_)[XMI_DIAGRAM_INFO_MAP_INDEX_COMPOSITE_STRUCTURE]); 127 0 : assert ( (*result).data_type_checksum == (int)DATA_DIAGRAM_TYPE_UML_COMPOSITE_STRUCTURE_DIAGRAM ); 128 : } 129 0 : break; 130 : 131 0 : case DATA_DIAGRAM_TYPE_UML_PACKAGE_DIAGRAM: 132 : { 133 0 : result = &((*this_)[XMI_DIAGRAM_INFO_MAP_INDEX_PACKAGE]); 134 0 : assert ( (*result).data_type_checksum == (int)DATA_DIAGRAM_TYPE_UML_PACKAGE_DIAGRAM ); 135 : } 136 0 : break; 137 : 138 0 : case DATA_DIAGRAM_TYPE_UML_CLASS_DIAGRAM: 139 : { 140 0 : result = &((*this_)[XMI_DIAGRAM_INFO_MAP_INDEX_CLASS]); 141 0 : assert ( (*result).data_type_checksum == (int)DATA_DIAGRAM_TYPE_UML_CLASS_DIAGRAM ); 142 : } 143 0 : break; 144 : 145 0 : case DATA_DIAGRAM_TYPE_UML_PROFILE_DIAGRAM: 146 : { 147 0 : result = &((*this_)[XMI_DIAGRAM_INFO_MAP_INDEX_PROFILE]); 148 0 : assert ( (*result).data_type_checksum == (int)DATA_DIAGRAM_TYPE_UML_PROFILE_DIAGRAM ); 149 : } 150 0 : break; 151 : 152 0 : default: 153 : { 154 0 : U8_LOG_ANOMALY_INT( "switch case statement for data_diagram_type_t incomplete", diagram_type ); 155 : /* this is a possible error case that can happen when */ 156 : /* a database created with a newer version of the program is opened with this version */ 157 0 : result = NULL; 158 : } 159 0 : break; 160 : } 161 : 162 0 : *out_diagram_info = (result==NULL) ? &xmi_diagram_info_map_unknown_type : result; 163 0 : return (result==NULL) ? U8_ERROR_NOT_FOUND : U8_ERROR_NONE; 164 : } 165 : 166 : 167 : /* 168 : Copyright 2022-2024 Andreas Warnke 169 : 170 : Licensed under the Apache License, Version 2.0 (the "License"); 171 : you may not use this file except in compliance with the License. 172 : You may obtain a copy of the License at 173 : 174 : http://www.apache.org/licenses/LICENSE-2.0 175 : 176 : Unless required by applicable law or agreed to in writing, software 177 : distributed under the License is distributed on an "AS IS" BASIS, 178 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 179 : See the License for the specific language governing permissions and 180 : limitations under the License. 181 : */