source: XIOS/trunk/src/node/field.hpp @ 435

Last change on this file since 435 was 369, checked in by ymipsl, 12 years ago

Major Update

  • redesign Type and attribute manipulation
  • add enumerate type and attribute
  • use blitz class array instead of boost class array

YM

File size: 4.8 KB
RevLine 
[219]1#ifndef __XMLIO_CField__
2#define __XMLIO_CField__
3
[335]4/// xios headers ///
[219]5#include "xmlioserver_spl.hpp"
6#include "group_factory.hpp"
7#include "functor.hpp"
8#include "functor_type.hpp"
9#include "duration.hpp"
10#include "date.hpp"
11#include "declare_group.hpp"
[231]12#include "calendar_util.hpp"
[369]13#include "array_new.hpp"
14#include "attribute_array.hpp"
[300]15//#include "context.hpp"
[219]16
[300]17
[335]18namespace xios {
[219]19   
20   /// ////////////////////// Déclarations ////////////////////// ///
21
22   class CFieldGroup;
23   class CFieldAttributes;
24   class CField;
25
26   class CFile;
27   class CGrid;
[300]28   class CContext ;
[219]29   ///--------------------------------------------------------------
30
31   // Declare/Define CFieldAttribute
32   BEGIN_DECLARE_ATTRIBUTE_MAP(CField)
33#  include "field_attribute.conf"
34   END_DECLARE_ATTRIBUTE_MAP(CField)
35
36   ///--------------------------------------------------------------
37   class CField
38      : public CObjectTemplate<CField>
39      , public CFieldAttributes
40   {
41         /// friend ///
42         friend class CFile;
43
44         /// typedef ///
45         typedef CObjectTemplate<CField>   SuperClass;
46         typedef CFieldAttributes SuperClassAttribute;
47
48      public :
49
50         typedef CFieldAttributes RelAttributes;
51         typedef CFieldGroup      RelGroup;
52
[300]53         enum EEventId
54         {
55           EVENT_ID_UPDATE_DATA
56         } ;
57         
[219]58         /// Constructeurs ///
59         CField(void);
60         explicit CField(const StdString & id);
61         CField(const CField & field);       // Not implemented yet.
62         CField(const CField * const field); // Not implemented yet.
63
64         /// Accesseurs ///
[347]65         CField* getDirectFieldReference(void) const;
66         CField* getBaseFieldReference(void)   const;
67         const std::vector<CField*> & getAllReference(void) const;
[219]68
[347]69         CGrid* getRelGrid(void) const ;
70         CFile* getRelFile(void) const ;
[219]71
72      public :
73
[266]74         StdSize getNStep(void) const;
75
[343]76         const CDuration & getFreqOperation(void) const;
77         const CDuration & getFreqWrite(void) const;
[219]78
[343]79         boost::shared_ptr<CDate> getLastWriteDate(void) const;
80         boost::shared_ptr<CDate> getLastOperationDate(void) const;
[219]81
82         boost::shared_ptr<func::CFunctor> getFieldOperation(void) const;
83         
[369]84         CArray<double, 1> getData(void) const;
[219]85
86         const StdString & getBaseFieldId(void) const;
87
88         /// Mutateur ///
[347]89         void setRelFile(CFile* _file);
[266]90         void incrementNStep(void);
[321]91         void resetNStep() ;
[219]92
[369]93         template <int N> bool updateData(const CArray<double, N>&   data);
[300]94         
[219]95         bool updateDataServer
[343]96               (const CDate & currDate,
[369]97                const std::deque< CArray<double, 1>* > storedClient);
[300]98 
99       public :
[219]100
101         /// Test ///
102         bool hasDirectFieldReference(void) const;
[310]103         bool isActive(void) const;
[219]104
105         /// Traitements ///
106         void solveRefInheritance(void);
107         void solveGridReference(void);
108         void solveOperation(void);
109
[369]110//         virtual void fromBinary(StdIStream & is);
[219]111
112         /// Destructeur ///
113         virtual ~CField(void);
114
115         /// Accesseurs statiques ///
116         static StdString GetName(void);
117         static StdString GetDefName(void);
118         
119         static ENodeType GetType(void);
[300]120         
[369]121        template <int N> void setData(const CArray<double, N>& _data) ;
[300]122        static bool dispatchEvent(CEventServer& event) ;
123        void sendUpdateData(void) ;
124        static void recvUpdateData(CEventServer& event) ;
125        void recvUpdateData(vector<int>& ranks, vector<CBufferIn*>& buffers) ;
126        void writeField(void) ;
[369]127        void outputField(CArray<double,3>& fieldOut) ;
128        void outputField(CArray<double,2>& fieldOut) ;
[300]129       
130      public :
[219]131
132         /// Propriétés privées ///
133         
[347]134         std::vector<CField*> refObject;
135         CField* baseRefObject;
136         CGrid*  grid ;
137         CFile*  file;
[219]138
[343]139         CDuration freq_operation, freq_write;
140         CDuration freq_operation_srv, freq_write_srv;
[219]141
[266]142         StdSize nstep;
[343]143         boost::shared_ptr<CDate>    last_Write, last_operation;
144         boost::shared_ptr<CDate>    lastlast_Write_srv,last_Write_srv, last_operation_srv;
[300]145         
[219]146         boost::shared_ptr<func::CFunctor> foperation;
[300]147         map<int,boost::shared_ptr<func::CFunctor> > foperation_srv;
[219]148         
[369]149         CArray<double, 1> data;
150         map<int, CArray<double,1>* > data_srv ;
[219]151
152   }; // class CField
153
154   ///--------------------------------------------------------------
155
156   // Declare/Define CFieldGroup and CFieldDefinition
157   DECLARE_GROUP(CField);
158
159   ///-----------------------------------------------------------------
160
161   template <>
162      void CGroupTemplate<CField, CFieldGroup, CFieldAttributes>::solveRefInheritance(void);
163
164   ///-----------------------------------------------------------------
[335]165} // namespace xios
[219]166
167
168#endif // __XMLIO_CField__
Note: See TracBrowser for help on using the repository browser.