GCC Code Coverage Report


Directory: ./
File: include/shared_memory/serializer.hxx
Date: 2022-06-30 06:29:57
Exec Total Coverage
Lines: 16 16 100.0%
Branches: 18 36 50.0%

Line Branch Exec Source
1
2 namespace shared_memory
3 {
4 template <class Serializable>
5 1370 const std::string& Serializer<Serializable>::serialize(
6 const Serializable& serializable)
7 {
8
2/4
✓ Branch 2 taken 1068 times.
✗ Branch 3 not taken.
✓ Branch 8 taken 302 times.
✗ Branch 9 not taken.
2740 std::stringstream ss;
9
2/4
✓ Branch 1 taken 1068 times.
✗ Branch 2 not taken.
✓ Branch 6 taken 302 times.
✗ Branch 7 not taken.
2740 cereal::BinaryOutputArchive boa(ss);
10
2/4
✓ Branch 1 taken 1068 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 302 times.
✗ Branch 5 not taken.
1370 boa(serializable);
11
2/4
✓ Branch 1 taken 1068 times.
✗ Branch 2 not taken.
✓ Branch 6 taken 302 times.
✗ Branch 7 not taken.
1370 data_ = ss.str();
12 2740 return data_;
13 }
14
15 template <class Serializable>
16 1501 void Serializer<Serializable>::deserialize(const std::string& data,
17 Serializable& serializable)
18 {
19
2/4
✓ Branch 2 taken 1002 times.
✗ Branch 3 not taken.
✓ Branch 8 taken 499 times.
✗ Branch 9 not taken.
3002 std::stringstream ss(data);
20
2/4
✓ Branch 1 taken 1002 times.
✗ Branch 2 not taken.
✓ Branch 6 taken 499 times.
✗ Branch 7 not taken.
3002 cereal::BinaryInputArchive bia(ss);
21
2/4
✓ Branch 1 taken 1002 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 499 times.
✗ Branch 5 not taken.
1501 bia(serializable);
22 1501 }
23
24 template <class Serializable>
25 69 int Serializer<Serializable>::serializable_size()
26 {
27
2/4
✓ Branch 1 taken 33 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 36 times.
✗ Branch 5 not taken.
135 Serializable serializable;
28 138 Serializer<Serializable> serializer;
29
2/4
✓ Branch 1 taken 33 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 36 times.
✗ Branch 5 not taken.
69 const std::string& data = serializer.serialize(serializable);
30 138 return data.size();
31 }
32
33 } // namespace shared_memory
34