Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
wolf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile_robotics
wolf_projects
wolf_lib
wolf
Merge requests
!85
[WIP] LocalParametrization Serialization
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
[WIP] LocalParametrization Serialization
local_param_seria
into
gtest
Overview
9
Commits
5
Pipelines
0
Changes
10
Closed
Jeremie Deray
requested to merge
local_param_seria
into
gtest
8 years ago
Overview
9
Commits
5
Pipelines
0
Changes
10
Expand
A simple example of non-intrusive serialization using boost.
Depends on
!82 (merged)
0
0
Merge request reports
Compare
gtest
version 3
568dcfa5
8 years ago
version 2
568dcfa5
8 years ago
version 1
568dcfa5
8 years ago
gtest (base)
and
latest version
latest version
568dcfa5
5 commits,
8 years ago
version 3
568dcfa5
5 commits,
8 years ago
version 2
568dcfa5
3 commits,
8 years ago
version 1
568dcfa5
5 commits,
8 years ago
10 files
+
606
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
10
Search (e.g. *.vue) (Ctrl+P)
src/io/serialization_local_parametrization_base.h
0 → 100644
+
116
−
0
Options
#ifndef WOLF_IO_SERIALIZATION_LOCAL_PARAMETRIZATION_BASE_H_
#define WOLF_IO_SERIALIZATION_LOCAL_PARAMETRIZATION_BASE_H_
#include
"../local_parametrization_base.h"
#include
<boost/serialization/serialization.hpp>
#include
<boost/serialization/split_free.hpp>
#include
<boost/serialization/nvp.hpp>
#include
<boost/serialization/assume_abstract.hpp>
BOOST_SERIALIZATION_ASSUME_ABSTRACT
(
wolf
::
LocalParametrizationBase
)
namespace
boost
{
namespace
serialization
{
// Since classes deriving from LocalParametrizationBase
// have default constructor calling the non-default
// LocalParametrizationBase constructor with pre-defined
// arguments, there is nothing to save here.
// The only necessary thing to do is to register this
// abstract class and define an empty serialize function.
template
<
class
Archive
>
inline
void
serialize
(
Archive
&
/*ar*/
,
wolf
::
LocalParametrizationBase
&
/*lpb*/
,
const
unsigned
int
/*file_version*/
)
{
//
}
// Example of what might need to be the serialization
// in case LocalParametrizationBase was not pure abstract.
/*
template<class Archive>
inline void save(
Archive &ar,
const wolf::LocalParametrizationBase &lpb,
const unsigned int file_version )
{
unsigned int global_size = lpb.getGlobalSize();
unsigned int local_size = lpb.getLocalSize();
ar << BOOST_SERIALIZATION_NVP(global_size);
ar << BOOST_SERIALIZATION_NVP(local_size);
}
template<class Archive>
inline void load(
Archive &ar,
wolf::LocalParametrizationBase &lpb,
const unsigned int file_version )
{
unsigned int global_size(0);
unsigned int local_size(0);
ar >> BOOST_SERIALIZATION_NVP(global_size);
ar >> BOOST_SERIALIZATION_NVP(local_size);
// 'placement new'
// 1/ it assumes memory already allocated
// 2/ an instance of LocalParametrizationBase is constructed at
// the memory location
::new(&lpb)wolf::LocalParametrizationBase(global_size, local_size);
}
// split non-intrusive serialization function member into separate
// non intrusive save/load member functions
template<class Archive>
inline void serialize(
Archive &ar,
wolf::LocalParametrizationBase &lpb,
const unsigned int file_version)
{
boost::serialization::split_free(ar, lpb, file_version);
}
// The two functions below allows for serialization of pointers
// (dynamic allocation)
template<class Archive>
inline void save_construct_data(
Archive &ar,
const wolf::LocalParametrizationBase *lpb,
const unsigned int file_version)
{
unsigned int global_size = lpb->getGlobalSize();
unsigned int local_size = lpb->getLocalSize();
ar << BOOST_SERIALIZATION_NVP(global_size);
ar << BOOST_SERIALIZATION_NVP(local_size);
}
template<class Archive>
inline void load_construct_data(
Archive &ar,
wolf::LocalParametrizationBase *lpb,
const unsigned int file_version)
{
unsigned int global_size(0);
unsigned int local_size(0);
ar >> BOOST_SERIALIZATION_NVP(global_size);
ar >> BOOST_SERIALIZATION_NVP(local_size);
::new(lpb)wolf::LocalParametrizationBase(global_size, local_size);
}
*/
}
//namespace serialization
}
//namespace boost
#endif
/* WOLF_IO_SERIALIZATION_LOCAL_PARAMETRIZATION_BASE_H_ */
Loading