source: XIOS/trunk/src/attribute_template.hpp @ 773

Last change on this file since 773 was 591, checked in by rlacroix, 9 years ago

Remove leftovers from the XMLIO age.

  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
File size: 4.2 KB
Line 
1#ifndef __XIOS_CAttributeTemplate__
2#define __XIOS_CAttributeTemplate__
3
4/// boost headers ///
5#include <boost/lexical_cast.hpp>
6
7/// XIOS headers ///
8#include "xios_spl.hpp"
9#include "exception.hpp"
10#include "attribute.hpp"
11#include "buffer_in.hpp"
12#include "buffer_out.hpp"
13#include "type.hpp"
14
15
16namespace xios
17{
18      /// ////////////////////// Déclarations ////////////////////// ///
19      template <class T>
20         class CAttributeTemplate : public CAttribute, public CType<T>
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);
36//            CAttributeTemplate(const CAttribute & attribut) throw (CException);
37//            CAttributeTemplate(const CAttribute * const attribut); // Not implemented.
38
39          public :
40
41            /// Accesseur ///
42            ValueType getValue(void) const;
43//            ValueType* getRef(void) ;
44
45            /// Mutateurs ///
46            void setValue(const ValueType & value);
47           
48            void set(const CAttribute& attr) ;
49            void set(const CAttributeTemplate& attr) ;
50            void reset(void) ;
51
52            void setInheritedValue(const CAttributeTemplate& attr );
53            void setInheritedValue(const CAttribute& attr );
54            T getInheritedValue(void) const ;
55            bool hasInheritedValue(void) const;
56           
57            /// Destructeur ///
58            virtual ~CAttributeTemplate(void) { }
59
60            /// Operateur ///
61            CAttributeTemplate& operator=(const ValueType & value);
62
63            /// Autre ///
64            virtual StdString toString(void) const { return _toString();}
65            virtual void fromString(const StdString & str) { _fromString(str);}
66//            virtual CAttributeTemplate* clone() const {}
67//            virtual void toBinary  (StdOStream & os) const;
68//            virtual void fromBinary(StdIStream & is);           
69
70            virtual bool toBuffer  (CBufferOut& buffer) const { return _toBuffer(buffer);} 
71            virtual bool fromBuffer(CBufferIn& buffer) { return _fromBuffer(buffer); } 
72//            virtual size_t size(void) const;
73            virtual void generateCInterface(ostream& oss,const string& className) ;
74            virtual void generateFortran2003Interface(ostream& oss,const string& className) ;
75            virtual void generateFortranInterfaceDeclaration_(ostream& oss,const string& className) ;
76            virtual void generateFortranInterfaceBody_(ostream& oss,const string& className) ;
77            virtual void generateFortranInterfaceDeclaration(ostream& oss,const string& className) ;
78            virtual void generateFortranInterfaceGetDeclaration_(ostream& oss,const string& className) ;
79            virtual void generateFortranInterfaceGetBody_(ostream& oss,const string& className) ;
80            virtual void generateFortranInterfaceGetDeclaration(ostream& oss,const string& className) ;
81//            virtual void generateFortranInterfaceIsDefinedDeclaration_(ostream& oss,const string& className) ;
82//            virtual void generateFortranInterfaceIsDefinedBody_(ostream& oss,const string& className) ;
83//            virtual void generateFortranInterfaceIsDefinedDeclaration(ostream& oss,const string& className) ;
84
85     
86         protected :
87
88            /// Constructeurs ///
89//            CAttributeTemplate(void); // Not implemented.
90         private :
91          StdString _toString(void) const;
92          void _fromString(const StdString & str);
93          bool _toBuffer  (CBufferOut& buffer) const;
94          bool _fromBuffer(CBufferIn& buffer) ;
95         
96          CType<T> inheritedValue ;
97      }; // class CAttribute   
98     
99   
100   template <class T>  void FromBinary(StdIStream & is, T & obj);
101   
102} // namespace xios
103
104#endif // __XIOS_CAttributeTemplate__
Note: See TracBrowser for help on using the repository browser.