ROSE 0.11.145.147
rose_serialize_uuid.h
1#ifndef ROSE_serialize_uuid_H
2#define ROSE_serialize_uuid_H
3#include <featureTests.h>
4
6// Boost
8
9#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
10#include <boost/uuid/uuid_serialize.hpp>
11#endif
12
14// Cereal
16
17#ifdef ROSE_HAVE_CEREAL
18#include <boost/uuid/string_generator.hpp>
19#include <boost/uuid/uuid.hpp>
20#include <boost/uuid/uuid_io.hpp>
21
22namespace cereal {
23
24template<class Archive>
25void
26CEREAL_SAVE_FUNCTION_NAME(Archive &archive, const boost::uuids::uuid &x) {
27 const std::string uuid = boost::uuids::to_string(x);
28 archive(CEREAL_NVP(uuid));
29}
30
31template<class Archive>
32void
33CEREAL_LOAD_FUNCTION_NAME(Archive &archive, boost::uuids::uuid &x) {
34 std::string uuid;
35 archive(CEREAL_NVP(uuid));
36 x = boost::uuids::string_generator()(uuid);
37}
38
39} // namespace
40
41#endif
42#endif