25 #ifndef INCLUDED_Context_h_GUID_DD0155F5_61A4_4A76_8C2E_D9614C7A9EBD 26 #define INCLUDED_Context_h_GUID_DD0155F5_61A4_4A76_8C2E_D9614C7A9EBD 55 : m_context(context) {}
62 throw std::runtime_error(
"Error updating context.");
71 throw std::runtime_error(
72 "Couldn't create interface because the path was invalid.");
82 m_context, path.c_str(), &
length);
84 throw std::runtime_error(
85 "Invalid context or null reference to length variable.");
97 throw std::runtime_error(
"Invalid context, null reference to " 98 "buffer, or buffer is too small.");
107 throw std::logic_error(
108 "Could not free interface: either null or already freed!");
128 #endif // INCLUDED_Context_h_GUID_DD0155F5_61A4_4A76_8C2E_D9614C7A9EBD OSVR_CLIENTKIT_EXPORT void osvrClientLog(OSVR_ClientContext ctx, OSVR_LogLevel severity, const char *message)
Log a message from the client.
Definition: ContextC.cpp:95
bool checkStatus() const
Checks to see if the client context is properly and fully started up.
Definition: Context.h:116
ClientContext(const char applicationIdentifier[], uint32_t flags=0u)
Initialize the library.
Definition: Context.h:45
Interface handle object.
Definition: Interface_decl.h:54
void log(OSVR_LogLevel severity, const char *message)
Log a message to the plugin-specific channel.
Definition: Context.h:120
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
void free(Interface &iface)
Frees an interface before it would normally be freed (at context close).
Definition: Context.h:104
size< coerce_list< Ts... >> length
Synonym for typepack::size.
Definition: Size.h:59
OSVR_CLIENTKIT_EXPORT OSVR_ReturnCode osvrClientGetStringParameter(OSVR_ClientContext ctx, const char path[], char *buf, size_t len)
Get a string parameter associated with the given path.
Definition: ParametersC.cpp:49
std::string str()
Converts the buffer into a string.
Definition: StringBufferBuilder.h:59
Interface getInterface(const std::string &path)
Get the interface associated with the given path.
Definition: Context.h:66
OSVR_CLIENTKIT_EXPORT OSVR_ReturnCode osvrClientUpdate(OSVR_ClientContext ctx)
Updates the state of the context - call regularly in your mainloop.
Definition: ContextC.cpp:80
OSVR_ClientInterface get()
Get the raw OSVR_ClientInterface from this wrapper.
Definition: Interface.h:55
OSVR_CLIENTKIT_EXPORT OSVR_ReturnCode osvrClientFreeInterface(OSVR_ClientContext ctx, OSVR_ClientInterface iface)
Free an interface object before context closure.
Definition: InterfaceC.cpp:53
OSVR_CLIENTKIT_EXPORT OSVR_ClientContext osvrClientInit(const char applicationIdentifier[], uint32_t flags OSVR_CPP_ONLY(=0))
Initialize the library.
#define OSVR_RETURN_SUCCESS
The "success" value for an OSVR_ReturnCode.
Definition: ReturnCodesC.h:45
OSVR_ClientContext get()
Gets the bare OSVR_ClientContext.
Definition: Context.h:114
OSVR_CLIENTKIT_EXPORT OSVR_ReturnCode osvrClientGetStringParameterLength(OSVR_ClientContext ctx, const char path[], size_t *len)
Get the length of a string parameter associated with the given path.
Definition: ParametersC.cpp:35
OSVR_LogLevel
Log message severity levels.
Definition: LogLevelC.h:44
A utility class to adapt APIs that first provide a length, then place a string in a user-allocated bu...
Definition: StringBufferBuilder.h:44
OSVR_CLIENTKIT_EXPORT OSVR_ReturnCode osvrClientCheckStatus(OSVR_ClientContext ctx)
Checks to see if the client context is fully started up and connected properly to a server...
Definition: ContextC.cpp:63
Definition: ClientContext.h:50
OSVR_CLIENTKIT_EXPORT OSVR_ReturnCode osvrClientShutdown(OSVR_ClientContext ctx)
Shutdown the library.
Definition: ContextC.cpp:86
void update()
Updates the state of the context - call regularly in your mainloop.
Definition: Context.h:59
Header containing the inline implementation of Interface.
Definition: ClientInterface.h:49
~ClientContext()
Destructor: Shutdown the library.
Definition: Context.h:57
char * getBufferOfSize(std::size_t n)
Allocates a buffer of size n, to include the null terminator, and returns a pointer into it...
Definition: StringBufferBuilder.h:48
OSVR_CLIENTKIT_EXPORT OSVR_ClientContext osvrClientInitHost(const char applicationIdentifier[], const char host[], uint32_t flags OSVR_CPP_ONLY(=0))
Initialize the library.
OSVR_CLIENTKIT_EXPORT OSVR_ReturnCode osvrClientGetInterface(OSVR_ClientContext ctx, const char path[], OSVR_ClientInterface *iface)
Get the interface associated with the given path.
Definition: InterfaceC.cpp:37
std::string getStringParameter(const std::string &path)
Get a string parameter value from the given path.
Definition: Context.h:79