1 | #ifndef __XMLIO_CFile__ |
---|
2 | #define __XMLIO_CFile__ |
---|
3 | |
---|
4 | /// xmlioserver headers /// |
---|
5 | #include "xmlioserver_spl.hpp" |
---|
6 | #include "field.hpp" |
---|
7 | #include "data_output.hpp" |
---|
8 | #include "declare_group.hpp" |
---|
9 | |
---|
10 | |
---|
11 | |
---|
12 | namespace xmlioserver { |
---|
13 | namespace tree { |
---|
14 | |
---|
15 | /// ////////////////////// Déclarations ////////////////////// /// |
---|
16 | |
---|
17 | class CFileGroup; |
---|
18 | class CFileAttributes; |
---|
19 | class CFile; |
---|
20 | |
---|
21 | ///-------------------------------------------------------------- |
---|
22 | |
---|
23 | // Declare/Define CFileAttribute |
---|
24 | BEGIN_DECLARE_ATTRIBUTE_MAP(CFile) |
---|
25 | # include "file_attribute.conf" |
---|
26 | END_DECLARE_ATTRIBUTE_MAP(CFile) |
---|
27 | |
---|
28 | ///-------------------------------------------------------------- |
---|
29 | |
---|
30 | class CFile |
---|
31 | : public CObjectTemplate<CFile> |
---|
32 | , public CFileAttributes |
---|
33 | { |
---|
34 | /// typedef /// |
---|
35 | typedef CObjectTemplate<CFile> SuperClass; |
---|
36 | typedef CFileAttributes SuperClassAttribute; |
---|
37 | |
---|
38 | public : |
---|
39 | enum EEventId |
---|
40 | { |
---|
41 | EVENT_ID_ADD_FIELD=0,EVENT_ID_ADD_FIELD_GROUP |
---|
42 | } ; |
---|
43 | |
---|
44 | typedef CFileAttributes RelAttributes; |
---|
45 | typedef CFileGroup RelGroup; |
---|
46 | |
---|
47 | /// Constructeurs /// |
---|
48 | CFile(void); |
---|
49 | explicit CFile(const StdString & id); |
---|
50 | CFile(const CFile & file); // Not implemented yet. |
---|
51 | CFile(const CFile * const file); // Not implemented yet. |
---|
52 | |
---|
53 | /// Accesseurs /// |
---|
54 | boost::shared_ptr<io::CDataOutput> getDataOutput(void) const; |
---|
55 | boost::shared_ptr<CFieldGroup> getVirtualFieldGroup(void) const; |
---|
56 | std::vector<boost::shared_ptr<CField> > getAllFields(void) const; |
---|
57 | |
---|
58 | std::vector<boost::shared_ptr<CField> > |
---|
59 | getEnabledFields(int default_outputlevel = 5, |
---|
60 | int default_level = 1, |
---|
61 | bool default_enabled = true); |
---|
62 | |
---|
63 | public : |
---|
64 | |
---|
65 | /// Mutateurs /// |
---|
66 | void setVirtualFieldGroup(boost::shared_ptr<CFieldGroup> newVFieldGroup); |
---|
67 | void setVirtualFieldGroup(void); |
---|
68 | |
---|
69 | void createHeader(void); |
---|
70 | void close(void) ; |
---|
71 | |
---|
72 | /// Traitements /// |
---|
73 | virtual void solveDescInheritance(const CAttributeMap * const parent = 0); |
---|
74 | void solveFieldRefInheritance(void); |
---|
75 | void solveEFGridRef(void); |
---|
76 | void solveEFOperation(void); |
---|
77 | |
---|
78 | /// Destructeur /// |
---|
79 | virtual ~CFile(void); |
---|
80 | |
---|
81 | /// Autres /// |
---|
82 | virtual void parse(xml::CXMLNode & node); |
---|
83 | virtual StdString toString(void) const; |
---|
84 | |
---|
85 | virtual void toBinary (StdOStream & os) const; |
---|
86 | virtual void fromBinary(StdIStream & is); |
---|
87 | |
---|
88 | /// Accesseurs statiques /// |
---|
89 | static StdString GetName(void); |
---|
90 | static StdString GetDefName(void); |
---|
91 | |
---|
92 | static ENodeType GetType(void); |
---|
93 | |
---|
94 | bool AllDomainEmpty ; |
---|
95 | shared_ptr<CField> addField(const string& id="") ; |
---|
96 | shared_ptr<CFieldGroup> addFieldGroup(const string& id="") ; |
---|
97 | void sendAddField(const string& id="") ; |
---|
98 | void sendAddFieldGroup(const string& id="") ; |
---|
99 | static void recvAddField(CEventServer& event) ; |
---|
100 | void recvAddField(CBufferIn& buffer) ; |
---|
101 | static void recvAddFieldGroup(CEventServer& event) ; |
---|
102 | void recvAddFieldGroup(CBufferIn& buffer) ; |
---|
103 | static bool dispatchEvent(CEventServer& event) ; |
---|
104 | |
---|
105 | private : |
---|
106 | |
---|
107 | /// Propriétés privées /// |
---|
108 | boost::shared_ptr<CFieldGroup> vFieldGroup; |
---|
109 | boost::shared_ptr<io::CDataOutput> data_out; |
---|
110 | std::vector<boost::shared_ptr<CField> > enabledFields; |
---|
111 | |
---|
112 | }; // class CFile |
---|
113 | |
---|
114 | ///-------------------------------------------------------------- |
---|
115 | |
---|
116 | // Declare/Define CFileGroup and CFileDefinition |
---|
117 | DECLARE_GROUP(CFile); |
---|
118 | |
---|
119 | ///-------------------------------------------------------------- |
---|
120 | |
---|
121 | } // namespace tree |
---|
122 | } // namespace xmlioserver |
---|
123 | |
---|
124 | #endif // __XMLIO_CFile__ |
---|