1 | #ifndef __XIOS_CAttribute__ |
---|
2 | #define __XIOS_CAttribute__ |
---|
3 | |
---|
4 | /// boost headers /// |
---|
5 | #include <boost/any.hpp> |
---|
6 | |
---|
7 | /// XIOS headers /// |
---|
8 | #include "xios_spl.hpp" |
---|
9 | #include "object.hpp" |
---|
10 | #include "base_type.hpp" |
---|
11 | #include "message.hpp" |
---|
12 | #include "buffer_in.hpp" |
---|
13 | #include "buffer_out.hpp" |
---|
14 | |
---|
15 | namespace xios |
---|
16 | { |
---|
17 | /// ////////////////////// Déclarations ////////////////////// /// |
---|
18 | /*! |
---|
19 | \class CAttribute |
---|
20 | The fundamental class which describes the attributes of other different class in XIOS. |
---|
21 | This class only plays a role of interface, its class child will have specific implelemtation corresponding to type of attribute |
---|
22 | */ |
---|
23 | class CAttribute : public CObject, public virtual CBaseType |
---|
24 | { |
---|
25 | typedef CObject SuperClass; |
---|
26 | |
---|
27 | public : |
---|
28 | |
---|
29 | /// Constructeurs /// |
---|
30 | explicit CAttribute(const StdString & id); |
---|
31 | |
---|
32 | /// Accesseurs /// |
---|
33 | const StdString & getName(void) const; |
---|
34 | |
---|
35 | virtual void set(const CAttribute& ) =0 ; |
---|
36 | virtual void reset(void ) =0 ; |
---|
37 | /// Destructeur /// |
---|
38 | virtual ~CAttribute(void); |
---|
39 | |
---|
40 | /// Autres /// |
---|
41 | virtual StdString toString(void) const = 0; |
---|
42 | virtual void fromString(const StdString & str) = 0; |
---|
43 | virtual bool isEqual(const CAttribute& ) = 0; |
---|
44 | |
---|
45 | //! Returns true if and only if the attribute should be publicly exposed in the API |
---|
46 | virtual bool isPublic() const { return true; } |
---|
47 | |
---|
48 | //! Return true if the attribute should be sent to other clients or servers |
---|
49 | virtual bool doSend() const { return true; } |
---|
50 | |
---|
51 | /* |
---|
52 | Groupd of functions to generate C and Fortran interface |
---|
53 | */ |
---|
54 | virtual void generateCInterface(ostream& oss, const string& className) = 0 ; |
---|
55 | virtual void generateCInterfaceIsDefined(ostream& oss, const string& className) ; |
---|
56 | virtual void generateFortran2003Interface(ostream& oss, const string& className) = 0 ; |
---|
57 | virtual void generateFortran2003InterfaceIsDefined(ostream& oss, const string& className) ; |
---|
58 | virtual void generateFortranInterfaceDeclaration_(ostream& oss,const string& className) = 0 ; |
---|
59 | virtual void generateFortranInterfaceDeclaration(ostream& oss,const string& className) = 0 ; |
---|
60 | virtual void generateFortranInterfaceBody_(ostream& oss,const string& className) = 0 ; |
---|
61 | virtual void generateFortranInterfaceGetDeclaration_(ostream& oss,const string& className) = 0 ; |
---|
62 | virtual void generateFortranInterfaceGetDeclaration(ostream& oss,const string& className) = 0 ; |
---|
63 | virtual void generateFortranInterfaceGetBody_(ostream& oss,const string& className) = 0 ; |
---|
64 | virtual void generateFortranInterfaceIsDefinedDeclaration_(ostream& oss,const string& className) ; |
---|
65 | virtual void generateFortranInterfaceIsDefinedDeclaration(ostream& oss,const string& className) ; |
---|
66 | virtual void generateFortranInterfaceIsDefinedBody_(ostream& oss,const string& className) ; |
---|
67 | |
---|
68 | virtual void setInheritedValue(const CAttribute& ) = 0 ; |
---|
69 | virtual bool hasInheritedValue(void) const = 0; |
---|
70 | |
---|
71 | bool canInherite(void) {return _canInherite ;} |
---|
72 | protected : |
---|
73 | bool _canInherite ; |
---|
74 | static const StdString resetInheritanceStr ; |
---|
75 | |
---|
76 | }; // class CAttribute |
---|
77 | |
---|
78 | CMessage& operator<<(CMessage& msg,CAttribute& type) ; |
---|
79 | CMessage& operator<<(CMessage& msg, const CAttribute& type) ; |
---|
80 | |
---|
81 | CBufferOut& operator<<(CBufferOut& buffer,CAttribute& type) ; |
---|
82 | CBufferIn& operator>>(CBufferIn& buffer, CAttribute& type) ; |
---|
83 | |
---|
84 | } |
---|
85 | // namespace xios |
---|
86 | |
---|
87 | #endif // __XIOS_CAttribute__ |
---|