A class used for step-by-step construction and configuration of a server. More...
#include <osvr/Server/ConfigureServer.h>
Public Types | |
typedef std::vector< std::string > | SuccessList |
Container for plugin/driver names. | |
typedef std::pair< std::string, std::string > | ErrorPair |
Error information with attribution: .first field is plugin/driver name, .second field is exception text. | |
typedef std::vector< ErrorPair > | ErrorList |
Container for plugin/driver names and error messages. | |
Public Member Functions | |
OSVR_SERVER_EXPORT | ConfigureServer () |
Constructor. | |
OSVR_SERVER_EXPORT | ~ConfigureServer () |
Destructor. More... | |
OSVR_SERVER_EXPORT void | loadConfig (std::string const &json) |
Loads and parses the provided json. More... | |
OSVR_SERVER_EXPORT void | loadConfig (std::istream &json) |
json A stream containing json configuration More... | |
OSVR_SERVER_EXPORT ServerPtr | constructServer () |
Creates a server, choosing the factory method according to the passed JSON configuration. More... | |
OSVR_SERVER_EXPORT bool | loadPlugins () |
Loads the plugins contained in an array with key plugins in the configuration. More... | |
OSVR_SERVER_EXPORT bool | instantiateDrivers () |
Configures and instantiates the drivers as specified. More... | |
OSVR_SERVER_EXPORT bool | processRoutes () |
OSVR_SERVER_EXPORT bool | processAliases () |
OSVR_SERVER_EXPORT bool | processExternalDevices () |
Process any external devices in the config. More... | |
OSVR_SERVER_EXPORT bool | processDisplay () |
Process a display element in the config. More... | |
OSVR_SERVER_EXPORT bool | processRenderManagerParameters () |
Process a RenderManager config element in the config. More... | |
OSVR_SERVER_EXPORT void | loadAutoPlugins () |
Loads all plugins not marked for manual load. | |
Results of loadPlugins() | |
Get a reference to the list of plugins successfully loaded by loadPlugins() | |
OSVR_SERVER_EXPORT SuccessList const & | getSuccessfulPlugins () const |
OSVR_SERVER_EXPORT ErrorList const & | getFailedPlugins () const |
Get a reference to the list of plugins loadPlugins() tried but failed to load, along with any exception text. | |
Results of instantiateDrivers() | |
Get a reference to the list of drivers successfully instantiated by instantiateDrivers() | |
OSVR_SERVER_EXPORT SuccessList const & | getSuccessfulInstantiations () const |
OSVR_SERVER_EXPORT ErrorList const & | getFailedInstantiations () const |
Get a reference to the list of drivers instantiateDrivers() tried to instantiate but failed, along with any exception text. | |
A class used for step-by-step construction and configuration of a server.
For full configuration, run each named method, one by one, in the order they're seen in the header. (You only need to run one overload for each name)
Definition at line 52 of file ConfigureServer.h.
osvr::server::ConfigureServer::~ConfigureServer | ( | ) |
Destructor.
Must be in implementation file to handle deletion of private data class.
Definition at line 92 of file ConfigureServer.cpp.
void osvr::server::ConfigureServer::loadConfig | ( | std::string const & | json | ) |
Loads and parses the provided json.
std::runtime_error | if parsing errors occur. json A string containing json configuration |
Definition at line 94 of file ConfigureServer.cpp.
void osvr::server::ConfigureServer::loadConfig | ( | std::istream & | json | ) |
json A stream containing json configuration
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 98 of file ConfigureServer.cpp.
ServerPtr osvr::server::ConfigureServer::constructServer | ( | ) |
Creates a server, choosing the factory method according to the passed JSON configuration.
It first looks for an object under the server
key - if not present, it will assume defaults for below. This object is the context for the below elements.
If interface
is defined, it will open a server on that interface (with an empty string meaning all interfaces)
Otherwise, local
is assumed to be true. If it is false, it will open on all interfaces.
port
defaults to the assigned VRPN port (3883)
std::out_of_range | if an invalid port (<1) is specified. |
Extract data from the JSON structure.
Construct a server, or a connection then a server, based on the configuration we've extracted.
Definition at line 108 of file ConfigureServer.cpp.
bool osvr::server::ConfigureServer::loadPlugins | ( | ) |
Loads the plugins contained in an array with key plugins
in the configuration.
Detailed results of the loading can be retrieved with getSuccessfulPlugins() and getFailedPlugins()
Definition at line 175 of file ConfigureServer.cpp.
bool osvr::server::ConfigureServer::instantiateDrivers | ( | ) |
Configures and instantiates the drivers as specified.
Looks for an array with the key of drivers
, containing an array of objects. Each object is an instantiation, specifying driver
, plugin
, and params
to pass along. params
is typically nested JSON data.
Detailed results of the loading can be retrieved with getSuccessfulInstantiations() and getSuccessfulInstantiations()
Definition at line 215 of file ConfigureServer.cpp.
bool osvr::server::ConfigureServer::processExternalDevices | ( | ) |
Process any external devices in the config.
Definition at line 306 of file ConfigureServer.cpp.
bool osvr::server::ConfigureServer::processDisplay | ( | ) |
Process a display element in the config.
Definition at line 347 of file ConfigureServer.cpp.
bool osvr::server::ConfigureServer::processRenderManagerParameters | ( | ) |
Process a RenderManager config element in the config.
Definition at line 375 of file ConfigureServer.cpp.