-
Notifications
You must be signed in to change notification settings - Fork 0
README_cereal
Cereal is a header-only C++11 serialization library that is fast, light-weight, and easy to extend.
The Cereal serialization framework in SHOGUN uses the new tag parameter framework, which allows the readable archive of SGObject data.
-
Cerealserialization library is required for SHOGUN compilation. If noCerealis found, SHOGUN will automatically download the library tothird_party/. -
SHOGUN now supports the serialization of data into 3 formats: binary, XML, and JSON archives. The 3 pairs of save/load methods can be called by:
save_binary(filename);
save_json(filename);
save_xml(filename);
load_binary(filename);
load_json(filename);
load_xml(filename);
- All parameters saved in tag parameter list for one
SGObjectcan be saved and load by:
SGObject obj_save;
obj_save.save_json(filename);
SGObject obj_load;
obj_load.load_json(filename);
- Customized archives can be added as shown here
The serialization framework has two components:
-
serialization interfaces implemented in
SGObejct, and -
serialization (load/save) methods implemented in
SGObjectand non-SGObjectbased data structrues.
- The
save_binary()method inSGObject.hgenerates ancereal::BinaryOutputArchiveobject and savesSGObjectto binary file by callingcereal_save()method inSGObject.load_binary()method generates ancereal::BinaryInputArchiveobject and loads the parameters from binary file back toSGObjectby callingcereal_load()method inSGObject. The ideas are the same for JSON and XML archives.
-
cereal_save()method iterates through the parameter list ofSGObjectregistered asself::map, archives thename value pair, with name asbasetag.name()and value by callingany.cereal_save(). -
cereal_load()method iterates through the parameter list and reset the parameter by callingany.cereal_load()
- Namespace
serialand objectserial::DataType m_datatypeinAny.hsave and convert the data type of the value of parameters inAnyconstructors intoEnum.
enum EnumContainerType
{
CT_UNDEFINED,
CT_PRIMITIVE,
CT_SGVECTOR,
CT_SGMATRIX
};
enum EnumPrimitiveType
{
PT_UNDEFINED,
PT_BOOL_TYPE,
PT_CHAR_TYPE,
PT_INT_8,
PT_UINT_8,
PT_INT1_6,
PT_UINT_16,
PT_INT_32,
PT_UINT_32,
PT_INT_64,
PT_UINT_64,
PT_FLOAT_32,
PT_FLOAT_64,
PT_FLOAT_MAX,
PT_COMPLEX_128,
};
-
Cereal_save()together withcereal_save_helper()methods cast the objectstorageto its input type and archives the value. -
Cereal_load()together withcereal_load_helper()methods read the saved value back tostorageand reset thepolicybased on the data type.
Both SGVector and SGMatirx are derived from SGReferencedData class.
-
SGReferencedDataarchives whetherref_countingis on by savingtrue/false, and theref_countingvalue ifm_refcount != NULL, i.e.ref_countingis on. -
SGVectorandSGMatrixarchivesSG_REFvalue by calling base class load/save methods:cereal::base_class<SGReferencedData>(this)(Introduction). ForSGVector, length and vector values are archived, while forSGMatrix, row number, column number, and matrix values inT* matrixare archived. Data ofcomplex128_ttype is casted tofloat64_ttype before archiving.
Welcome to the Shogun wiki!
-
[quick link GSoC 2016 projects](Google Summer of Code 2016 Projects)
-
Readmes:
-
Documents
-
[Roadmaps](Project roadmaps)
-
GSoC
- Getting involved
- Follow ups
- [2016 projects](Google Summer of Code 2016 Projects)
-
Credits