1#ifndef IGL_XML_XMLSERIALIZABLE_H
2#define IGL_XML_XMLSERIALIZABLE_H
5#include "../igl_inline.h"
6#include "../serialize.h"
22 virtual void Serialize(std::vector<char>& buffer)
const = 0;
23 virtual void Deserialize(
const std::vector<char>& buffer) = 0;
24 virtual void Serialize(tinyxml2::XMLDocument* doc,tinyxml2::XMLElement* element)
const = 0;
25 virtual void Deserialize(
const tinyxml2::XMLDocument* doc,
const tinyxml2::XMLElement* element) = 0;
40 void Serialize(std::vector<char>& buffer)
const {
44 void Deserialize(
const std::vector<char>& buffer) {
48 void Serialize(tinyxml2::XMLDocument* doc,tinyxml2::XMLElement* element)
const {
52 void Deserialize(
const tinyxml2::XMLDocument* doc,
const tinyxml2::XMLElement* element) {
57 mutable bool initialized;
58 mutable std::vector<XMLSerializableBase*> objects;
86 IGL_INLINE void Add(T& obj,std::string name,
bool binary =
false);
113 if(initialized ==
false)
120 for(
unsigned int i=0;i<objects.size();i++)
131 if(initialized ==
false)
138 for(
unsigned int i=0;i<objects.size();i++)
149 if(initialized ==
false)
156 for(
unsigned int i=0;i<objects.size();i++)
167 if(initialized ==
false)
174 for(
unsigned int i=0;i<objects.size();i++)
212 template <
typename T>
215 XMLSerializationObject<T>*
object =
new XMLSerializationObject<T>();
216 object->Binary = binary;
218 object->Object = &obj;
220 objects.push_back(
object);
Definition XMLSerializable.h:30
virtual bool PreDeserialization()
Definition XMLSerializable.h:100
XMLSerializable & operator=(const XMLSerializable &obj)
Definition XMLSerializable.h:199
virtual void PostSerialization() const
Definition XMLSerializable.h:96
void Serialize(std::vector< char > &buffer) const
Definition XMLSerializable.h:109
~XMLSerializable()
Definition XMLSerializable.h:192
void Add(T &obj, std::string name, bool binary=false)
Definition XMLSerializable.h:213
virtual void InitSerialization()=0
XMLSerializable()
Definition XMLSerializable.h:181
virtual void PostDeserialization()
Definition XMLSerializable.h:105
virtual bool PreSerialization() const
Definition XMLSerializable.h:91
void Deserialize(const std::vector< char > &buffer)
Definition XMLSerializable.h:127
#define IGL_INLINE
Definition igl_inline.h:15
void deserialize_xml(T &obj, const std::string &objectName, const std::string &filename)
deserialize object to file
void serialize_xml(const T &obj, const std::string &objectName, const std::string &filename, bool binary=false, bool overwrite=false)
Serialize object to file.
bool serialize(const T &obj, const std::string &filename)
Definition serialize.h:424
bool deserialize(T &obj, const std::string &filename)
Definition serialize.h:494
Definition serialize.h:159
Definition XMLSerializable.h:21
virtual void Serialize(tinyxml2::XMLDocument *doc, tinyxml2::XMLElement *element) const =0
virtual void Deserialize(const tinyxml2::XMLDocument *doc, const tinyxml2::XMLElement *element)=0
virtual void Serialize(std::vector< char > &buffer) const =0
virtual void Deserialize(const std::vector< char > &buffer)=0