25 #ifndef INCLUDED_Server_h_GUID_453158B3_45B7_478D_FB83_F2F694CA5367
26 #define INCLUDED_Server_h_GUID_453158B3_45B7_478D_FB83_F2F694CA5367
36 #include <boost/noncopyable.hpp>
37 #include <boost/optional.hpp>
60 : std::runtime_error(
"Could not create server - there is probably "
61 "another instance of the server or a VRPN "
62 "server running already.") {}
72 struct private_constructor {};
82 boost::optional<std::string>
const &host,
83 boost::optional<int>
const &port, private_constructor
const &);
108 boost::optional<std::string>
const &host,
109 boost::optional<int>
const &port);
119 OSVR_SERVER_EXPORT
void update();
124 OSVR_SERVER_EXPORT
void start();
142 OSVR_SERVER_EXPORT
void stop();
153 OSVR_SERVER_EXPORT
void loadPlugin(std::string
const &plugin);
173 OSVR_SERVER_EXPORT
void
175 std::string
const ¶ms = std::string());
197 OSVR_SERVER_EXPORT
bool addRoute(std::string
const &routingDirective);
205 OSVR_SERVER_EXPORT
bool
206 addAlias(std::string
const &path, std::string
const &source,
207 common::AliasPriority priority = common::ALIASPRIORITY_MANUAL);
215 OSVR_SERVER_EXPORT
bool addString(std::string
const &path,
216 std::string
const &value);
225 Json::Value
const &aliases,
226 common::AliasPriority priority = common::ALIASPRIORITY_MANUAL);
235 std::string
const &path, std::string
const &deviceName,
236 std::string
const &server, std::string
const &descriptor);
246 OSVR_SERVER_EXPORT
int getSleepTime()
const;
253 unique_ptr<ServerImpl> m_impl;
258 #endif // INCLUDED_Server_h_GUID_453158B3_45B7_478D_FB83_F2F694CA5367
OSVR_SERVER_EXPORT void startAndAwaitShutdown()
Launch a thread running the server, and block until the server shuts down.
OSVR_SERVER_EXPORT bool addAliases(Json::Value const &aliases, common::AliasPriority priority=common::ALIASPRIORITY_MANUAL)
Add alias entries to the tree from JSON.
OSVR_SERVER_EXPORT void start()
Launch a thread running the server.
OSVR_SERVER_EXPORT void triggerHardwareDetect()
Run all hardware detect callbacks.
OSVR_SERVER_EXPORT bool addString(std::string const &path, std::string const &value)
Add a string entry to the tree.
std::function< void()> MainloopMethod
A function that can be registered by the server app to run in each mainloop iteration.
Class handling a run-loop with a registration context and connection.
shared_ptr< Connection > ConnectionPtr
How one must hold a Connection.
OSVR_SERVER_EXPORT 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.
OSVR_SERVER_EXPORT void loadPlugin(std::string const &plugin)
Load plugin by name.
Header to bring unique_ptr into the osvr namespace.
OSVR_SERVER_EXPORT void registerMainloopMethod(MainloopMethod f)
Register a method to run during every time through the main loop.
OSVR_SERVER_EXPORT void stop()
Signal the server to stop (if it is running), and block until it does so.
OSVR_SERVER_EXPORT ~Server()
Destructor - stops the loop and blocks until it's done.
Automatically-generated export header - do not edit!
OSVR_SERVER_EXPORT void setHardwareDetectOnConnection()
Adds the behavior that hardware detection should take place on client connection. ...
OSVR_SERVER_EXPORT void awaitShutdown()
Block until the server shuts down.
OSVR_SERVER_EXPORT bool addRoute(std::string const &routingDirective)
Register a JSON string as a routing directive.
OSVR_SERVER_EXPORT bool addAlias(std::string const &path, std::string const &source, common::AliasPriority priority=common::ALIASPRIORITY_MANUAL)
Add an alias entry to the tree.
static OSVR_SERVER_EXPORT ServerPtr create(connection::ConnectionPtr const &conn)
Create a server object with a provided connection.
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...
Private implementation class for Server.
Server(connection::ConnectionPtr const &conn, boost::optional< std::string > const &host, boost::optional< int > const &port, private_constructor const &)
Private server constructor.
shared_ptr< Server > ServerPtr
How one should hold a Server.
OSVR_SERVER_EXPORT void signalStop()
Signal the server to stop (if it is running) but return immediately.
OSVR_SERVER_EXPORT void loadAutoPlugins()
Load all auto-loadable plugins.
OSVR_SERVER_EXPORT void update()
If you aren't using a separate thread for the server, this method will run a single update of the ser...
OSVR_SERVER_EXPORT void setSleepTime(int microseconds)
Sets the amount of time (in microseconds) that the server loop will sleep each loop when a client is ...
Header forward-declaring the types in PathElementTypes.h and including the PathElement typedef...
static OSVR_SERVER_EXPORT ServerPtr createLocal()
Create a server object with a local-only (but still IP-based) connection.
OSVR_SERVER_EXPORT void instantiateDriver(std::string const &plugin, std::string const &driver, std::string const ¶ms=std::string())
Instantiate the named driver with parameters.
Header forward-declaring Connection and specifying the smart pointer to hold a Connection in...