[591] | 1 | #ifndef __XIOS_CAttributeTemplate__ |
---|
| 2 | #define __XIOS_CAttributeTemplate__ |
---|
[219] | 3 | |
---|
| 4 | /// boost headers /// |
---|
| 5 | #include <boost/lexical_cast.hpp> |
---|
| 6 | |
---|
[591] | 7 | /// XIOS headers /// |
---|
| 8 | #include "xios_spl.hpp" |
---|
[219] | 9 | #include "exception.hpp" |
---|
| 10 | #include "attribute.hpp" |
---|
[300] | 11 | #include "buffer_in.hpp" |
---|
| 12 | #include "buffer_out.hpp" |
---|
[369] | 13 | #include "type.hpp" |
---|
[219] | 14 | |
---|
[335] | 15 | namespace xios |
---|
[219] | 16 | { |
---|
| 17 | /// ////////////////////// Déclarations ////////////////////// /// |
---|
| 18 | template <class T> |
---|
[778] | 19 | class CAttributeTemplate : public CAttribute, public CType<T> |
---|
[219] | 20 | { |
---|
| 21 | typedef CAttribute SuperClass; |
---|
| 22 | |
---|
| 23 | public : |
---|
| 24 | |
---|
| 25 | /// Typedef /// |
---|
| 26 | typedef T ValueType; |
---|
| 27 | |
---|
| 28 | /// Constructeurs /// |
---|
| 29 | explicit CAttributeTemplate(const StdString & id); |
---|
| 30 | CAttributeTemplate(const StdString & id, |
---|
| 31 | xios_map<StdString, CAttribute*> & umap); |
---|
| 32 | CAttributeTemplate(const StdString & id, const ValueType & value); |
---|
| 33 | CAttributeTemplate(const StdString & id, const ValueType & value, |
---|
| 34 | xios_map<StdString, CAttribute*> & umap); |
---|
[369] | 35 | // CAttributeTemplate(const CAttribute & attribut) throw (CException); |
---|
| 36 | // CAttributeTemplate(const CAttribute * const attribut); // Not implemented. |
---|
[219] | 37 | |
---|
| 38 | public : |
---|
| 39 | |
---|
| 40 | /// Accesseur /// |
---|
[354] | 41 | ValueType getValue(void) const; |
---|
[369] | 42 | // ValueType* getRef(void) ; |
---|
[219] | 43 | |
---|
| 44 | /// Mutateurs /// |
---|
[354] | 45 | void setValue(const ValueType & value); |
---|
[775] | 46 | |
---|
[369] | 47 | void set(const CAttribute& attr) ; |
---|
| 48 | void set(const CAttributeTemplate& attr) ; |
---|
[460] | 49 | void reset(void) ; |
---|
[445] | 50 | |
---|
| 51 | void setInheritedValue(const CAttributeTemplate& attr ); |
---|
| 52 | void setInheritedValue(const CAttribute& attr ); |
---|
| 53 | T getInheritedValue(void) const ; |
---|
| 54 | bool hasInheritedValue(void) const; |
---|
[775] | 55 | |
---|
[219] | 56 | /// Destructeur /// |
---|
[369] | 57 | virtual ~CAttributeTemplate(void) { } |
---|
[219] | 58 | |
---|
| 59 | /// Operateur /// |
---|
[369] | 60 | CAttributeTemplate& operator=(const ValueType & value); |
---|
[219] | 61 | |
---|
| 62 | /// Autre /// |
---|
[369] | 63 | virtual StdString toString(void) const { return _toString();} |
---|
| 64 | virtual void fromString(const StdString & str) { _fromString(str);} |
---|
| 65 | // virtual CAttributeTemplate* clone() const {} |
---|
| 66 | // virtual void toBinary (StdOStream & os) const; |
---|
[775] | 67 | // virtual void fromBinary(StdIStream & is); |
---|
[219] | 68 | |
---|
[775] | 69 | virtual bool toBuffer (CBufferOut& buffer) const { return _toBuffer(buffer);} |
---|
| 70 | virtual bool fromBuffer(CBufferIn& buffer) { return _fromBuffer(buffer); } |
---|
[369] | 71 | // virtual size_t size(void) const; |
---|
[313] | 72 | virtual void generateCInterface(ostream& oss,const string& className) ; |
---|
| 73 | virtual void generateFortran2003Interface(ostream& oss,const string& className) ; |
---|
| 74 | virtual void generateFortranInterfaceDeclaration_(ostream& oss,const string& className) ; |
---|
| 75 | virtual void generateFortranInterfaceBody_(ostream& oss,const string& className) ; |
---|
| 76 | virtual void generateFortranInterfaceDeclaration(ostream& oss,const string& className) ; |
---|
| 77 | virtual void generateFortranInterfaceGetDeclaration_(ostream& oss,const string& className) ; |
---|
| 78 | virtual void generateFortranInterfaceGetBody_(ostream& oss,const string& className) ; |
---|
| 79 | virtual void generateFortranInterfaceGetDeclaration(ostream& oss,const string& className) ; |
---|
[432] | 80 | // virtual void generateFortranInterfaceIsDefinedDeclaration_(ostream& oss,const string& className) ; |
---|
| 81 | // virtual void generateFortranInterfaceIsDefinedBody_(ostream& oss,const string& className) ; |
---|
| 82 | // virtual void generateFortranInterfaceIsDefinedDeclaration(ostream& oss,const string& className) ; |
---|
[300] | 83 | |
---|
[775] | 84 | |
---|
[219] | 85 | protected : |
---|
| 86 | |
---|
| 87 | /// Constructeurs /// |
---|
[369] | 88 | // CAttributeTemplate(void); // Not implemented. |
---|
| 89 | private : |
---|
| 90 | StdString _toString(void) const; |
---|
| 91 | void _fromString(const StdString & str); |
---|
| 92 | bool _toBuffer (CBufferOut& buffer) const; |
---|
| 93 | bool _fromBuffer(CBufferIn& buffer) ; |
---|
[775] | 94 | |
---|
[445] | 95 | CType<T> inheritedValue ; |
---|
[775] | 96 | }; // class CAttribute |
---|
| 97 | |
---|
| 98 | |
---|
[219] | 99 | template <class T> void FromBinary(StdIStream & is, T & obj); |
---|
[775] | 100 | |
---|
[335] | 101 | } // namespace xios |
---|
[219] | 102 | |
---|
[591] | 103 | #endif // __XIOS_CAttributeTemplate__ |
---|