SST
9.1.0
StructuralSimulationToolkit
Main Page
Related Pages
Data Structures
Files
File List
serialize_vector.h
1
// Copyright 2009-2019 NTESS. Under the terms
2
// of Contract DE-NA0003525 with NTESS, the U.S.
3
// Government retains certain rights in this software.
4
//
5
// Copyright (c) 2009-2019, NTESS
6
// All rights reserved.
7
//
8
// This file is part of the SST software package. For license
9
// information, see the LICENSE file in the top level directory of the
10
// distribution.
11
12
#ifndef SERIALIZE_VECTOR_H
13
#define SERIALIZE_VECTOR_H
14
15
#include <vector>
16
#include <sst/core/serialization/serializer.h>
17
18
namespace
SST {
19
namespace
Core {
20
namespace
Serialization {
21
22
template
<
class
T>
23
class
serialize
<std::vector<T> > {
24
typedef
std::vector<T> Vector;
25
public
:
26
void
27
operator()(Vector& v,
serializer
& ser) {
28
switch
(ser.mode())
29
{
30
case
serializer::SIZER: {
31
size_t
size = v.size();
32
ser.size(size);
33
break
;
34
}
35
case
serializer::PACK: {
36
size_t
size = v.size();
37
ser.pack(size);
38
break
;
39
}
40
case
serializer::UNPACK: {
41
size_t
s;
42
ser.unpack(s);
43
v.resize(s);
44
break
;
45
}
46
}
47
48
for
(
size_t
i=0; i < v.size(); ++i){
49
serialize<T>
()(v[i], ser);
50
}
51
}
52
53
};
54
55
}
56
}
57
}
58
59
#endif // SERIALIZE_VECTOR_H
SST::Core::Serialization::serializer
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition:
serializer.h:35
SST::Core::Serialization::serialize
Base serialize class.
Definition:
serialize.h:33
src
sst
core
serialization
serialize_vector.h
Generated on Wed Oct 23 2019 10:36:19 for SST by
1.8.5