2 Copyright (C) 2012 Modelon AB
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the BSD style license.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 FMILIB_License.txt file for more details.
12 You should have received a copy of the FMILIB_License.txt file
13 along with this program. If not, contact Modelon AB <http://www.modelon.com>.
16 #ifndef FMI1_XML_VARIABLEIMPL_H
17 #define FMI1_XML_VARIABLEIMPL_H
19 #include <JM/jm_vector.h>
21 #include <FMI1/fmi1_xml_model_description.h>
23 #include "fmi1_xml_type_impl.h"
29 /* General variable type is convenien to unify all the variable list operations */
30 struct fmi1_xml_variable_t {
31 fmi1_xml_variable_type_base_t* typeBase;
33 const char* description;
34 jm_vector(jm_voidp)* directDependency;
37 fmi1_value_reference_t vr;
45 static int fmi1_xml_compare_vr (const void* first, const void* second) {
46 fmi1_xml_variable_t* a = *(fmi1_xml_variable_t**)first;
47 fmi1_xml_variable_t* b = *(fmi1_xml_variable_t**)second;
48 fmi1_base_type_enu_t at = fmi1_xml_get_variable_base_type(a);
49 fmi1_base_type_enu_t bt = fmi1_xml_get_variable_base_type(b);
50 if(at == fmi1_base_type_enum) at = fmi1_base_type_int;
51 if(bt == fmi1_base_type_enum) bt = fmi1_base_type_int;
52 if(at!=bt) return at - bt;
53 if(a->vr < b->vr) return -1;
54 if(a->vr > b->vr) return 1;
55 return ((int)a->aliasKind - (int)b->aliasKind);
58 void fmi1_xml_free_direct_dependencies(jm_named_ptr named);
64 #endif /* FMI1_XML_VARIABLEIMPL_H */