Directory: | ./ |
---|---|
File: | libs/io/session/macros.hpp |
Date: | 2024-04-24 14:25:45 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 4 | 4 | 100.0% |
Branches: | 4 | 8 | 50.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | /************************************************************************ | ||
2 | * | ||
3 | * Copyright (C) 2022-2023 IRCAD France | ||
4 | * | ||
5 | * This file is part of Sight. | ||
6 | * | ||
7 | * Sight is free software: you can redistribute it and/or modify it under | ||
8 | * the terms of the GNU Lesser General Public License as published by | ||
9 | * the Free Software Foundation, either version 3 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * Sight is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU Lesser General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU Lesser General Public | ||
18 | * License along with Sight. If not, see <https://www.gnu.org/licenses/>. | ||
19 | * | ||
20 | ***********************************************************************/ | ||
21 | |||
22 | #pragma once | ||
23 | |||
24 | #include <io/session/session_reader.hpp> | ||
25 | #include <io/session/session_writer.hpp> | ||
26 | |||
27 | namespace sight::io::session | ||
28 | { | ||
29 | |||
30 | template<typename T> | ||
31 | struct SerializerRegister | ||
32 | { | ||
33 | 1050 | SerializerRegister(serializer_t _serializer, deserializer_t _deserializer) | |
34 | { | ||
35 |
2/4✓ Branch 2 taken 525 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 525 times.
✗ Branch 6 not taken.
|
1050 | sight::io::session::session_writer::set_serializer(T::classname(), _serializer); |
36 |
2/4✓ Branch 2 taken 525 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 525 times.
✗ Branch 6 not taken.
|
1050 | sight::io::session::session_reader::set_deserializer(T::classname(), _deserializer); |
37 | 1050 | } | |
38 | }; | ||
39 | |||
40 | #define SIGHT_REGISTER_SERIALIZER(dataName, serializer, deserializer) \ | ||
41 | static const sight::io::session::SerializerRegister<dataName> BOOST_PP_CAT(serializerRegister, __LINE__)(serializer, \ | ||
42 | deserializer); | ||
43 | |||
44 | } // namespace sight::io::session | ||
45 |