SST/macro
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
sprockit
sprockit
serialize_vector.h
Go to the documentation of this file.
1
#ifndef SERIALIZE_VECTOR_H
2
#define SERIALIZE_VECTOR_H
3
4
#include <vector>
5
#include <
sprockit/serializer.h
>
6
7
namespace
sprockit
{
8
9
template
<
class
T>
10
class
serialize
<std::vector<T> > {
11
typedef
std::vector<T>
Vector
;
12
public
:
13
void
14
operator()
(Vector& v,
serializer
& ser) {
15
switch
(ser.
mode
())
16
{
17
case
serializer::SIZER
: {
18
size_t
size = v.size();
19
ser.
size
(size);
20
break
;
21
}
22
case
serializer::PACK
: {
23
size_t
size = v.size();
24
ser.
pack
(size);
25
break
;
26
}
27
case
serializer::UNPACK
: {
28
size_t
s;
29
ser.
unpack
(s);
30
v.resize(s);
31
break
;
32
}
33
}
34
35
for
(
int
i=0; i < v.size(); ++i){
36
serialize<T>
()(v[i], ser);
37
}
38
}
39
40
};
41
42
}
43
44
#endif // SERIALIZE_VECTOR_H
sprockit::serializer::SIZER
Definition:
serializer.h:37
sprockit::serializer::size
void size(T &t)
Definition:
serializer.h:63
sprockit::serialize< std::vector< T > >::Vector
std::vector< T > Vector
Definition:
serialize_vector.h:11
sprockit::serializer::unpack
void unpack(T &t)
Definition:
serializer.h:75
serializer.h
sprockit
Definition:
basic_string_tokenizer.h:21
sprockit::serialize
Definition:
serialize.h:13
sprockit::serialize< std::vector< T > >::operator()
void operator()(Vector &v, serializer &ser)
Definition:
serialize_vector.h:14
sprockit::serializer::mode
SERIALIZE_MODE mode() const
Definition:
serializer.h:84
sprockit::serializer
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition:
serializer.h:33
sprockit::serializer::UNPACK
Definition:
serializer.h:37
sprockit::serializer::pack
void pack(T &t)
Definition:
serializer.h:69
sprockit::serializer::PACK
Definition:
serializer.h:37
Generated by
1.8.11