Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
igl::xml::XMLSerializable Class Referenceabstract

#include <src/libigl/igl/xml/XMLSerializable.h>

+ Inheritance diagram for igl::xml::XMLSerializable:
+ Collaboration diagram for igl::xml::XMLSerializable:

Classes

struct  XMLSerializationObject
 

Public Member Functions

virtual IGL_INLINE void InitSerialization ()=0
 
virtual IGL_INLINE bool PreSerialization () const
 
virtual IGL_INLINE void PostSerialization () const
 
virtual IGL_INLINE bool PreDeserialization ()
 
virtual IGL_INLINE void PostDeserialization ()
 
IGL_INLINE void Serialize (std::vector< char > &buffer) const
 
IGL_INLINE void Deserialize (const std::vector< char > &buffer)
 
IGL_INLINE void Serialize (tinyxml2::XMLDocument *doc, tinyxml2::XMLElement *element) const
 
IGL_INLINE void Deserialize (const tinyxml2::XMLDocument *doc, const tinyxml2::XMLElement *element)
 
IGL_INLINE XMLSerializable ()
 
IGL_INLINE XMLSerializable (const XMLSerializable &obj)
 
IGL_INLINE ~XMLSerializable ()
 
IGL_INLINE XMLSerializableoperator= (const XMLSerializable &obj)
 
template<typename T >
IGL_INLINE void Add (T &obj, std::string name, bool binary=false)
 

Private Attributes

bool initialized
 
std::vector< XMLSerializableBase * > objects
 

Detailed Description

Constructor & Destructor Documentation

◆ XMLSerializable() [1/2]

IGL_INLINE igl::xml::XMLSerializable::XMLSerializable ( )
182 {
183 initialized = false;
184 }
bool initialized
Definition XMLSerializable.h:57

References initialized.

◆ XMLSerializable() [2/2]

IGL_INLINE igl::xml::XMLSerializable::XMLSerializable ( const XMLSerializable obj)
187 {
188 initialized = false;
189 objects.clear();
190 }
std::vector< XMLSerializableBase * > objects
Definition XMLSerializable.h:58

References initialized, and objects.

◆ ~XMLSerializable()

IGL_INLINE igl::xml::XMLSerializable::~XMLSerializable ( )
193 {
194 initialized = false;
195 objects.clear();
196 }

References initialized, and objects.

Member Function Documentation

◆ Add()

template<typename T >
IGL_INLINE void igl::xml::XMLSerializable::Add ( T &  obj,
std::string  name,
bool  binary = false 
)
214 {
215 XMLSerializationObject<T>* object = new XMLSerializationObject<T>();
216 object->Binary = binary;
217 object->Name = name;
218 object->Object = &obj;
219
220 objects.push_back(object);
221 }
@ binary
Definition stl.h:70

References binary, and objects.

◆ Deserialize() [1/2]

IGL_INLINE void igl::xml::XMLSerializable::Deserialize ( const std::vector< char > &  buffer)
virtual

Implements igl::xml::XMLSerializableBase.

128 {
129 if(this->PreDeserialization())
130 {
131 if(initialized == false)
132 {
133 objects.clear();
134 (const_cast<XMLSerializable*>(this))->InitSerialization();
135 initialized = true;
136 }
137
138 for(unsigned int i=0;i<objects.size();i++)
139 objects[i]->Deserialize(buffer);
140
141 this->PostDeserialization();
142 }
143 }
IGL_INLINE void Deserialize(const std::vector< char > &buffer)
Definition XMLSerializable.h:127
virtual IGL_INLINE void PostDeserialization()
Definition XMLSerializable.h:105
IGL_INLINE XMLSerializable()
Definition XMLSerializable.h:181
virtual IGL_INLINE bool PreDeserialization()
Definition XMLSerializable.h:100

References Deserialize(), initialized, objects, PostDeserialization(), and PreDeserialization().

Referenced by Deserialize(), and Deserialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Deserialize() [2/2]

IGL_INLINE void igl::xml::XMLSerializable::Deserialize ( const tinyxml2::XMLDocument *  doc,
const tinyxml2::XMLElement *  element 
)
virtual

Implements igl::xml::XMLSerializableBase.

164 {
165 if(this->PreDeserialization())
166 {
167 if(initialized == false)
168 {
169 objects.clear();
170 (const_cast<XMLSerializable*>(this))->InitSerialization();
171 initialized = true;
172 }
173
174 for(unsigned int i=0;i<objects.size();i++)
175 objects[i]->Deserialize(doc,element);
176
177 this->PostDeserialization();
178 }
179 }

References Deserialize(), initialized, objects, PostDeserialization(), and PreDeserialization().

+ Here is the call graph for this function:

◆ InitSerialization()

virtual IGL_INLINE void igl::xml::XMLSerializable::InitSerialization ( )
pure virtual

◆ operator=()

IGL_INLINE XMLSerializable & igl::xml::XMLSerializable::operator= ( const XMLSerializable obj)
200 {
201 if(this != &obj)
202 {
203 if(initialized)
204 {
205 initialized = false;
206 objects.clear();
207 }
208 }
209 return *this;
210 }

References initialized, and objects.

◆ PostDeserialization()

IGL_INLINE void igl::xml::XMLSerializable::PostDeserialization ( )
virtual
106 {
107 }

Referenced by Deserialize(), and Deserialize().

+ Here is the caller graph for this function:

◆ PostSerialization()

IGL_INLINE void igl::xml::XMLSerializable::PostSerialization ( ) const
virtual
97 {
98 }

Referenced by Serialize(), and Serialize().

+ Here is the caller graph for this function:

◆ PreDeserialization()

IGL_INLINE bool igl::xml::XMLSerializable::PreDeserialization ( )
virtual
101 {
102 return true;
103 }

Referenced by Deserialize(), and Deserialize().

+ Here is the caller graph for this function:

◆ PreSerialization()

IGL_INLINE bool igl::xml::XMLSerializable::PreSerialization ( ) const
virtual
92 {
93 return true;
94 }

Referenced by Serialize(), and Serialize().

+ Here is the caller graph for this function:

◆ Serialize() [1/2]

IGL_INLINE void igl::xml::XMLSerializable::Serialize ( std::vector< char > &  buffer) const
virtual

Implements igl::xml::XMLSerializableBase.

110 {
111 if(this->PreSerialization())
112 {
113 if(initialized == false)
114 {
115 objects.clear();
116 (const_cast<XMLSerializable*>(this))->InitSerialization();
117 initialized = true;
118 }
119
120 for(unsigned int i=0;i<objects.size();i++)
121 objects[i]->Serialize(buffer);
122
123 this->PostSerialization();
124 }
125 }
virtual IGL_INLINE void PostSerialization() const
Definition XMLSerializable.h:96
IGL_INLINE void Serialize(std::vector< char > &buffer) const
Definition XMLSerializable.h:109
virtual IGL_INLINE bool PreSerialization() const
Definition XMLSerializable.h:91

References initialized, objects, PostSerialization(), PreSerialization(), and Serialize().

Referenced by Serialize(), and Serialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Serialize() [2/2]

IGL_INLINE void igl::xml::XMLSerializable::Serialize ( tinyxml2::XMLDocument *  doc,
tinyxml2::XMLElement *  element 
) const
virtual

Implements igl::xml::XMLSerializableBase.

146 {
147 if(this->PreSerialization())
148 {
149 if(initialized == false)
150 {
151 objects.clear();
152 (const_cast<XMLSerializable*>(this))->InitSerialization();
153 initialized = true;
154 }
155
156 for(unsigned int i=0;i<objects.size();i++)
157 objects[i]->Serialize(doc,element);
158
159 this->PostSerialization();
160 }
161 }

References initialized, objects, PostSerialization(), PreSerialization(), and Serialize().

+ Here is the call graph for this function:

Member Data Documentation

◆ initialized

bool igl::xml::XMLSerializable::initialized
mutableprivate

◆ objects

std::vector<XMLSerializableBase*> igl::xml::XMLSerializable::objects
mutableprivate

The documentation for this class was generated from the following file: