source: XIOS/trunk/src/object_template.hpp @ 509

Last change on this file since 509 was 509, checked in by mhnguyen, 10 years ago

Implementing buffer size auto-detection for mode client -server

+) Process xml tree in client side then send all the information to server
+) Only information enabled fields in enabled files are sent to server
+) Some important change in structure of code which must be refactored

Test
+) On Curie
+) Only mode client-server
+) Passed for all tests

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