[219] | 1 | #ifndef __XMLIO_CAttribute__ |
---|
| 2 | #define __XMLIO_CAttribute__ |
---|
| 3 | |
---|
| 4 | /// boost headers /// |
---|
| 5 | #include <boost/any.hpp> |
---|
| 6 | |
---|
[335] | 7 | /// xios headers /// |
---|
[219] | 8 | #include "xmlioserver_spl.hpp" |
---|
| 9 | #include "object.hpp" |
---|
[300] | 10 | #include "base_type.hpp" |
---|
| 11 | #include "message.hpp" |
---|
| 12 | #include "buffer_in.hpp" |
---|
| 13 | #include "buffer_out.hpp" |
---|
[219] | 14 | |
---|
[335] | 15 | namespace xios |
---|
[219] | 16 | { |
---|
| 17 | /// ////////////////////// Déclarations ////////////////////// /// |
---|
[369] | 18 | class CAttribute : public CObject, public virtual CBaseType |
---|
[219] | 19 | { |
---|
| 20 | typedef CObject SuperClass; |
---|
| 21 | |
---|
| 22 | public : |
---|
| 23 | |
---|
| 24 | /// Constructeurs /// |
---|
| 25 | explicit CAttribute(const StdString & id); |
---|
[369] | 26 | // CAttribute(const CAttribute & attribut); |
---|
| 27 | // CAttribute(const CAttribute * const attribut); // Not implemented. |
---|
[219] | 28 | |
---|
| 29 | /// Accesseurs /// |
---|
| 30 | const StdString & getName(void) const; |
---|
[369] | 31 | // const boost::any & getAnyValue(void) const; |
---|
| 32 | // template <typename T> inline T getValue(void) const; |
---|
| 33 | // template <typename T> inline T* getRef(void); |
---|
[219] | 34 | |
---|
[369] | 35 | // /// Mutateurs /// |
---|
| 36 | // template <typename T> inline void setValue(const T & value); |
---|
| 37 | // void setAnyValue(const boost::any & value); |
---|
| 38 | // void clear(void); |
---|
[219] | 39 | |
---|
| 40 | /// Test /// |
---|
[369] | 41 | // bool isEmpty(void) const; |
---|
| 42 | // template <typename T> inline bool isType(void) const; |
---|
| 43 | virtual void set(const CAttribute& ) =0 ; |
---|
[219] | 44 | /// Destructeur /// |
---|
| 45 | virtual ~CAttribute(void); |
---|
| 46 | |
---|
| 47 | /// Autres /// |
---|
| 48 | virtual StdString toString(void) const = 0; |
---|
| 49 | virtual void fromString(const StdString & str) = 0; |
---|
| 50 | |
---|
[369] | 51 | // virtual void toBinary (StdOStream & os) const = 0; |
---|
| 52 | // virtual void fromBinary(StdIStream & is) = 0; |
---|
| 53 | |
---|
[313] | 54 | virtual void generateCInterface(ostream& oss, const string& className) = 0 ; |
---|
| 55 | virtual void generateFortran2003Interface(ostream& oss, const string& className) = 0 ; |
---|
| 56 | virtual void generateFortranInterfaceDeclaration_(ostream& oss,const string& className) = 0 ; |
---|
| 57 | virtual void generateFortranInterfaceDeclaration(ostream& oss,const string& className) = 0 ; |
---|
| 58 | virtual void generateFortranInterfaceBody_(ostream& oss,const string& className) = 0 ; |
---|
| 59 | virtual void generateFortranInterfaceGetDeclaration_(ostream& oss,const string& className) = 0 ; |
---|
| 60 | virtual void generateFortranInterfaceGetDeclaration(ostream& oss,const string& className) = 0 ; |
---|
| 61 | virtual void generateFortranInterfaceGetBody_(ostream& oss,const string& className) = 0 ; |
---|
[219] | 62 | |
---|
[313] | 63 | |
---|
| 64 | |
---|
[219] | 65 | protected : |
---|
| 66 | |
---|
| 67 | /// Constructeurs /// |
---|
[369] | 68 | // CAttribute(void); // Not implemented. |
---|
[219] | 69 | |
---|
| 70 | /// Propriété /// |
---|
[369] | 71 | // boost::any value; |
---|
[219] | 72 | |
---|
| 73 | }; // class CAttribute |
---|
| 74 | |
---|
| 75 | /// ////////////////////// Définitions ////////////////////// /// |
---|
[369] | 76 | /* |
---|
[219] | 77 | template <typename T> |
---|
| 78 | T CAttribute::getValue(void) const |
---|
| 79 | { |
---|
| 80 | return (boost::any_cast<T>(this->value)); |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | template <typename T> |
---|
[300] | 84 | T* CAttribute::getRef(void) |
---|
| 85 | { |
---|
| 86 | return (boost::any_cast<T>(&value)); |
---|
| 87 | } |
---|
| 88 | |
---|
| 89 | template <typename T> |
---|
[219] | 90 | void CAttribute::setValue(const T & value) |
---|
| 91 | { |
---|
| 92 | this->value = value; |
---|
| 93 | } |
---|
| 94 | |
---|
| 95 | template<typename T> |
---|
[352] | 96 | bool CAttribute::isType(void) const |
---|
[219] | 97 | { |
---|
| 98 | return (this->value.type() == typeid(T)); |
---|
| 99 | } |
---|
[369] | 100 | */ |
---|
[300] | 101 | |
---|
[345] | 102 | CMessage& operator<<(CMessage& msg,CAttribute& type) ; |
---|
| 103 | CMessage& operator<<(CMessage& msg, const CAttribute& type) ; |
---|
[300] | 104 | |
---|
[345] | 105 | CBufferOut& operator<<(CBufferOut& buffer,CAttribute& type) ; |
---|
| 106 | CBufferIn& operator>>(CBufferIn& buffer, CAttribute& type) ; |
---|
[369] | 107 | |
---|
[300] | 108 | } |
---|
[335] | 109 | // namespace xios |
---|
[219] | 110 | |
---|
| 111 | #endif // __XMLIO_CAttribute__ |
---|