source: XIOS/dev/dev_ym/XIOS_COUPLING/src/object_template.hpp @ 1878

Last change on this file since 1878 was 1875, checked in by ymipsl, 4 years ago

XIOS coupling branch
Some updates.

First coupling test is beginning to work...

YM

  • 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.1 KB
RevLine 
[591]1#ifndef __XIOS_CObjectTemplate__
2#define __XIOS_CObjectTemplate__
[219]3
[591]4/// XIOS headers ///
5#include "xios_spl.hpp"
[219]6#include "attribute_map.hpp"
7#include "node_enum.hpp"
[300]8#include "buffer_in.hpp"
9#include "event_server.hpp"
10#include "attribute.hpp"
[1021]11#include "context_client.hpp"
[219]12
[335]13namespace xios
[219]14{
15   /// ////////////////////// Déclarations ////////////////////// ///
16   template <class T>
17      class CObjectTemplate
18         : public CObject
[345]19         , public virtual CAttributeMap
[219]20   {
21
22         /// Friend ///
23         friend class CObjectFactory;
24
25         /// Typedef ///
[345]26         typedef CAttributeMap SuperClassMap;
[219]27         typedef CObject SuperClass;
28         typedef T DerivedType;
[509]29
[300]30         enum EEventId
31         {
32           EVENT_ID_SEND_ATTRIBUTE=100
33         } ;
[219]34
35      public :
36
37         /// Autres ///
38         virtual StdString toString(void) const;
39         virtual void fromString(const StdString & str);
40
[369]41//         virtual void toBinary  (StdOStream & os) const;
42//         virtual void fromBinary(StdIStream & is);
[313]43         virtual string getName(void) const ;
[219]44         virtual void parse(xml::CXMLNode & node);
[509]45
[219]46         /// Accesseurs ///
[345]47         ENodeType getType(void) const;
[219]48
49         /// Test ///
50         virtual bool hasChild(void) const;
51
52         /// Traitements ///
[445]53         virtual void solveDescInheritance(bool apply, const CAttributeMap * const parent = 0);
[219]54
55         /// Traitement statique ///
56         static void ClearAllAttributes(void);
[1330]57         std::map<int, size_t> getMinimumBufferSizeForAttributes(CContextClient* client);
[1875]58         void sendAttributToServer(const string& id, CContextClient* client, const string& objectId="");
59         void sendAttributToServer(CAttribute& attr, CContextClient* client, const string& objectId="") ;
60         void sendAllAttributesToServer(CContextClient* client, const string& objectId="");
61         void sendAddItem(const string& id, int itemType, CContextClient* client, const string& objectId="");
[300]62         static void recvAttributFromClient(CEventServer& event) ;
63         static bool dispatchEvent(CEventServer& event) ;
[219]64
[1158]65         bool isEqual(const string& id, const vector<StdString>& excludedAttrs);
66         bool isEqual(T* obj, const vector<StdString>& excludedAttrs);
67
[219]68         /// Accesseur statique ///
[1542]69         static std::vector<std::shared_ptr<DerivedType> > &
[219]70            GetAllVectobject(const StdString & contextId);
71
72         /// Destructeur ///
73         virtual ~CObjectTemplate(void);
[509]74
[300]75         static bool has(const string& id) ;
[346]76         static bool has(const string& contextId, const string& id) ;
[347]77         static T* get(const string& id) ;
78         static T* get(const T* ptr) ;
79         static T* get(const string& contextId, const string& id) ;
80         T* get(void) ;
[1542]81         std::shared_ptr<T> getShared(void) ;
82         static std::shared_ptr<T> getShared(const T* ptr) ;
[509]83
[347]84         static T* create(const string& id=string("")) ;
[1869]85         static T* createAlias(const string& id, const string& alias) ;
86         void createAlias(const string& alias) ;
87         
[347]88         static const vector<T*> getAll() ;
89         static const vector<T*> getAll(const string& contextId) ;
[509]90
[313]91         void generateCInterface(ostream& oss) ;
92         void generateFortran2003Interface(ostream& oss) ;
93         void generateFortranInterface(ostream& oss) ;
[509]94
[219]95      protected :
96
97         /// Constructeurs ///
98         CObjectTemplate(void);
99         explicit CObjectTemplate(const StdString & id);
100         CObjectTemplate(const CObjectTemplate<T> & object,
101                         bool withAttrList = true, bool withId = true);
102         CObjectTemplate(const CObjectTemplate<T> * const object); // Not implemented.
103
104      private :
105
106         /// Propriétés statiques ///
107         static xios_map<StdString,
108                xios_map<StdString,
[1542]109                std::shared_ptr<DerivedType> > > AllMapObj;
[219]110         static xios_map<StdString,
[1542]111                std::vector<std::shared_ptr<DerivedType> > > AllVectObj;
[509]112
[286]113         static xios_map< StdString, long int > GenId ;
[219]114
115   }; // class CObjectTemplate
[335]116} // namespace xios
[219]117
[300]118//#include "object_template_impl.hpp"
119
[591]120#endif // __XIOS_CObjectTemplate__
Note: See TracBrowser for help on using the repository browser.