Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Humanoid Path Planner
hpp-util
Commits
ed348ee4
Commit
ed348ee4
authored
Dec 07, 2020
by
Joseph Mirabel
Browse files
[serialization] add export + add usage doc
parent
c79ab9c8
Pipeline
#12595
passed with stage
in 57 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
include/hpp/util/doc.hh
View file @
ed348ee4
...
...
@@ -25,6 +25,7 @@
- benchmark tools
- quality assurance tools (contract programming tools
and "smart" assertions).
- \ref hpp_util_serialization "tools for serialization" used in HPP.
The Doxygen documentation has been written to be a reference document.
For tutorials and more user-friendly documentation, see the
...
...
@@ -52,4 +53,33 @@
\code
throw ::hpp::ExceptionFactory<std::runtime_error>() << "message" << variable << ::hpp::ThrowException();
\endcode
\page hpp_util_serialization Serialization
Serialization of a class hierarchy can be done as follows. The class hierarchy is:
- AB inherits from A
- ABC inherits from AB (which inherits from A), thus there cannot be at the same time ABC and DBC.
In the header file,
- Use one of the \ref HPP_SERIALIZABLE macros.
- Except for the base class of the hierarchy (that is A), call \c BOOST_CLASS_EXPORT_KEY(AB)
In the definition file,
- implement a function like
\code
template<class Archive>
void AB::serialize(Archive & ar, const unsigned int version)
{
using namespace boost::serialization;
(void) version;
ar & make_nvp("base", base_object<A>(*this)); // declare inheritance.
// ...
}
HPP_SERIALIZATION_IMPLEMENT(AB); // Or the implement macro corresponding the called declaration macro.
\endcode
- Except for the base class of the hierarchy (that is A), call \c BOOST_CLASS_EXPORT_IMPLEMENT(AB)
If you know a class will not have any serializable child (i.e. AB exists but there is no no ABC), then
you can remove \c BOOST_CLASS_EXPORT_KEY(AB) and replace \c BOOST_CLASS_EXPORT_IMPLEMENT(AB) by \c BOOST_CLASS_EXPORT(AB)
*/
include/hpp/util/serialization-fwd.hh
View file @
ed348ee4
...
...
@@ -21,6 +21,7 @@
#include
<boost/serialization/split_member.hpp>
#include
<boost/serialization/split_free.hpp>
#include
<boost/serialization/export.hpp>
namespace
boost
{
namespace
serialization
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment