Line |
Branch |
Exec |
Source |
1 |
|
|
/************************************************************************ |
2 |
|
|
* |
3 |
|
|
* Copyright (C) 2009-2024 IRCAD France |
4 |
|
|
* Copyright (C) 2012-2017 IHU Strasbourg |
5 |
|
|
* |
6 |
|
|
* This file is part of Sight. |
7 |
|
|
* |
8 |
|
|
* Sight is free software: you can redistribute it and/or modify it under |
9 |
|
|
* the terms of the GNU Lesser General Public License as published by |
10 |
|
|
* the Free Software Foundation, either version 3 of the License, or |
11 |
|
|
* (at your option) any later version. |
12 |
|
|
* |
13 |
|
|
* Sight is distributed in the hope that it will be useful, |
14 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
|
|
* GNU Lesser General Public License for more details. |
17 |
|
|
* |
18 |
|
|
* You should have received a copy of the GNU Lesser General Public |
19 |
|
|
* License along with Sight. If not, see <https://www.gnu.org/licenses/>. |
20 |
|
|
* |
21 |
|
|
***********************************************************************/ |
22 |
|
|
|
23 |
|
|
#include "io/igtl/detail/converter/tracking_stop_converter.hpp" |
24 |
|
|
|
25 |
|
|
#include "io/igtl/detail/data_converter.hpp" |
26 |
|
|
|
27 |
|
|
#include <data/boolean.hpp> |
28 |
|
|
#include <data/map.hpp> |
29 |
|
|
|
30 |
|
|
#include <igtlTrackingDataMessage.h> |
31 |
|
|
|
32 |
|
|
namespace sight::io::igtl::detail::converter |
33 |
|
|
{ |
34 |
|
|
|
35 |
|
|
const std::string tracking_stop_converter::IGTL_TYPE = "STP_TDATA"; |
36 |
|
|
const std::string tracking_stop_converter::FWDATA_OBJECT_TYPE = data::map::classname(); |
37 |
|
|
const std::string STATUS_KEY = "Status"; |
38 |
|
|
|
39 |
|
|
CONVERTER_REGISTER_MACRO(io::igtl::detail::converter::tracking_stop_converter); |
40 |
|
|
|
41 |
|
1 |
tracking_stop_converter::tracking_stop_converter() |
42 |
|
|
= default; |
43 |
|
|
|
44 |
|
|
//----------------------------------------------------------------------------- |
45 |
|
|
|
46 |
|
2 |
tracking_stop_converter::~tracking_stop_converter() |
47 |
|
|
= default; |
48 |
|
|
|
49 |
|
|
//----------------------------------------------------------------------------- |
50 |
|
|
|
51 |
|
✗ |
::igtl::MessageBase::Pointer tracking_stop_converter::from_fw_data_object(data::object::csptr /*src*/) const |
52 |
|
|
{ |
53 |
|
✗ |
::igtl::StopTrackingDataMessage::Pointer tracking_msg = ::igtl::StopTrackingDataMessage::New(); |
54 |
|
✗ |
return {tracking_msg.GetPointer()}; |
55 |
|
|
} |
56 |
|
|
|
57 |
|
|
//----------------------------------------------------------------------------- |
58 |
|
|
|
59 |
|
✗ |
data::object::sptr tracking_stop_converter::from_igtl_message(const ::igtl::MessageBase::Pointer /*src*/) const |
60 |
|
|
{ |
61 |
|
✗ |
data::map::sptr map = std::make_shared<data::map>(); |
62 |
|
✗ |
data::boolean::sptr status = std::make_shared<data::boolean>(); |
63 |
|
✗ |
(*map)[STATUS_KEY] = status; |
64 |
|
|
|
65 |
|
✗ |
status->set_value(false); |
66 |
|
|
|
67 |
|
✗ |
return map; |
68 |
|
|
} |
69 |
|
|
|
70 |
|
|
//----------------------------------------------------------------------------- |
71 |
|
|
|
72 |
|
1 |
base::sptr tracking_stop_converter::New() |
73 |
|
|
{ |
74 |
|
1 |
return std::make_shared<tracking_stop_converter>(); |
75 |
|
|
} |
76 |
|
|
|
77 |
|
|
//----------------------------------------------------------------------------- |
78 |
|
|
|
79 |
|
✗ |
std::string const& tracking_stop_converter::get_igtl_type() const |
80 |
|
|
{ |
81 |
|
✗ |
return tracking_stop_converter::IGTL_TYPE; |
82 |
|
|
} |
83 |
|
|
|
84 |
|
|
//----------------------------------------------------------------------------- |
85 |
|
|
|
86 |
|
✗ |
std::string const& tracking_stop_converter::get_fw_data_object_type() const |
87 |
|
|
{ |
88 |
|
✗ |
return tracking_stop_converter::FWDATA_OBJECT_TYPE; |
89 |
|
|
} |
90 |
|
|
|
91 |
|
|
} // namespace sight::io::igtl::detail::converter |
92 |
|
|
|