OSVR-Core
|
A class used for step-by-step construction and configuration of a server. More...
#include <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) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. 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. More... | |
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. More... | |
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)
osvr::server::ConfigureServer::~ConfigureServer | ( | ) |
Destructor.
Must be in implementation file to handle deletion of private data class.
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.
ConfigureServer::ErrorList const & osvr::server::ConfigureServer::getFailedInstantiations | ( | ) | const |
Get a reference to the list of drivers instantiateDrivers() tried to instantiate but failed, along with any exception text.
ConfigureServer::ErrorList const & osvr::server::ConfigureServer::getFailedPlugins | ( | ) | const |
Get a reference to the list of plugins loadPlugins() tried but failed to load, along with any exception text.
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()
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 |
void osvr::server::ConfigureServer::loadConfig | ( | std::istream & | json | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
json A stream containing json configuration
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()
bool osvr::server::ConfigureServer::processDisplay | ( | ) |
Process a display element in the config.
bool osvr::server::ConfigureServer::processExternalDevices | ( | ) |
Process any external devices in the config.
bool osvr::server::ConfigureServer::processRenderManagerParameters | ( | ) |
Process a RenderManager config element in the config.