1 | #ifndef __XIOS_ATTRIBUTE_ENUM__ |
---|
2 | #define __XIOS_ATTRIBUTE_ENUM__ |
---|
3 | |
---|
4 | /// XIOS headers /// |
---|
5 | #include "xios_spl.hpp" |
---|
6 | #include "exception.hpp" |
---|
7 | #include "attribute.hpp" |
---|
8 | #include "buffer_in.hpp" |
---|
9 | #include "buffer_out.hpp" |
---|
10 | #include "type.hpp" |
---|
11 | #include "enum.hpp" |
---|
12 | |
---|
13 | |
---|
14 | namespace xios |
---|
15 | { |
---|
16 | /// ////////////////////// Déclarations ////////////////////// /// |
---|
17 | /*! |
---|
18 | \class CAttributeEnum |
---|
19 | This class implements the attribute representing enumeration |
---|
20 | */ |
---|
21 | template <class T> |
---|
22 | class CAttributeEnum : public CAttribute, public CEnum<T> |
---|
23 | { |
---|
24 | typedef typename T::t_enum T_enum ; |
---|
25 | public : |
---|
26 | |
---|
27 | /// Constructeurs /// |
---|
28 | explicit CAttributeEnum(const StdString & id); |
---|
29 | CAttributeEnum(const StdString & id, |
---|
30 | xios_map<StdString, CAttribute*> & umap); |
---|
31 | CAttributeEnum(const StdString & id, const T_enum & value); |
---|
32 | CAttributeEnum(const StdString & id, const T_enum & value, |
---|
33 | xios_map<StdString, CAttribute*> & umap); |
---|
34 | |
---|
35 | /// Accesseur /// |
---|
36 | T_enum getValue(void) const; |
---|
37 | string getStringValue(void) const; |
---|
38 | |
---|
39 | |
---|
40 | /// Mutateurs /// |
---|
41 | void setValue(const T_enum & value); |
---|
42 | |
---|
43 | void set(const CAttribute& attr) ; |
---|
44 | void set(const CAttributeEnum& attr) ; |
---|
45 | void reset(void); |
---|
46 | |
---|
47 | void setInheritedValue(const CAttributeEnum& attr ); |
---|
48 | void setInheritedValue(const CAttribute& attr ); |
---|
49 | T_enum getInheritedValue(void) const; |
---|
50 | string getInheritedStringValue(void) const; |
---|
51 | bool hasInheritedValue(void) const; |
---|
52 | |
---|
53 | bool isEqual(const CAttribute& attr ); |
---|
54 | |
---|
55 | /// Destructeur /// |
---|
56 | virtual ~CAttributeEnum(void) { } |
---|
57 | |
---|
58 | /// Operateur /// |
---|
59 | CAttributeEnum& operator=(const T_enum & value); |
---|
60 | |
---|
61 | /// Autre /// |
---|
62 | virtual StdString toString(void) const { return _toString();} |
---|
63 | virtual void fromString(const StdString & str) { if (str==resetInheritanceStr) { reset(); _canInherite=false ;} else _fromString(str);} |
---|
64 | |
---|
65 | virtual bool toBuffer (CBufferOut& buffer) const { return _toBuffer(buffer);} |
---|
66 | virtual bool fromBuffer(CBufferIn& buffer) { return _fromBuffer(buffer); } |
---|
67 | |
---|
68 | virtual void generateCInterface(ostream& oss,const string& className) ; |
---|
69 | virtual void generateFortran2003Interface(ostream& oss,const string& className) ; |
---|
70 | virtual void generateFortranInterfaceDeclaration_(ostream& oss,const string& className) ; |
---|
71 | virtual void generateFortranInterfaceBody_(ostream& oss,const string& className) ; |
---|
72 | virtual void generateFortranInterfaceDeclaration(ostream& oss,const string& className) ; |
---|
73 | virtual void generateFortranInterfaceGetDeclaration_(ostream& oss,const string& className) ; |
---|
74 | virtual void generateFortranInterfaceGetBody_(ostream& oss,const string& className) ; |
---|
75 | virtual void generateFortranInterfaceGetDeclaration(ostream& oss,const string& className) ; |
---|
76 | |
---|
77 | private : |
---|
78 | bool isEqual_(const CAttributeEnum& attr ); |
---|
79 | StdString _toString(void) const; |
---|
80 | void _fromString(const StdString & str); |
---|
81 | bool _toBuffer (CBufferOut& buffer) const; |
---|
82 | bool _fromBuffer(CBufferIn& buffer) ; |
---|
83 | CEnum<T> inheritedValue ; |
---|
84 | }; // class CAttributeEnum |
---|
85 | |
---|
86 | } // namespace xios |
---|
87 | |
---|
88 | #endif // __XIOS_ATTRIBUTE_ENUM__ |
---|