1 | /* ************************************************************************** * |
---|
2 | * Copyright © IPSL/LSCE, XMLIOServer, Avril 2010 - Octobre 2011 * |
---|
3 | * ************************************************************************** */ |
---|
4 | |
---|
5 | #ifndef __ATTRIBUTE_TEMPLATE_HPP__ |
---|
6 | #define __ATTRIBUTE_TEMPLATE_HPP__ |
---|
7 | |
---|
8 | /** |
---|
9 | * \file attribute_template.hpp |
---|
10 | * \brief Gestion des attributs typés d'objet (entête). |
---|
11 | * \author Hervé Ozdoba |
---|
12 | * \version 0.4 |
---|
13 | * \date 1er Juin 2011 |
---|
14 | */ |
---|
15 | |
---|
16 | #ifndef __XIOS_NO_EXTERN |
---|
17 | |
---|
18 | // C++ standard headers |
---|
19 | #include <string> |
---|
20 | #include <iostream> |
---|
21 | |
---|
22 | #endif // __XIOS_NO_EXTERN |
---|
23 | |
---|
24 | // XMLIOServer headers |
---|
25 | #include "xmlioserver_spl.hpp" |
---|
26 | #include "attribute.hpp" |
---|
27 | |
---|
28 | // ////////////////////////////// Déclarations ///////////////////////////// // |
---|
29 | |
---|
30 | namespace xmlioserver { |
---|
31 | namespace tree { |
---|
32 | |
---|
33 | template <class ValueType> |
---|
34 | class CAttributeTemplate : public CAttribute |
---|
35 | { |
---|
36 | typedef CAttribute SuperClass; |
---|
37 | |
---|
38 | public : // Constructeurs |
---|
39 | |
---|
40 | explicit CAttributeTemplate(const std::string & _id); |
---|
41 | CAttributeTemplate(const std::string & _id, |
---|
42 | xios_map<std::string, CAttribute*> & _umap); |
---|
43 | CAttributeTemplate(const std::string & _id, const ValueType & _value); |
---|
44 | CAttributeTemplate(const std::string & _id, const ValueType & _value, |
---|
45 | xios_map<std::string, CAttribute*> & _umap); |
---|
46 | CAttributeTemplate(const CAttribute & _attribut_ref) throw (CException); |
---|
47 | CAttributeTemplate(const CAttribute * const _attribut_ptr); // Not implemented. |
---|
48 | |
---|
49 | public : // Accesseur |
---|
50 | |
---|
51 | inline ValueType getValue(void) const throw (CException); |
---|
52 | |
---|
53 | public : // Mutateur |
---|
54 | |
---|
55 | inline void setValue(const ValueType & _value); |
---|
56 | |
---|
57 | public : // Destructeur |
---|
58 | |
---|
59 | virtual ~CAttributeTemplate(void); |
---|
60 | |
---|
61 | public : // Operateur |
---|
62 | |
---|
63 | ValueType operator=(const ValueType & _value); |
---|
64 | |
---|
65 | public : // Autres |
---|
66 | |
---|
67 | virtual std::string toString(void) const; |
---|
68 | virtual void fromString(const std::string & _str); |
---|
69 | |
---|
70 | virtual void toBinary (std::ostream & _os) const; |
---|
71 | virtual void fromBinary(std::istream & _is); |
---|
72 | |
---|
73 | protected : // Constructeurs |
---|
74 | |
---|
75 | CAttributeTemplate(void); // Not implemented. |
---|
76 | |
---|
77 | }; // class CAttribute |
---|
78 | |
---|
79 | template <class T> void FromBinary(std::istream & _is, T & _object); |
---|
80 | |
---|
81 | } // namespace tree |
---|
82 | } // namespace xmlioserver |
---|
83 | |
---|
84 | #endif // __ATTRIBUTE_TEMPLATE_HPP__ |
---|