43 using ServerOp = std::function<void(Server &)>;
 
   47         for (
auto &op : operations) {
 
   52     template <
typename F> 
void enqueue(F &&f) {
 
   53         operations.emplace_back(std::forward<F>(f));
 
   55     std::vector<ServerOp> operations;
 
   57     bool haveAutoload = 
false;
 
   64 #define OSVR_CHECK_OPTS                                                        \ 
   65     OSVR_UTIL_MULTILINE_BEGIN                                                  \ 
   66     if (nullptr == opts) {                                                     \ 
   68             "Can't modify a null JointClientKit options object!");             \ 
   69         return OSVR_RETURN_FAILURE;                                            \ 
   71     OSVR_UTIL_MULTILINE_END 
   73 #define OSVR_OPTS_SINGLE_SHOT(MEMBER, DESC)                                    \ 
   74     OSVR_UTIL_MULTILINE_BEGIN                                                  \ 
   76         OSVR_DEV_VERBOSE("Already queued " DESC                                \ 
   77                          " -- can't do it a second time!");                    \ 
   78         return OSVR_RETURN_FAILURE;                                            \ 
   80     opts->MEMBER = true;                                                       \ 
   81     OSVR_UTIL_MULTILINE_END 
   83 #define OSVR_OPTS_CHECK_STRING(PARAM, DESC)                                    \ 
   84     OSVR_UTIL_MULTILINE_BEGIN                                                  \ 
   85     if (nullptr == (PARAM) || '\0' == (PARAM)[0]) {                            \ 
   86         OSVR_DEV_VERBOSE("Invalid string passed for  " DESC                    \ 
   87                          " -- can't be null or empty!");                       \ 
   88         return OSVR_RETURN_FAILURE;                                            \ 
   90     OSVR_UTIL_MULTILINE_END 
   95     OSVR_OPTS_SINGLE_SHOT(haveAutoload, 
"autoload of plugins");
 
  101                                                  const char *pluginName) {
 
  103     OSVR_OPTS_CHECK_STRING(pluginName, 
"plugin name");
 
  104     auto name = std::string{pluginName};
 
  111     const char *params) {
 
  113     OSVR_OPTS_CHECK_STRING(pluginName, 
"plugin name");
 
  114     OSVR_OPTS_CHECK_STRING(driverName, 
"driver name");
 
  115     auto plugin = std::string{pluginName};
 
  116     auto driver = std::string{driverName};
 
  117     auto p = std::string{(params ? params : 
"")};
 
  118     opts->enqueue([plugin, driver, p](
Server &s) {
 
  126                                                const char *source) {
 
  128     OSVR_OPTS_CHECK_STRING(path, 
"path");
 
  129     OSVR_OPTS_CHECK_STRING(source, 
"source");
 
  130     auto p = std::string{path};
 
  131     auto src = std::string{source};
 
  137                                                  const char *aliases) {
 
  139     OSVR_OPTS_CHECK_STRING(aliases, 
"aliases JSON");
 
  140     auto json = std::string{aliases};
 
  149     OSVR_OPTS_CHECK_STRING(path, 
"path");
 
  150     OSVR_OPTS_CHECK_STRING(s, 
"string value");
 
  151     auto p = std::string{path};
 
  152     auto str = std::string{s};
 
  167         using OptionPtr = std::unique_ptr<OSVR_JointClientContextOptsObject>;
 
  171         using JointContextPtr =
 
  172             std::unique_ptr<osvr::client::JointClientContext>;
 
  174         auto ctx = JointContextPtr{
 
  175             osvr::common::makeContext<osvr::client::JointClientContext>(
 
  176                 applicationIdentifier)};
 
  179             opt->apply(ctx->getServer());
 
  182             ctx->getServer().loadAutoPlugins();
 
  183             ctx->getServer().triggerHardwareDetect();
 
  186         return ctx.release();
 
  187     } 
catch (std::exception 
const &e) {
 
  189             "Caught an exception in osvrJointClientInit: " << e.what());
 
  193             "Caught an unrecognized exception type in osvrJointClientInit.");
 
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 triggerHardwareDetect()
Run all hardware detect callbacks. 
OSVR_ReturnCode osvrJointClientOptionsLoadPlugin(OSVR_JointClientOpts opts, const char *pluginName)
Queues up the manual load of a plugin by name. 
OSVR_ReturnCode osvrJointClientOptionsAddAlias(OSVR_JointClientOpts opts, const char *path, const char *source)
Queues up the manual addition of an alias to the path tree. 
OSVR_SERVER_EXPORT bool addString(std::string const &path, std::string const &value)
Add a string entry to the tree. 
OSVR_ReturnCode osvrJointClientOptionsAddString(OSVR_JointClientOpts opts, const char *path, const char *s)
Queues up the manual addition of a string element to the path tree. 
Class handling a run-loop with a registration context and connection. 
OSVR_SERVER_EXPORT void loadPlugin(std::string const &plugin)
Load plugin by name. 
OSVR_JointClientOpts osvrJointClientCreateOptions()
Creates an empty OSVR_JointClientOpts. 
OSVR_ClientContext osvrJointClientInit(const char applicationIdentifier[], OSVR_JointClientOpts opts)
Initialize the library, starting up a "joint" context that also contains a server. 
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. 
Header declaring osvr::server::Server. 
#define OSVR_RETURN_SUCCESS
The "success" value for an OSVR_ReturnCode. 
OSVR_ReturnCode osvrJointClientOptionsTriggerHardwareDetect(OSVR_JointClientOpts opts)
Queues up a trigger for hardware detection. 
OSVR_ReturnCode osvrJointClientOptionsAutoloadPlugins(OSVR_JointClientOpts opts)
Queues up the autoloading of plugins. May only be called once per options object. ...
OSVR_SERVER_EXPORT void loadAutoPlugins()
Load all auto-loadable plugins. 
OSVR_ReturnCode osvrJointClientOptionsAddAliases(OSVR_JointClientOpts opts, const char *aliases)
Queues up the manual addition of aliases specified in JSON to the path tree. 
Internal, configured header file for verbosity macros. 
OSVR_ReturnCode osvrJointClientOptionsInstantiateDriver(OSVR_JointClientOpts opts, const char *pluginName, const char *driverName, const char *params)
Queues up the manual instantiation of a plugin/driver by name with optional parameters (JSON)...
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.