source: XMLIO_V2/dev/common/src/object_template.hpp @ 300

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

nouvelle version de developpement de xios

  • nouvelle interface fortran
  • recodage complet de la couche de communication
  • et bien d'autres choses...

YM

File size: 3.0 KB
Line 
1#ifndef __XMLIO_CObjectTemplate__
2#define __XMLIO_CObjectTemplate__
3
4/// xmlioserver headers ///
5#include "xmlioserver_spl.hpp"
6#include "attribute_map.hpp"
7#include "node_enum.hpp"
8#include "buffer_in.hpp"
9#include "event_server.hpp"
10#include "attribute.hpp"
11
12namespace xmlioserver
13{
14   /// ////////////////////// Déclarations ////////////////////// ///
15   template <class T>
16      class CObjectTemplate
17         : public CObject
18         , public virtual tree::CAttributeMap
19   {
20
21         /// Friend ///
22         friend class CObjectFactory;
23
24         /// Typedef ///
25         typedef tree::CAttributeMap SuperClassMap;
26         typedef CObject SuperClass;
27         typedef T DerivedType;
28         
29         enum EEventId
30         {
31           EVENT_ID_SEND_ATTRIBUTE=100
32         } ;
33
34      public :
35
36         /// Autres ///
37         virtual StdString toString(void) const;
38         virtual void fromString(const StdString & str);
39
40         virtual void toBinary  (StdOStream & os) const;
41         virtual void fromBinary(StdIStream & is);
42
43         virtual void parse(xml::CXMLNode & node);
44         
45         /// Accesseurs ///
46         tree::ENodeType getType(void) const;
47
48         /// Test ///
49         virtual bool hasChild(void) const;
50
51         /// Traitements ///
52         virtual void solveDescInheritance(const CAttributeMap * const parent = 0);
53
54         /// Traitement statique ///
55         static void ClearAllAttributes(void);
56         void sendAttributToServer(const string& id);
57         void sendAttributToServer(tree::CAttribute& attr) ;
58         static void recvAttributFromClient(CEventServer& event) ;
59         static bool dispatchEvent(CEventServer& event) ;
60
61         /// Accesseur statique ///
62         static std::vector<boost::shared_ptr<DerivedType> > &
63            GetAllVectobject(const StdString & contextId);
64
65         /// Destructeur ///
66         virtual ~CObjectTemplate(void);
67         
68         static bool has(const string& id) ;
69         static boost::shared_ptr<T> get(const string& id) ;
70         boost::shared_ptr<T> get(void) ;
71         static boost::shared_ptr<T> create(const string& id=string("")) ;
72         
73      protected :
74
75         /// Constructeurs ///
76         CObjectTemplate(void);
77         explicit CObjectTemplate(const StdString & id);
78         CObjectTemplate(const CObjectTemplate<T> & object,
79                         bool withAttrList = true, bool withId = true);
80         CObjectTemplate(const CObjectTemplate<T> * const object); // Not implemented.
81
82      private :
83
84         /// Propriétés statiques ///
85         static xios_map<StdString,
86                xios_map<StdString,
87                boost::shared_ptr<DerivedType> > > AllMapObj; 
88         static xios_map<StdString,
89                std::vector<boost::shared_ptr<DerivedType> > > AllVectObj;
90               
91         static xios_map< StdString, long int > GenId ;
92
93   }; // class CObjectTemplate
94} // namespace xmlioserver
95
96//#include "object_template_impl.hpp"
97
98#endif // __XMLIO_CObjectTemplate__
Note: See TracBrowser for help on using the repository browser.