OSVR Framework (Internal Development Docs)
0.6-1962-g59773924
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
Interface.h
Go to the documentation of this file.
1
12
// Copyright 2014 Sensics, Inc.
13
//
14
// Licensed under the Apache License, Version 2.0 (the "License");
15
// you may not use this file except in compliance with the License.
16
// You may obtain a copy of the License at
17
//
18
// http://www.apache.org/licenses/LICENSE-2.0
19
//
20
// Unless required by applicable law or agreed to in writing, software
21
// distributed under the License is distributed on an "AS IS" BASIS,
22
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
// See the License for the specific language governing permissions and
24
// limitations under the License.
25
26
#ifndef INCLUDED_Interface_h_GUID_5D5B1FAD_AD72_4216_9FB6_6483D6EE7DF1
27
#define INCLUDED_Interface_h_GUID_5D5B1FAD_AD72_4216_9FB6_6483D6EE7DF1
28
29
// Internal Includes
30
#include <
osvr/ClientKit/Interface_decl.h
>
31
#include <
osvr/ClientKit/Context_decl.h
>
32
#include <
osvr/ClientKit/InterfaceC.h
>
33
#include <
osvr/ClientKit/InterfaceCallbackC.h
>
34
#include <
osvr/Util/ReportTypesX.h
>
35
36
// Library/third-party includes
37
#include <boost/function.hpp>
38
39
// Standard includes
40
// - none
41
42
namespace
osvr
{
43
44
namespace
clientkit {
45
46
inline
Interface::Interface
(
ClientContext
&ctx,
OSVR_ClientInterface
iface)
47
: m_ctx(&ctx), m_interface(iface) {}
48
49
inline
Interface::Interface
() : m_ctx(NULL), m_interface(NULL) {}
50
51
inline
bool
Interface::notEmpty
()
const
{
52
return
m_ctx != NULL && m_interface != NULL;
53
}
54
55
inline
OSVR_ClientInterface
Interface::get
() {
return
m_interface; }
56
57
inline
ClientContext
&
Interface::getContext
() {
return
*m_ctx; }
58
59
inline
void
Interface::free
() {
60
m_deletables.clear();
61
m_ctx->
free
(*
this
);
62
m_ctx = NULL;
63
m_interface = NULL;
64
}
65
66
inline
void
67
Interface::takeOwnership
(util::boost_util::DeletablePtr
const
&obj) {
68
m_deletables.push_back(obj);
69
}
70
71
#define OSVR_X(TYPE) \
72
inline void Interface::registerCallback(OSVR_##TYPE##Callback cb, \
73
void *userdata) { \
74
osvrRegister##TYPE##Callback(m_interface, cb, userdata); \
75
}
76
OSVR_INVOKE_REPORT_TYPES_XMACRO()
77
#undef OSVR_X
78
79
}
// end namespace clientkit
80
81
}
// end namespace osvr
82
83
#endif // INCLUDED_Interface_h_GUID_5D5B1FAD_AD72_4216_9FB6_6483D6EE7DF1
osvr::clientkit::Interface::notEmpty
bool notEmpty() const
Determine if this interface object is empty (that is, was it once initialized). Does not determine if...
Definition:
Interface.h:51
osvr::clientkit::ClientContext
Client context object: Create and keep one in your application. Handles lifetime management and provi...
Definition:
Context_decl.h:57
osvr::clientkit::Interface::free
void free()
Manually free the interface before the context is closed.
Definition:
Interface.h:59
osvr
<
Definition:
ClientInterfaceObjectManager.h:43
osvr::clientkit::Interface::Interface
Interface()
Empty constructor.
Definition:
Interface.h:49
InterfaceCallbackC.h
Header.
osvr::clientkit::ClientContext::free
void free(Interface &iface)
Frees an interface before it would normally be freed (at context close).
Definition:
Context.h:99
Interface_decl.h
Header containing the class declaration for Interface, but not its inline implementation.
osvr::clientkit::Interface::get
OSVR_ClientInterface get()
Get the raw OSVR_ClientInterface from this wrapper.
Definition:
Interface.h:55
ReportTypesX.h
Generated header for "X-Macro" usage of the preprocessor macro OSVR_INVOKE_REPORT_TYPES_XMACRO.
InterfaceC.h
Header.
OSVR_ClientInterfaceObject
Definition:
ClientInterface.h:49
osvr::clientkit::Interface::getContext
ClientContext & getContext()
Get the associated ClientContext.
Definition:
Interface.h:57
osvr::clientkit::Interface::takeOwnership
void takeOwnership(util::boost_util::DeletablePtr const &obj)
Take (shared) ownership of some Deletable object.
Definition:
Interface.h:67
Context_decl.h
Header.
osvr
ClientKit
Interface.h
Generated on Tue May 16 2017 15:22:20 for OSVR Framework (Internal Development Docs) by
Doxygen
1.8.8