25 #ifndef INCLUDED_Context_h_GUID_DD0155F5_61A4_4A76_8C2E_D9614C7A9EBD
26 #define INCLUDED_Context_h_GUID_DD0155F5_61A4_4A76_8C2E_D9614C7A9EBD
50 : m_context(context) {}
57 throw std::runtime_error(
"Error updating context.");
66 throw std::runtime_error(
67 "Couldn't create interface because the path was invalid.");
77 m_context, path.c_str(), &
length);
79 throw std::runtime_error(
80 "Invalid context or null reference to length variable.");
92 throw std::runtime_error(
"Invalid context, null reference to "
93 "buffer, or buffer is too small.");
102 throw std::logic_error(
103 "Could not free interface: either null or already freed!");
123 #endif // INCLUDED_Context_h_GUID_DD0155F5_61A4_4A76_8C2E_D9614C7A9EBD
OSVR_ReturnCode osvrClientGetInterface(OSVR_ClientContext ctx, const char path[], OSVR_ClientInterface *iface)
Get the interface associated with the given path.
ClientContext(const char applicationIdentifier[], uint32_t flags=0u)
Initialize the library.
OSVR_ReturnCode osvrClientFreeInterface(OSVR_ClientContext ctx, OSVR_ClientInterface iface)
Free an interface object before context closure.
Interface handle object. Typically acquired from a ClientContext.
void log(OSVR_LogLevel severity, const char *message)
Log a message to the plugin-specific channel.
bool checkStatus() const
Checks to see if the client context is properly and fully started up.
The main namespace for all C++ elements of the framework, internal and external.
OSVR_ClientContext osvrClientInit(const char applicationIdentifier[], uint32_t flags=0)
Initialize the library.
void free(Interface &iface)
Frees an interface before it would normally be freed (at context close).
OSVR_ReturnCode osvrClientGetStringParameterLength(OSVR_ClientContext ctx, const char path[], size_t *len)
Get the length of a string parameter associated with the given path.
size< coerce_list< Ts...>> length
Synonym for typepack::size.
std::string str()
Converts the buffer into a string.
Interface getInterface(const std::string &path)
Get the interface associated with the given path.
OSVR_ClientInterface get()
Get the raw OSVR_ClientInterface from this wrapper.
OSVR_ReturnCode osvrClientCheckStatus(OSVR_ClientContext ctx)
Checks to see if the client context is fully started up and connected properly to a server...
OSVR_ReturnCode osvrClientShutdown(OSVR_ClientContext ctx)
Shutdown the library.
#define OSVR_RETURN_SUCCESS
The "success" value for an OSVR_ReturnCode.
struct OSVR_ClientContextObject * OSVR_ClientContext
Opaque handle that should be retained by your application. You need only and exactly one...
OSVR_ReturnCode osvrClientUpdate(OSVR_ClientContext ctx)
Updates the state of the context - call regularly in your mainloop.
OSVR_ClientContext get()
Gets the bare OSVR_ClientContext.
OSVR_LogLevel
Log message severity levels.
void osvrClientLog(OSVR_ClientContext ctx, OSVR_LogLevel severity, const char *message)
Log a message from the client.
A utility class to adapt APIs that first provide a length, then place a string in a user-allocated bu...
void update()
Updates the state of the context - call regularly in your mainloop.
Header containing the inline implementation of Interface.
struct OSVR_ClientInterfaceObject * OSVR_ClientInterface
Opaque handle to an interface used for registering callbacks and getting status.
OSVR_ReturnCode osvrClientGetStringParameter(OSVR_ClientContext ctx, const char path[], char *buf, size_t len)
Get a string parameter associated with the given path.
~ClientContext()
Destructor: Shutdown the library.
char * getBufferOfSize(std::size_t n)
Allocates a buffer of size n, to include the null terminator, and returns a pointer into it...
std::string getStringParameter(const std::string &path)
Get a string parameter value from the given path.