source: XIOS/trunk/src/attribute_enum.hpp @ 455

Last change on this file since 455 was 445, checked in by ymipsl, 11 years ago

Add possibility to make inheritance of attributes and reference before closing the context definition.
New fortran fonction : xios_solve inheritance()
After this call, the value of attribute have the inherited value of their parent.

YM

File size: 3.3 KB
Line 
1#ifndef __XIOS_ATTRIBUTE_ENUM__
2#define __XIOS_ATTRIBUTE_ENUM__
3
4/// xios headers ///
5#include "xmlioserver_spl.hpp"
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
14namespace xios
15{
16      /// ////////////////////// Déclarations ////////////////////// ///
17      template <class T>
18         class CAttributeEnum : public CAttribute, public CEnum<T>
19      {
20        typedef typename T::t_enum T_enum ;
21        public :
22
23            /// Constructeurs ///
24            explicit CAttributeEnum(const StdString & id);
25            CAttributeEnum(const StdString & id,
26                               xios_map<StdString, CAttribute*> & umap);
27            CAttributeEnum(const StdString & id, const T_enum & value);
28            CAttributeEnum(const StdString & id, const T_enum & value,
29                               xios_map<StdString, CAttribute*> & umap);
30
31            /// Accesseur ///
32            T_enum getValue(void) const;
33            string getStringValue(void) const;
34
35
36            /// Mutateurs ///
37            void setValue(const T_enum & value);
38           
39            void set(const CAttribute& attr) ;
40            void set(const CAttributeEnum& attr) ;
41           
42            void setInheritedValue(const CAttributeEnum& attr );
43            void setInheritedValue(const CAttribute& attr );
44            T_enum getInheritedValue(void)  const;
45            string getInheritedStringValue(void) const;
46            bool hasInheritedValue(void) const;         
47         
48            /// Destructeur ///
49            virtual ~CAttributeEnum(void) { }
50
51            /// Operateur ///
52            CAttributeEnum& operator=(const T_enum & value);
53
54            /// Autre ///
55            virtual StdString toString(void) const { return _toString();}
56            virtual void fromString(const StdString & str) { _fromString(str);}
57
58            virtual bool toBuffer  (CBufferOut& buffer) const { return _toBuffer(buffer);} 
59            virtual bool fromBuffer(CBufferIn& buffer) { return _fromBuffer(buffer); } 
60           
61            virtual void generateCInterface(ostream& oss,const string& className) ;
62            virtual void generateFortran2003Interface(ostream& oss,const string& className) ;
63            virtual void generateFortranInterfaceDeclaration_(ostream& oss,const string& className) ;
64            virtual void generateFortranInterfaceBody_(ostream& oss,const string& className) ;
65            virtual void generateFortranInterfaceDeclaration(ostream& oss,const string& className) ;
66            virtual void generateFortranInterfaceGetDeclaration_(ostream& oss,const string& className) ;
67            virtual void generateFortranInterfaceGetBody_(ostream& oss,const string& className) ;
68            virtual void generateFortranInterfaceGetDeclaration(ostream& oss,const string& className) ;
69
70     
71         protected :
72
73            /// Constructeurs ///
74//            CAttributeTemplate(void); // Not implemented.
75         private :
76          StdString _toString(void) const;
77          void _fromString(const StdString & str);
78          bool _toBuffer  (CBufferOut& buffer) const;
79          bool _fromBuffer(CBufferIn& buffer) ;
80          CEnum<T> inheritedValue ;
81      }; // class CAttributeEnum   
82   
83} // namespace xios
84
85#endif // __XIOS_ATTRIBUTE_ENUM__
Note: See TracBrowser for help on using the repository browser.