OSVR-Core
Public Member Functions | List of all members
osvr::clientkit::ClientContext Class Reference

Client context object: Create and keep one in your application. More...

#include <Context_decl.h>

Inheritance diagram for osvr::clientkit::ClientContext:

Public Member Functions

 ClientContext (const char applicationIdentifier[], uint32_t flags=0u)
 Initialize the library. More...
 
 ClientContext (const char applicationIdentifier[], const char host[], uint32_t flags=0u)
 Initialize the library. More...
 
 ClientContext (OSVR_ClientContext context)
 Initialize the context with an existing context. More...
 
 ~ClientContext ()
 Destructor: Shutdown the library.
 
void update ()
 Updates the state of the context - call regularly in your mainloop. More...
 
Interface getInterface (const std::string &path)
 Get the interface associated with the given path. More...
 
std::string getStringParameter (const std::string &path)
 Get a string parameter value from the given path. More...
 
void free (Interface &iface)
 Frees an interface before it would normally be freed (at context close). More...
 
bool checkStatus () const
 Checks to see if the client context is properly and fully started up. More...
 
OSVR_ClientContext get ()
 Gets the bare OSVR_ClientContext.
 
void log (OSVR_LogLevel severity, const char *message)
 Log a message to the plugin-specific channel. More...
 

Detailed Description

Client context object: Create and keep one in your application.

Handles lifetime management and provides access to ClientKit functionality.

Constructor & Destructor Documentation

§ ClientContext() [1/3]

osvr::clientkit::ClientContext::ClientContext ( const char  applicationIdentifier[],
uint32_t  flags = 0u 
)
inline

Initialize the library.

Parameters
applicationIdentifierA string identifying your application. Reverse DNS format strongly suggested.
flagsinitialization options (reserved, optional)

§ ClientContext() [2/3]

osvr::clientkit::ClientContext::ClientContext ( const char  applicationIdentifier[],
const char  host[],
uint32_t  flags = 0u 
)
inline

Initialize the library.

Parameters
applicationIdentifierA string identifying your application.
hostRemote server to connect to Reverse DNS format strongly suggested.
flagsinitialization options (reserved, optional)

§ ClientContext() [3/3]

osvr::clientkit::ClientContext::ClientContext ( OSVR_ClientContext  context)
inline

Initialize the context with an existing context.

Note
The ClientContext class will take ownership of the context.

Member Function Documentation

§ checkStatus()

bool osvr::clientkit::ClientContext::checkStatus ( ) const
inline

Checks to see if the client context is properly and fully started up.

If this returns false, there may not be a server running, or it may be taking longer than usual to connect. The result will not change from false to true without calling update() - consider a loop.

§ free()

void osvr::clientkit::ClientContext::free ( Interface iface)
inline

Frees an interface before it would normally be freed (at context close).

§ getInterface()

Interface osvr::clientkit::ClientContext::getInterface ( const std::string &  path)
inline

Get the interface associated with the given path.

Parameters
pathA resource path.
Returns
The interface object.

§ getStringParameter()

std::string osvr::clientkit::ClientContext::getStringParameter ( const std::string &  path)
inline

Get a string parameter value from the given path.

Parameters
pathA resource path.
Returns
parameter value, or empty string if parameter does not exist or is not a string.

§ log()

void osvr::clientkit::ClientContext::log ( OSVR_LogLevel  severity,
const char *  message 
)
inline

Log a message to the plugin-specific channel.

Parameters
severityThe severity of the log message.
messageThe message to be logged.

§ update()

void osvr::clientkit::ClientContext::update ( )
inline

Updates the state of the context - call regularly in your mainloop.


The documentation for this class was generated from the following files: