source: XIOS/trunk/src/node/scalar.hpp @ 1106

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

Fixing bug of referencing to an object.

+) From now on, two objects of a same grid element (domain, axis, scalar) are equal if
they have the same non-empty attributes and the same transformations.
(This is very common case with inheritance by *_ref).

Test
+) On Curie
+) Ok with toy_cmip6

File size: 3.2 KB
Line 
1#ifndef __XIOS_CScalar__
2#define __XIOS_CScalar__
3
4/// XIOS headers ///
5#include "xios_spl.hpp"
6#include "declare_group.hpp"
7#include "declare_ref_func.hpp"
8#include "group_template.hpp"
9#include "array_new.hpp"
10#include "attribute_enum.hpp"
11#include "attribute_enum_impl.hpp"
12#include "transformation.hpp"
13#include "transformation_enum.hpp"
14
15namespace xios
16{
17      /// ////////////////////// Déclarations ////////////////////// ///
18
19      class CScalarGroup;
20      class CScalarAttributes;
21      class CScalar;
22      ///--------------------------------------------------------------
23
24      // Declare/Define CVarAttribute
25      BEGIN_DECLARE_ATTRIBUTE_MAP(CScalar)
26#include "scalar_attribute.conf"
27      END_DECLARE_ATTRIBUTE_MAP(CScalar)
28
29      ///--------------------------------------------------------------
30
31      class CScalar
32         : public CObjectTemplate<CScalar>
33         , public CScalarAttributes
34      {
35            /// typedef ///
36            typedef CObjectTemplate<CScalar>   SuperClass;
37            typedef CScalarAttributes SuperClassAttribute;
38
39            friend class CScalarGroup;
40
41         public :
42
43            typedef CScalarAttributes RelAttributes;
44            typedef CScalarGroup      RelGroup;
45            typedef CTransformation<CScalar>::TransformationMapTypes TransMapTypes;
46
47            /// Constructeurs ///
48            CScalar(void);
49            explicit CScalar(const StdString & id);
50            CScalar(const CScalar & var);       // Not implemented yet.
51            CScalar(const CScalar * const var); // Not implemented yet.
52
53            /// Destructeur ///
54            virtual ~CScalar(void);
55
56         public :
57            /// Accesseurs statiques ///
58            static StdString GetName(void);
59            static StdString GetDefName(void);
60            static ENodeType GetType(void);
61
62         public:
63            static CScalar* createScalar();
64
65         public:
66            void checkAttributes(void);
67            void addRelFile(const StdString& filename);
68            bool IsWritten(const StdString& filename) const;
69            void checkAttributesOnClient();
70            virtual void parse(xml::CXMLNode & node);
71
72         public:
73           bool hasTransformation();
74           void solveInheritanceTransformation();
75           TransMapTypes getAllTransformations();
76           void duplicateTransformation(CScalar*);
77           CTransformation<CScalar>* addTransformation(ETranformationType transType, const StdString& id="");
78           bool isEqual(CScalar* scalar);
79
80         private:
81           std::set<StdString> relFiles;
82           TransMapTypes transformationMap_;
83
84         private:           
85            void setTransformations(const TransMapTypes&);
86
87       private:
88           static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m);
89           static std::map<StdString, ETranformationType> transformationMapList_;
90           static bool dummyTransformationMapList_;
91
92
93            DECLARE_REF_FUNC(Scalar,scalar)
94
95      }; // class CVar
96      ///--------------------------------------------------------------
97
98      // Declare/Define CScalarGroup and CScalarDefinition
99      DECLARE_GROUP(CScalar);
100} // namespace xios
101
102#endif // __XIOS_CScalar__
Note: See TracBrowser for help on using the repository browser.