source: XIOS/trunk/src/attribute_map.hpp @ 1107

Last change on this file since 1107 was 1105, checked in by mhnguyen, 7 years ago

Adding comparison operator between objects of XIOS.
Two objects of a same type are considered equal if they have same non-empty
attributes which have same values

+) Add operator== to class CArray
+) Add comparison operator to some basic attribute classes
+) Add operator== to date and duration (It seems that they don't serve much)

Test
+) On Curie
+) No Unit tests but test with transformation work (the next commit)

  • 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: 3.4 KB
RevLine 
[591]1#ifndef __XIOS_CAttributeMap__
2#define __XIOS_CAttributeMap__
[219]3
[591]4/// XIOS headers ///
5#include "xios_spl.hpp"
[219]6#include "attribute.hpp"
7#include "attribute_template.hpp"
8#include "exception.hpp"
9#include "xml_node.hpp"
10
[335]11namespace xios
[219]12{
13      /// ////////////////////// Déclarations ////////////////////// ///
[1105]14      /*!
15        \class CAttributeMap
16        This class represents the set of attributes which an object can have.
17      */
18
[219]19      class CAttributeMap
20         : public xios_map<StdString, CAttribute*>
21      {
22            typedef xios_map<StdString, CAttribute*> SuperClassMap;
23
24         public :
25
26            /// Tests ///
[996]27            bool hasAttribute(const StdString & key) const;
[219]28
29            /// Accesseurs ///
30            CAttribute * operator[](const StdString & key);
31
32            /// Mutateurs ///
33            void setAttribute(const StdString & key, CAttribute * const attr);
34
35            void setAttributes(const xml::THashAttributes & attributes);
[445]36            void setAttributes(const CAttributeMap * const _parent, bool apply=true);
[623]37            void duplicateAttributes(const CAttributeMap* const _parent);
[219]38            void clearAllAttributes(void);
39
[509]40            void clearAttribute(const StdString& key);
[1105]41            bool isEqual(const CAttributeMap& another);
[509]42
[219]43            /// Destructeur ///
44            virtual ~CAttributeMap(void);
45
46            /// Flux ///
47            // Debug only //
48            // friend StdOStream & operator << (StdOStream & os, const CAttributeMap & attributmap);
49
50            /// Autre ///
51            virtual StdString toString(void) const;
52            virtual void fromString(const StdString & str);
[509]53
[369]54//            virtual void toBinary  (StdOStream & os) const;
55//            virtual void fromBinary(StdIStream & is);
[313]56            virtual void generateCInterface(ostream& oss, const string& className) ;
57            virtual void generateFortran2003Interface(ostream& oss, const string& className) ;
58            virtual void generateFortranInterface_hdl_(ostream& oss, const string& className) ;
59            virtual void generateFortranInterface_hdl(ostream& oss, const string& className) ;
60            virtual void generateFortranInterface_id(ostream& oss, const string& className) ;
61            virtual void generateFortranInterfaceGet_hdl_(ostream& oss, const string& className) ;
62            virtual void generateFortranInterfaceGet_hdl(ostream& oss, const string& className) ;
63            virtual void generateFortranInterfaceGet_id(ostream& oss, const string& className) ;
[432]64            virtual void generateFortranInterfaceIsDefined_hdl_(ostream& oss, const string& className) ;
65            virtual void generateFortranInterfaceIsDefined_hdl(ostream& oss, const string& className) ;
66            virtual void generateFortranInterfaceIsDefined_id(ostream& oss, const string& className) ;
[219]67
68         protected :
69
70            /// Constructeurs ///
71            CAttributeMap(void);
72            CAttributeMap(const xios_map<StdString, CAttribute*> & umap);       // Never implemented.
73            CAttributeMap(const xios_map<StdString, CAttribute*> * const umap); // Not implemented.
74
75            /// Propriété statique ///
76            static CAttributeMap * Current;
77
78      };  // class CAttributeMap
79
[996]80      inline bool CAttributeMap::hasAttribute(const StdString& key) const
81      {
82         return (this->find(key) != this->end());
83      }
84
[335]85} // namespace xios
[219]86
[591]87#endif // __XIOS_CAttributeMap__
Note: See TracBrowser for help on using the repository browser.