MCPcopy Create free account
hub / github.com/OSVR/OSVR-Core / JointClientContext

Method JointClientContext

src/osvr/JointClientKit/JointClientContext.cpp:53–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51 static const std::chrono::milliseconds STARTUP_LOOP_SLEEP(1);
52
53 JointClientContext::JointClientContext(const char appId[],
54 common::ClientContextDeleter del)
55 : ::OSVR_ClientContextObject(appId, del),
56 m_ifaceMgr(m_pathTreeOwner, m_factory,
57 *static_cast<common::ClientContext *>(this)) {
58
59 /// Create all the remote handler factories.
60 populateRemoteHandlerFactory(m_factory, m_vrpnConns);
61
62 /// creates the OSVR connection with its nested VRPN connection
63 auto conn = connection::Connection::createLoopbackConnection();
64
65 /// Get the VRPN connection out and use it.
66 m_mainConn = static_cast<vrpn_Connection *>(std::get<0>(conn));
67 m_vrpnConns.addConnection(m_mainConn, HOST);
68 BOOST_ASSERT(!m_vrpnConns.empty());
69
70 /// Get the OSVR connection out and use it to make a server.
71 m_server = server::Server::create(std::get<1>(conn));
72
73 std::string sysDeviceName =
74 std::string(common::SystemComponent::deviceName()) + "@" + HOST;
75
76 /// Create the system client device.
77 m_systemDevice = common::createClientDevice(sysDeviceName, m_mainConn);
78 m_systemComponent =
79 m_systemDevice->addComponent(common::SystemComponent::create());
80 typedef common::DeduplicatingFunctionWrapper<Json::Value const &>
81 DedupJsonFunction;
82
83 using DedupJsonFunction =
84 common::DeduplicatingFunctionWrapper<Json::Value const &>;
85 m_systemComponent->registerReplaceTreeHandler(
86 DedupJsonFunction([&](Json::Value nodes) {
87
88 OSVR_DEV_VERBOSE("Got updated path tree, processing");
89
90 // Tree observers will handle destruction/creation of remote
91 // handlers.
92 m_pathTreeOwner.replaceTree(nodes);
93 }));
94 }
95
96 JointClientContext::~JointClientContext() {}
97

Callers

nothing calls this directly

Calls 7

createClientDeviceFunction · 0.85
addConnectionMethod · 0.80
replaceTreeMethod · 0.80
emptyMethod · 0.45
addComponentMethod · 0.45

Tested by

no test coverage detected