summaryrefslogtreecommitdiffstats
path: root/gen_serialization.mako.hpp
blob: 5cf3c135600c5fbec3c941642aa4fc2a12115640 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
## This file is a template.  The comment below is emitted
## into the rendered file; feel free to edit this file.
// This file was auto generated.  Do not edit.

#include <cereal/types/string.hpp>
#include <cereal/types/vector.hpp>
#include "config.h"
% for iface in interfaces:
#include <${iface.header()}>
% endfor

% for iface in interfaces:
<% properties = interface_composite.names(str(iface)) %>\
CEREAL_CLASS_VERSION(${iface.namespace()}, CLASS_VERSION);
% endfor

namespace cereal
{

% for iface in interfaces:
<% properties = interface_composite.names(str(iface)) %>\
template<class Archive>
void save(Archive& a,
          const ${iface.namespace()}& object,
          const std::uint32_t version)
{
<%
    props = ["object." + p[:1].lower() + p[1:] + "()" for p in properties]
    props = ', '.join(props)
%>\
    a(${props});
}


template<class Archive>
void load(Archive& a,
          ${iface.namespace()}& object,
          const std::uint32_t version)
{
% for p in properties:
<% t = "object." + p[:1].lower() + p[1:] + "()" %>\
    decltype(${t}) ${p}{};
% endfor
<%
    props = ', '.join(properties)
%>\
    a(${props});
% for p in properties:
<% t = "object." + p[:1].lower() + p[1:] + "(" + p + ")" %>\
    ${t};
% endfor
}

% endfor
} // namespace cereal
OpenPOWER on IntegriCloud