source: XIOS3/trunk/src/attribute_template.hpp

Last change on this file was 2629, checked in by jderouillat, 2 months ago

Delete boost dependencies, the few features used are replaced by functions stored in extern/boost_extraction

  • 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.7 KB
RevLine 
[591]1#ifndef __XIOS_CAttributeTemplate__
2#define __XIOS_CAttributeTemplate__
[219]3
4/// boost headers ///
5
[591]6/// XIOS headers ///
7#include "xios_spl.hpp"
[219]8#include "exception.hpp"
9#include "attribute.hpp"
[300]10#include "buffer_in.hpp"
11#include "buffer_out.hpp"
[369]12#include "type.hpp"
[219]13
[335]14namespace xios
[219]15{
16      /// ////////////////////// Déclarations ////////////////////// ///
[1158]17  /*!
18    \class CAttributeTemplate
19    The class implements attribute of some basic types
20  */
[1875]21       template <class T>
[778]22         class CAttributeTemplate : public CAttribute, public CType<T>
[219]23      {
24            typedef CAttribute SuperClass;
25
26         public :
27
28            /// Typedef ///
29            typedef T ValueType;
30
31            /// Constructeurs ///
32            explicit CAttributeTemplate(const StdString & id);
33            CAttributeTemplate(const StdString & id,
34                               xios_map<StdString, CAttribute*> & umap);
35            CAttributeTemplate(const StdString & id, const ValueType & value);
36            CAttributeTemplate(const StdString & id, const ValueType & value,
37                               xios_map<StdString, CAttribute*> & umap);
[369]38//            CAttributeTemplate(const CAttribute & attribut) throw (CException);
39//            CAttributeTemplate(const CAttribute * const attribut); // Not implemented.
[219]40
41          public :
42
43            /// Accesseur ///
[354]44            ValueType getValue(void) const;
[369]45//            ValueType* getRef(void) ;
[219]46
47            /// Mutateurs ///
[354]48            void setValue(const ValueType & value);
[775]49
[369]50            void set(const CAttribute& attr) ;
51            void set(const CAttributeTemplate& attr) ;
[460]52            void reset(void) ;
[1478]53            void checkEmpty(void) const;
[445]54
[1478]55
[445]56            void setInheritedValue(const CAttributeTemplate& attr );
57            void setInheritedValue(const CAttribute& attr );
58            T getInheritedValue(void) const ;
59            bool hasInheritedValue(void) const;
[1219]60           
[1158]61            bool isEqual(const CAttribute& attr );
[2388]62            size_t computeHash(void);
[1158]63
[219]64            /// Destructeur ///
[369]65            virtual ~CAttributeTemplate(void) { }
[219]66
67            /// Operateur ///
[369]68            CAttributeTemplate& operator=(const ValueType & value);
[219]69
70            /// Autre ///
[369]71            virtual StdString toString(void) const { return _toString();}
[1158]72            virtual void fromString(const StdString & str) { if (str==resetInheritanceStr) { reset(); _canInherite=false ;}  else _fromString(str);}
[369]73//            virtual CAttributeTemplate* clone() const {}
74//            virtual void toBinary  (StdOStream & os) const;
[775]75//            virtual void fromBinary(StdIStream & is);
[1622]76            virtual StdString dump(void) const { return _dump();}
[2146]77            virtual StdString dumpGraph(void) const { return _dumpGraph();}
[219]78
[775]79            virtual bool toBuffer  (CBufferOut& buffer) const { return _toBuffer(buffer);}
80            virtual bool fromBuffer(CBufferIn& buffer) { return _fromBuffer(buffer); }
[369]81//            virtual size_t size(void) const;
[313]82            virtual void generateCInterface(ostream& oss,const string& className) ;
83            virtual void generateFortran2003Interface(ostream& oss,const string& className) ;
84            virtual void generateFortranInterfaceDeclaration_(ostream& oss,const string& className) ;
85            virtual void generateFortranInterfaceBody_(ostream& oss,const string& className) ;
86            virtual void generateFortranInterfaceDeclaration(ostream& oss,const string& className) ;
87            virtual void generateFortranInterfaceGetDeclaration_(ostream& oss,const string& className) ;
88            virtual void generateFortranInterfaceGetBody_(ostream& oss,const string& className) ;
89            virtual void generateFortranInterfaceGetDeclaration(ostream& oss,const string& className) ;
[432]90//            virtual void generateFortranInterfaceIsDefinedDeclaration_(ostream& oss,const string& className) ;
91//            virtual void generateFortranInterfaceIsDefinedBody_(ostream& oss,const string& className) ;
92//            virtual void generateFortranInterfaceIsDefinedDeclaration(ostream& oss,const string& className) ;
[300]93
[775]94
[219]95         protected :
96
97            /// Constructeurs ///
[369]98//            CAttributeTemplate(void); // Not implemented.
99         private :
[1219]100          bool isEqual_(const CAttributeTemplate& attr);
[369]101          StdString _toString(void) const;
[1622]102          StdString _dump(void) const;
[2146]103          StdString _dumpGraph(void) const;
[369]104          void _fromString(const StdString & str);
105          bool _toBuffer  (CBufferOut& buffer) const;
106          bool _fromBuffer(CBufferIn& buffer) ;
[775]107
[445]108          CType<T> inheritedValue ;
[775]109      }; // class CAttribute
110
111
[219]112   template <class T>  void FromBinary(StdIStream & is, T & obj);
[775]113
[1875]114
[335]115} // namespace xios
[219]116
[591]117#endif // __XIOS_CAttributeTemplate__
Note: See TracBrowser for help on using the repository browser.