source: XIOS/trunk/src/attribute_array.hpp @ 445

Last change on this file since 445 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.2 KB
Line 
1#ifndef __XIOS_ATTRIBUTE_ARRAY__
2#define __XIOS_ATTRIBUTE_ARRAY__
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 "array_new.hpp"
11
12
13namespace xios
14{
15      /// ////////////////////// Déclarations ////////////////////// ///
16      template <typename T_numtype, int N_rank>
17         class CAttributeArray : public CAttribute, public CArray<T_numtype, N_rank>
18      {
19        public :
20
21           using CArray<T_numtype,N_rank>::operator = ;
22//           using Array<T_numtype,N_rank>::operator = ;
23           
24            /// Constructeurs ///
25            explicit CAttributeArray(const StdString & id);
26            CAttributeArray(const StdString & id, xios_map<StdString, CAttribute*> & umap);
27            CAttributeArray(const StdString & id, const CArray<T_numtype, N_rank>& value);
28            CAttributeArray(const StdString & id, const CArray<T_numtype, N_rank>& value, 
29                           xios_map<StdString, CAttribute*> & umap);
30
31            /// Accesseur ///
32            CArray<T_numtype, N_rank> getValue(void) const;
33
34            /// Mutateurs ///
35            void setValue(const CArray<T_numtype, N_rank>& value);
36            void set(const CAttribute& attr) ;
37            void set(const CAttributeArray& attr) ;
38           
39            void setInheritedValue(const CAttributeArray& attr );
40            void setInheritedValue(const CAttribute& attr );
41            CArray<T_numtype, N_rank> getInheritedValue(void) const ;
42            bool hasInheritedValue(void) const;           
43
44            /// Destructeur ///
45            virtual ~CAttributeArray(void) { }
46
47
48            /// Autre ///
49            virtual string toString(void) const { return _toString();}
50            virtual void fromString(const StdString & str) { _fromString(str);}
51            virtual bool toBuffer  (CBufferOut& buffer) const { return _toBuffer(buffer);} 
52            virtual bool fromBuffer(CBufferIn& buffer) { return _fromBuffer(buffer); } 
53           
54            virtual void generateCInterface(ostream& oss,const string& className) ;
55            virtual void generateFortran2003Interface(ostream& oss,const string& className) ;
56            virtual void generateFortranInterfaceDeclaration_(ostream& oss,const string& className) ;
57            virtual void generateFortranInterfaceBody_(ostream& oss,const string& className) ;
58            virtual void generateFortranInterfaceDeclaration(ostream& oss,const string& className) ;
59            virtual void generateFortranInterfaceGetDeclaration_(ostream& oss,const string& className) ;
60            virtual void generateFortranInterfaceGetBody_(ostream& oss,const string& className) ;
61            virtual void generateFortranInterfaceGetDeclaration(ostream& oss,const string& className) ;
62
63     
64         protected :
65
66            /// Constructeurs ///
67
68         private :
69          CArray<T_numtype, N_rank> inheritedValue ;
70          StdString _toString(void) const;
71          void _fromString(const StdString & str);
72          bool _toBuffer  (CBufferOut& buffer) const;
73          bool _fromBuffer(CBufferIn& buffer) ;
74      }; // class CAttributeEnum   
75} // namespace xios
76
77#endif // __XIOS_ATTRIBUTE_ARRAY__
Note: See TracBrowser for help on using the repository browser.