Line data Source code
1 : /* File: data_type.inl; Copyright and License: see below */ 2 : 3 0 : static inline void data_type_init_void ( data_type_t *this_ ) 4 : { 5 0 : (*this_).context = DATA_TABLE_VOID; 6 0 : (*this_).specific_type = -1; 7 0 : } 8 : 9 0 : static inline void data_type_init_diagram ( data_type_t *this_, data_diagram_type_t type ) 10 : { 11 0 : (*this_).context = DATA_TABLE_DIAGRAM; 12 0 : (*this_).specific_type = (int) type; 13 0 : } 14 : 15 0 : static inline void data_type_init_classifier ( data_type_t *this_, data_classifier_type_t type ) 16 : { 17 0 : (*this_).context = DATA_TABLE_CLASSIFIER; 18 0 : (*this_).specific_type = (int) type; 19 0 : } 20 : 21 0 : static inline void data_type_init_feature ( data_type_t *this_, data_feature_type_t type ) 22 : { 23 0 : (*this_).context = DATA_TABLE_FEATURE; 24 0 : (*this_).specific_type = (int) type; 25 0 : } 26 : 27 0 : static inline void data_type_init_relationship ( data_type_t *this_, data_relationship_type_t type ) 28 : { 29 0 : (*this_).context = DATA_TABLE_RELATIONSHIP; 30 0 : (*this_).specific_type = (int) type; 31 0 : } 32 : 33 : static inline void data_type_destroy ( data_type_t *this_ ) 34 : { 35 : } 36 : 37 0 : static inline data_table_t data_type_get_context ( const data_type_t *this_ ) 38 : { 39 0 : return ( (*this_).context ); 40 : } 41 : 42 0 : static inline int data_type_get_type_as_int ( const data_type_t *this_ ) 43 : { 44 0 : return ( (*this_).specific_type ); 45 : } 46 : 47 0 : static inline const data_diagram_type_t data_type_get_diagram_type ( const data_type_t *this_ ) 48 : { 49 0 : return ( ((*this_).context == DATA_TABLE_DIAGRAM) 50 : ? (data_diagram_type_t) (*this_).specific_type 51 0 : : DATA_DIAGRAM_TYPE_VOID ); 52 : } 53 : 54 0 : static inline data_classifier_type_t data_type_get_classifier_type ( const data_type_t *this_ ) 55 : { 56 0 : return ( ((*this_).context == DATA_TABLE_CLASSIFIER) 57 : ? (data_diagram_type_t) (*this_).specific_type 58 0 : : DATA_CLASSIFIER_TYPE_VOID ); 59 : } 60 : 61 0 : static inline data_feature_type_t data_type_get_feature_type ( const data_type_t *this_ ) 62 : { 63 0 : return ( ((*this_).context == DATA_TABLE_FEATURE) 64 : ? (data_diagram_type_t) (*this_).specific_type 65 0 : : DATA_FEATURE_TYPE_VOID ); 66 : } 67 : 68 0 : static inline data_relationship_type_t data_type_get_relationship_type ( const data_type_t *this_ ) 69 : { 70 0 : return ( ((*this_).context == DATA_TABLE_RELATIONSHIP) 71 : ? (data_diagram_type_t) (*this_).specific_type 72 0 : : DATA_RELATIONSHIP_TYPE_VOID ); 73 : } 74 : 75 0 : static inline bool data_type_equals ( const data_type_t *this_, const data_type_t *that ) 76 : { 77 0 : return ( ( (*this_).context != DATA_TABLE_VOID ) 78 0 : && ( (*this_).context == (*that).context ) 79 0 : && ( (*this_).specific_type != -1 ) 80 0 : && ( (*this_).specific_type == (*that).specific_type ) ); 81 : } 82 : 83 : 84 : /* 85 : Copyright 2023-2024 Andreas Warnke 86 : 87 : Licensed under the Apache License, Version 2.0 (the "License"); 88 : you may not use this file except in compliance with the License. 89 : You may obtain a copy of the License at 90 : 91 : http://www.apache.org/licenses/LICENSE-2.0 92 : 93 : Unless required by applicable law or agreed to in writing, software 94 : distributed under the License is distributed on an "AS IS" BASIS, 95 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 96 : See the License for the specific language governing permissions and 97 : limitations under the License. 98 : */