CustusX  22.04-rc5
An IGT application
cxIGTLinkStreamerService.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
12 
13 #include "cxStringProperty.h"
14 #include "cxDoubleProperty.h"
16 
17 namespace cx
18 {
19 
21 {
22  return "Remote Server";
23 }
24 
26 {
27  return "remote_server_streamer";
28 }
29 
30 std::vector<PropertyPtr> IGTLinkStreamerService::getSettings(QDomElement root)
31 {
32  std::vector<PropertyPtr> retval;
33  retval.push_back(this->getIPOption(root));
34  retval.push_back(this->getStreamPortOption(root));
35  return retval;
36 }
37 
39 {
40  boost::shared_ptr<IGTLinkClientStreamer> streamer(new IGTLinkClientStreamer());
41  streamer->setAddress(this->getIPOption(root)->getValue(),
42  this->getStreamPortOption(root)->getValue());
43  return streamer;
44 
45 }
46 
47 
48 StringPropertyBasePtr IGTLinkStreamerService::getIPOption(QDomElement root)
49 {
50  StringPropertyPtr retval;
51  QString defaultValue = "127.0.0.1";
52  retval = StringProperty::initialize("ip_scanner", "Address", "TCP/IP Address",
53  defaultValue, root);
54  retval->setGroup("Connection");
55  return retval;
56 }
57 
58 
59 DoublePropertyBasePtr IGTLinkStreamerService::getStreamPortOption(QDomElement root)
60 {
61  DoublePropertyPtr retval;
62  retval = DoubleProperty::initialize("ip_port", "Port", "TCP/IP Port (default 18333)",
63  18333, DoubleRange(1024, 49151, 1), 0, root);
64  retval->setGuiRepresentation(DoublePropertyBase::grSPINBOX);
65  retval->setAdvanced(true);
66  retval->setGroup("Connection");
67  return retval;
68 }
69 
70 } // namespace cx
Utility class for describing a bounded numeric range.
Definition: cxDoubleRange.h:32
boost::shared_ptr< class StringProperty > StringPropertyPtr
boost::shared_ptr< class StringPropertyBase > StringPropertyBasePtr
boost::shared_ptr< class DoublePropertyBase > DoublePropertyBasePtr
static StringPropertyPtr initialize(const QString &uid, QString name, QString help, QString value, QStringList range, QDomNode root=QDomNode())
boost::shared_ptr< class DoubleProperty > DoublePropertyPtr
static DoublePropertyPtr initialize(const QString &uid, QString name, QString help, double value, DoubleRange range, int decimals, QDomNode root=QDomNode())
boost::shared_ptr< class Streamer > StreamerPtr
Namespace for all CustusX production code.