25 #ifndef INCLUDED_Server_h_GUID_453158B3_45B7_478D_FB83_F2F694CA5367 26 #define INCLUDED_Server_h_GUID_453158B3_45B7_478D_FB83_F2F694CA5367 29 #include <osvr/Server/Export.h> 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 &);
86 OSVR_SERVER_EXPORT ~
Server();
90 OSVR_SERVER_EXPORT
static ServerPtr createLocal();
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();
130 OSVR_SERVER_EXPORT
void startAndAwaitShutdown();
135 OSVR_SERVER_EXPORT
void awaitShutdown();
142 OSVR_SERVER_EXPORT
void stop();
148 OSVR_SERVER_EXPORT
void signalStop();
153 OSVR_SERVER_EXPORT
void loadPlugin(std::string
const &plugin);
156 OSVR_SERVER_EXPORT
void loadAutoPlugins();
163 OSVR_SERVER_EXPORT
void setHardwareDetectOnConnection();
173 OSVR_SERVER_EXPORT
void 174 instantiateDriver(std::string
const &plugin, std::string
const &driver,
175 std::string
const ¶ms = std::string());
180 OSVR_SERVER_EXPORT
void triggerHardwareDetect();
186 OSVR_SERVER_EXPORT
void registerMainloopMethod(MainloopMethod f);
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);
224 OSVR_SERVER_EXPORT
bool addAliases(
225 Json::Value
const &aliases,
226 common::AliasPriority priority = common::ALIASPRIORITY_MANUAL);
234 OSVR_SERVER_EXPORT
void addExternalDevice(
235 std::string
const &path, std::string
const &deviceName,
236 std::string
const &server, std::string
const &descriptor);
243 OSVR_SERVER_EXPORT
void setSleepTime(
int microseconds);
246 OSVR_SERVER_EXPORT
int getSleepTime()
const;
253 unique_ptr<ServerImpl> m_impl;
258 #endif // INCLUDED_Server_h_GUID_453158B3_45B7_478D_FB83_F2F694CA5367
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
std::function< void()> MainloopMethod
A function that can be registered by the server app to run in each mainloop iteration.
Definition: Server.h:52
Class handling a run-loop with a registration context and connection.
Definition: Server.h:67
shared_ptr< Connection > ConnectionPtr
How one must hold a Connection.
Definition: ConnectionPtr.h:40
Header to bring unique_ptr into the osvr namespace.
Private implementation class for Server.
Definition: ServerImpl.h:60
bool addAlias(PathNode &node, std::string const &source, AliasPriority priority)
Definition: PathTree.cpp:117
shared_ptr< Server > ServerPtr
How one should hold a Server.
Definition: ServerPtr.h:39
Header forward-declaring the types in PathElementTypes.h and including the PathElement typedef...
Header forward-declaring Connection and specifying the smart pointer to hold a Connection in...