39 #include <json/value.h>
42 #include <unordered_set>
48 static const auto HOST =
"localhost";
54 common::ClientContextDeleter del)
56 m_ifaceMgr(m_pathTreeOwner, m_factory,
57 *static_cast<common::ClientContext *>(this)) {
60 populateRemoteHandlerFactory(m_factory, m_vrpnConns);
63 auto conn = connection::Connection::createLoopbackConnection();
66 m_mainConn =
static_cast<vrpn_Connection *
>(std::get<0>(conn));
67 m_vrpnConns.addConnection(m_mainConn, HOST);
68 BOOST_ASSERT(!m_vrpnConns.empty());
73 std::string sysDeviceName =
83 using DedupJsonFunction =
85 m_systemComponent->registerReplaceTreeHandler(
86 DedupJsonFunction([&](Json::Value nodes) {
88 OSVR_DEV_VERBOSE(
"Got updated path tree, processing");
96 JointClientContext::~JointClientContext() {}
98 void JointClientContext::m_update() {
103 m_vrpnConns.updateAll();
106 m_systemDevice->update();
111 void JointClientContext::m_sendRoute(std::string
const &route) {
112 m_systemComponent->sendClientRouteUpdate(route);
116 void JointClientContext::m_handleNewInterface(
121 void JointClientContext::m_handleReleasingInterface(
123 m_ifaceMgr.releaseInterface(iface);
126 bool JointClientContext::m_getStatus()
const {
128 return bool(m_pathTreeOwner);
131 common::PathTree
const &JointClientContext::m_getPathTree()
const {
132 return m_pathTreeOwner.
get();
void replaceTree(Json::Value const &nodes)
Replace the entirety of the path tree from the given serialized array of nodes.
shared_ptr< ClientInterface > ClientInterfacePtr
Pointer for holding ClientInterface objects safely.
BaseDevicePtr createClientDevice(std::string const &name, vrpn_ConnectionPtr const &conn)
Factory function for a bare client device with no components/interfaces registered by default...
Header including PathTree.h and all additional headers needed to define related types.
Header declaring osvr::server::Server.
static OSVR_SERVER_EXPORT ServerPtr createNonListening(connection::ConnectionPtr const &conn)
Create a server object with a provided connection with a provided connection that has been asserted t...
JointClientContext(const char appId[], common::ClientContextDeleter del)
static shared_ptr< SystemComponent > create()
Factory method.
void addInterface(common::ClientInterfacePtr const &iface, bool verboseFailure=true)
Internal, configured header file for verbosity macros.
static const char * deviceName()
Get the special device name to be used with this component.
void updateHandlers()
run update on all remote handlers
A wrapper for a unary function that only calls its contained function when the input has changed...
PathTree & get()
Access the path tree object itself.