1
2
3
4
5
6 #include <cmajor/binder/UuidRepository.hpp>
7
8 namespace cmajor { namespace binder {
9
10 int UuidRepository::Install(const boost::uuids::uuid& uuid)
11 {
12 auto it = uuidMap.find(uuid);
13 if (it != uuidMap.cend())
14 {
15 return it->second;
16 }
17 else
18 {
19 int id = uuids.size();
20 uuidMap[uuid] = id;
21 uuids.push_back(uuid);
22 return id;
23 }
24 }
25
26 const boost::uuids::uuid& UuidRepository::GetUuid(int id) const
27 {
28 Assert(id >= 0 && id < uuids.size(), "invalid uuid id");
29 return uuids[id];
30 }
31
32 } }