source: XIOS/dev/dev_rv/src4/xmlio/object_template.hpp @ 2338

Last change on this file since 2338 was 263, checked in by hozdoba, 13 years ago

Mise à jour v4

File size: 2.7 KB
Line 
1/* ************************************************************************** *
2 *      Copyright © IPSL/LSCE, XMLIOServer, Avril 2010 - Octobre 2011         *
3 * ************************************************************************** */
4
5#ifndef __OBJECT_TEMPLATE_HPP__
6#define __OBJECT_TEMPLATE_HPP__
7
8#ifndef __XIOS_NO_EXTERN
9
10// C++ standard headers
11#include <string>
12#include <iostream>
13#include <vector>
14
15// Boost headers
16#include <boost/shared_ptr.hpp>
17
18#endif // __XIOS_NO_EXTERN
19
20// XMLIOServer headers
21#include "xmlioserver_spl.hpp"
22#include "xml_node.hpp"
23#include "attribute_map.hpp"
24#include "node_enum.hpp"
25
26// ////////////////////////////// Déclarations ///////////////////////////// //
27
28namespace xmlioserver
29{
30   template <class T>
31      class CObjectTemplate
32         : public CObject
33         , public virtual tree::CAttributeMap
34   {
35
36      public : // Classe amie
37
38         friend class CObjectFactory;
39
40      public : // Définition de types
41
42         typedef tree::CAttributeMap SuperClassMap;
43         typedef CObject SuperClass;
44         typedef T DerivedType;
45
46      public : // Autres méthodes
47
48         virtual std::string toString(void) const;
49         virtual void fromString(const std::string & _str);
50
51         virtual void toBinary  (std::ostream & _os) const;
52         virtual void fromBinary(std::istream & _is);
53
54         virtual void parse(xml::CXMLNode & _node);
55         
56      public : // Accesseur
57
58         tree::ENodeType getType(void) const;
59
60      public : // Test
61
62         virtual bool hasChild(void) const;
63
64      public : // Traitement
65
66         virtual void solveDescInheritance(const tree::CAttributeMap * const _parent = 0);
67
68      public : // Traitement statique
69
70         static void ClearAllAttributes(void);
71
72      public : // Accesseur statique
73
74         static std::vector<boost::shared_ptr<DerivedType> > &
75            GetAllVectobject(const std::string & _contextId);
76
77      public : // Destructeur
78
79         virtual ~CObjectTemplate(void);
80
81      protected : // Constructeurs
82
83         CObjectTemplate(void);
84         explicit CObjectTemplate(const std::string & _id);
85         CObjectTemplate(const CObjectTemplate<T> & _object_ref,
86                         bool _withAttrList = true, bool _withId = true);
87         CObjectTemplate(const CObjectTemplate<T> * const _object_ptr); // Not implemented.
88
89      private : // Propriétés statiques
90
91         static xios_map<std::string,
92                xios_map<std::string,
93                boost::shared_ptr<DerivedType> > > AllMapObj; 
94         static xios_map<std::string,
95                std::vector<boost::shared_ptr<DerivedType> > > AllVectObj;
96
97   }; // class CObjectTemplate
98} // namespace xmlioserver
99
100#endif  // __OBJECT_TEMPLATE_HPP__
Note: See TracBrowser for help on using the repository browser.