-
Notifications
You must be signed in to change notification settings - Fork 113
/
Copy pathrecord.hpp
49 lines (34 loc) · 937 Bytes
/
record.hpp
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
#ifndef __CEREAL_RECORD_HPP_INCLUDED__
#define __CEREAL_RECORD_HPP_INCLUDED__
#include <vector>
#include <string>
#include <sstream>
#include <stdint.h>
#include <cereal/archives/binary.hpp>
#include <cereal/types/vector.hpp>
#include <cereal/types/string.hpp>
namespace cereal_test {
typedef std::vector<int64_t> Integers;
typedef std::vector<std::string> Strings;
class Record {
public:
Integers ids;
Strings strings;
bool operator==(const Record &other) {
return (ids == other.ids && strings == other.strings);
}
bool operator!=(const Record &other) {
return !(*this == other);
}
private:
friend class cereal::access;
template<typename Archive>
void serialize(Archive &archive)
{
archive(ids, strings);
}
};
void to_string(const Record &record, std::string &data);
void from_string(Record &record, const std::string &data);
} // namespace
#endif