Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Guilhem Saurel
ndcurves
Commits
ccf4041d
Commit
ccf4041d
authored
Jul 24, 2020
by
Pierre Fernbach
Committed by
Guilhem Saurel
Jul 25, 2020
Browse files
Move call to register_type from archive to curve_abc::serialize()
parent
5d9dcae1
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/curves/curve_abc.h
View file @
ccf4041d
...
...
@@ -14,9 +14,9 @@
#include "MathDefs.h"
#include "serialization/archive.hpp"
#include "serialization/eigen-matrix.hpp"
#include "serialization/registeration.hpp"
#include <boost/serialization/shared_ptr.hpp>
#include <boost/smart_ptr/shared_ptr.hpp>
#include <functional>
namespace
curves
{
...
...
@@ -136,7 +136,8 @@ struct curve_abc : std::unary_function<Time, Point>, public serialization::Seria
// Serialization of the class
friend
class
boost
::
serialization
::
access
;
template
<
class
Archive
>
void
serialize
(
Archive
&
/*ar*/
,
const
unsigned
int
version
)
{
void
serialize
(
Archive
&
ar
,
const
unsigned
int
version
)
{
serialization
::
register_types
<
Archive
>
(
ar
);
if
(
version
)
{
// Do something depending on version ?
}
...
...
include/curves/serialization/archive.hpp
View file @
ccf4041d
...
...
@@ -13,7 +13,6 @@
#include <boost/archive/binary_iarchive.hpp>
#include <boost/archive/binary_oarchive.hpp>
#include <boost/serialization/version.hpp>
#include "registeration.hpp"
/* Define the current version number for the serialization
* Must be increased everytime the save() method of a class is modified
...
...
@@ -55,7 +54,6 @@ struct Serializable {
std
::
ifstream
ifs
(
filename
.
c_str
());
if
(
ifs
)
{
boost
::
archive
::
text_iarchive
ia
(
ifs
);
register_types
<
boost
::
archive
::
text_iarchive
>
(
ia
);
ia
>>
derived
<
Derived
>
();
}
else
{
const
std
::
string
exception_message
(
filename
+
" does not seem to be a valid file."
);
...
...
@@ -69,7 +67,6 @@ struct Serializable {
std
::
ofstream
ofs
(
filename
.
c_str
());
if
(
ofs
)
{
boost
::
archive
::
text_oarchive
oa
(
ofs
);
register_types
<
boost
::
archive
::
text_oarchive
>
(
oa
);
oa
<<
derived
<
Derived
>
();
}
else
{
const
std
::
string
exception_message
(
filename
+
" does not seem to be a valid file."
);
...
...
@@ -86,7 +83,6 @@ struct Serializable {
std
::
ifstream
ifs
(
filename
.
c_str
());
if
(
ifs
)
{
boost
::
archive
::
xml_iarchive
ia
(
ifs
);
register_types
<
boost
::
archive
::
xml_iarchive
>
(
ia
);
ia
>>
boost
::
serialization
::
make_nvp
(
tag_name
.
c_str
(),
derived
<
Derived
>
());
}
else
{
const
std
::
string
exception_message
(
filename
+
" does not seem to be a valid file."
);
...
...
@@ -103,7 +99,6 @@ struct Serializable {
std
::
ofstream
ofs
(
filename
.
c_str
());
if
(
ofs
)
{
boost
::
archive
::
xml_oarchive
oa
(
ofs
);
register_types
<
boost
::
archive
::
xml_oarchive
>
(
oa
);
oa
<<
boost
::
serialization
::
make_nvp
(
tag_name
.
c_str
(),
derived
<
Derived
>
());
}
else
{
const
std
::
string
exception_message
(
filename
+
" does not seem to be a valid file."
);
...
...
@@ -117,7 +112,6 @@ struct Serializable {
std
::
ifstream
ifs
(
filename
.
c_str
());
if
(
ifs
)
{
boost
::
archive
::
binary_iarchive
ia
(
ifs
);
register_types
<
boost
::
archive
::
binary_iarchive
>
(
ia
);
ia
>>
derived
<
Derived
>
();
}
else
{
const
std
::
string
exception_message
(
filename
+
" does not seem to be a valid file."
);
...
...
@@ -131,7 +125,6 @@ struct Serializable {
std
::
ofstream
ofs
(
filename
.
c_str
());
if
(
ofs
)
{
boost
::
archive
::
binary_oarchive
oa
(
ofs
);
register_types
<
boost
::
archive
::
binary_oarchive
>
(
oa
);
oa
<<
derived
<
Derived
>
();
}
else
{
const
std
::
string
exception_message
(
filename
+
" does not seem to be a valid file."
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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