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