OSVR-Core
Public Member Functions | List of all members
osvr::server::ServerImpl Class Reference

Private implementation class for Server. More...

#include <ServerImpl.h>

Inheritance diagram for osvr::server::ServerImpl:

Public Member Functions

 ServerImpl (connection::ConnectionPtr const &conn, boost::optional< std::string > const &host, boost::optional< int > const &port)
 Constructor.
 
 ~ServerImpl ()
 Destructor (stops the thread first)
 
void start ()
 Launch a thread running the server.
 
void startAndAwaitShutdown ()
 Launch a thread running the server, and block until the server shuts down. More...
 
void awaitShutdown ()
 Block until the server shuts down. More...
 
void stop ()
 Signal the server to stop, and block until it does so.
 
void signalStop ()
 Signal the server to stop (if it is running) but return immediately. More...
 
void loadPlugin (std::string const &pluginName)
 Load named plugin.
 
void loadAutoPlugins ()
 Load all auto-loadable plugins.
 
void setHardwareDetectOnConnection ()
 Adds the behavior that hardware detection should take place on client connection. More...
 
void triggerHardwareDetect ()
 Run all hardware detect callbacks. More...
 
void registerMainloopMethod (MainloopMethod f)
 Register a method to run during every time through the main loop. More...
 
bool addRoute (std::string const &routingDirective)
 Register a JSON string as a routing directive. More...
 
bool addAlias (std::string const &path, std::string const &source, common::AliasPriority priority)
 Add an alias entry to the tree. More...
 
bool addAliases (Json::Value const &aliases, common::AliasPriority priority)
 Add alias entries to the tree from JSON. More...
 
void addExternalDevice (std::string const &path, std::string const &deviceName, std::string const &server, std::string const &descriptor)
 Add an external device entry manually to the tree. More...
 
bool addString (std::string const &path, std::string const &value)
 Add a string entry to the tree. More...
 
void setSleepTime (int microseconds)
 Sets the amount of time (in microseconds) that the server loop will sleep each loop when a client is connected (0 means no sleep) More...
 
void instantiateDriver (std::string const &plugin, std::string const &driver, std::string const &params)
 Instantiate the named driver with parameters. More...
 
void update ()
 The method to just do the update stuff, not in a thread.
 

Detailed Description

Private implementation class for Server.

Member Function Documentation

§ addAlias()

bool osvr::server::ServerImpl::addAlias ( std::string const &  path,
std::string const &  source,
common::AliasPriority  priority 
)

Add an alias entry to the tree.

If the server is running, this will trigger a re-transmission of the path tree to all clients.

Safe to call from any thread, even when server is running.

§ addAliases()

bool osvr::server::ServerImpl::addAliases ( Json::Value const &  aliases,
common::AliasPriority  priority 
)

Add alias entries to the tree from JSON.

If the server is running, this will trigger a re-transmission of the path tree to all clients.

Safe to call from any thread, even when server is running.

§ addExternalDevice()

void osvr::server::ServerImpl::addExternalDevice ( std::string const &  path,
std::string const &  deviceName,
std::string const &  server,
std::string const &  descriptor 
)

Add an external device entry manually to the tree.

If the server is running, this will trigger a re-transmission of the path tree to all clients.

Safe to call from any thread, even when server is running.

Get the node

Create the DeviceElement and set it as the node value - assume it's a VRPN device by default.

Process device descriptor

§ addRoute()

bool osvr::server::ServerImpl::addRoute ( std::string const &  routingDirective)

Register a JSON string as a routing directive.

If the server is running, this will trigger a re-transmission of the path tree to all clients.

Returns
true if the route was new, or false if it replaced an existing route for that destination.

Safe to call from any thread, even when server is running.

§ addString()

bool osvr::server::ServerImpl::addString ( std::string const &  path,
std::string const &  value 
)

Add a string entry to the tree.

If the server is running, this will trigger a re-transmission of the path tree to all clients.

Safe to call from any thread, even when server is running.

§ awaitShutdown()

void osvr::server::ServerImpl::awaitShutdown ( )

Block until the server shuts down.

Do not call from within the server thread itself, of course.

§ instantiateDriver()

void osvr::server::ServerImpl::instantiateDriver ( std::string const &  plugin,
std::string const &  driver,
std::string const &  params 
)

Instantiate the named driver with parameters.

Parameters
pluginThe name of a plugin.
driverThe name of a driver registered by the plugin for creation in this way.
paramsA string containing parameters. Format is between you and the plugin, but JSON is recommended.

Call only before starting the server or from within server thread.

§ registerMainloopMethod()

void osvr::server::ServerImpl::registerMainloopMethod ( MainloopMethod  f)

Register a method to run during every time through the main loop.

Safe to call from any thread, even when server is running.

§ setHardwareDetectOnConnection()

void osvr::server::ServerImpl::setHardwareDetectOnConnection ( )

Adds the behavior that hardware detection should take place on client connection.

Safe to call from any thread, even when server is running, though it makes the most sense as a startup option.

§ setSleepTime()

void osvr::server::ServerImpl::setSleepTime ( int  microseconds)

Sets the amount of time (in microseconds) that the server loop will sleep each loop when a client is connected (0 means no sleep)

Call only before starting the server or from within server thread.

§ signalStop()

void osvr::server::ServerImpl::signalStop ( )

Signal the server to stop (if it is running) but return immediately.

§ startAndAwaitShutdown()

void osvr::server::ServerImpl::startAndAwaitShutdown ( )

Launch a thread running the server, and block until the server shuts down.

§ triggerHardwareDetect()

void osvr::server::ServerImpl::triggerHardwareDetect ( )

Run all hardware detect callbacks.

Safe to call from any thread, even when server is running.


The documentation for this class was generated from the following files: