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

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

Fortran attribut interface are now automaticaly generated.
Add get attribut fonctionnality from fortran.

YM

File size: 3.2 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         virtual string getName(void) const ;
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         void generateCInterface(ostream& oss) ;
74         void generateFortran2003Interface(ostream& oss) ;
75         void generateFortranInterface(ostream& oss) ;
76         
77      protected :
78
79         /// Constructeurs ///
80         CObjectTemplate(void);
81         explicit CObjectTemplate(const StdString & id);
82         CObjectTemplate(const CObjectTemplate<T> & object,
83                         bool withAttrList = true, bool withId = true);
84         CObjectTemplate(const CObjectTemplate<T> * const object); // Not implemented.
85
86      private :
87
88         /// Propriétés statiques ///
89         static xios_map<StdString,
90                xios_map<StdString,
91                boost::shared_ptr<DerivedType> > > AllMapObj; 
92         static xios_map<StdString,
93                std::vector<boost::shared_ptr<DerivedType> > > AllVectObj;
94               
95         static xios_map< StdString, long int > GenId ;
96
97   }; // class CObjectTemplate
98} // namespace xmlioserver
99
100//#include "object_template_impl.hpp"
101
102#endif // __XMLIO_CObjectTemplate__
Note: See TracBrowser for help on using the repository browser.