[369] | 1 | #ifndef __XIOS_ATTRIBUTE_ENUM__ |
---|
| 2 | #define __XIOS_ATTRIBUTE_ENUM__ |
---|
| 3 | |
---|
[591] | 4 | /// XIOS headers /// |
---|
| 5 | #include "xios_spl.hpp" |
---|
[369] | 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 | { |
---|
[1612] | 16 | /// ////////////////////// Declarations ////////////////////// /// |
---|
[1158] | 17 | /*! |
---|
| 18 | \class CAttributeEnum |
---|
| 19 | This class implements the attribute representing enumeration |
---|
| 20 | */ |
---|
[369] | 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) ; |
---|
[460] | 45 | void reset(void); |
---|
[369] | 46 | |
---|
[445] | 47 | void setInheritedValue(const CAttributeEnum& attr ); |
---|
| 48 | void setInheritedValue(const CAttribute& attr ); |
---|
| 49 | T_enum getInheritedValue(void) const; |
---|
| 50 | string getInheritedStringValue(void) const; |
---|
[1219] | 51 | bool hasInheritedValue(void) const; |
---|
| 52 | |
---|
[1158] | 53 | bool isEqual(const CAttribute& attr ); |
---|
| 54 | |
---|
[369] | 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();} |
---|
[1158] | 63 | virtual void fromString(const StdString & str) { if (str==resetInheritanceStr) { reset(); _canInherite=false ;} else _fromString(str);} |
---|
[1612] | 64 | virtual StdString dump(void) const { return _toString();} |
---|
[2019] | 65 | virtual StdString dumpGraph(void) const { return _dumpGraph();} |
---|
[369] | 66 | |
---|
| 67 | virtual bool toBuffer (CBufferOut& buffer) const { return _toBuffer(buffer);} |
---|
| 68 | virtual bool fromBuffer(CBufferIn& buffer) { return _fromBuffer(buffer); } |
---|
| 69 | |
---|
| 70 | virtual void generateCInterface(ostream& oss,const string& className) ; |
---|
| 71 | virtual void generateFortran2003Interface(ostream& oss,const string& className) ; |
---|
| 72 | virtual void generateFortranInterfaceDeclaration_(ostream& oss,const string& className) ; |
---|
| 73 | virtual void generateFortranInterfaceBody_(ostream& oss,const string& className) ; |
---|
| 74 | virtual void generateFortranInterfaceDeclaration(ostream& oss,const string& className) ; |
---|
| 75 | virtual void generateFortranInterfaceGetDeclaration_(ostream& oss,const string& className) ; |
---|
| 76 | virtual void generateFortranInterfaceGetBody_(ostream& oss,const string& className) ; |
---|
[1219] | 77 | virtual void generateFortranInterfaceGetDeclaration(ostream& oss,const string& className) ; |
---|
[369] | 78 | |
---|
| 79 | private : |
---|
[1219] | 80 | bool isEqual_(const CAttributeEnum& attr ); |
---|
[369] | 81 | StdString _toString(void) const; |
---|
| 82 | void _fromString(const StdString & str); |
---|
| 83 | bool _toBuffer (CBufferOut& buffer) const; |
---|
| 84 | bool _fromBuffer(CBufferIn& buffer) ; |
---|
[445] | 85 | CEnum<T> inheritedValue ; |
---|
[2019] | 86 | StdString _dumpGraph(void) const; |
---|
[369] | 87 | }; // class CAttributeEnum |
---|
| 88 | |
---|
| 89 | } // namespace xios |
---|
| 90 | |
---|
| 91 | #endif // __XIOS_ATTRIBUTE_ENUM__ |
---|