OSVR-Core
Interface_decl.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_decl_h_GUID_8A07B1E7_4F57_4CA7_6BA8_3A262F486AB5
27 #define INCLUDED_Interface_decl_h_GUID_8A07B1E7_4F57_4CA7_6BA8_3A262F486AB5
28 
29 // Internal Includes
30 #include <osvr/Util/ClientCallbackTypesC.h>
33 #include <osvr/Util/ReportTypesX.h>
34 
35 // Library/third-party includes
36 
37 // Standard includes
38 // - none
39 
40 namespace osvr {
41 
42 namespace clientkit {
43 
44  class ClientContext;
45 
54  class Interface {
55  public:
59 
61  Interface();
62 
63 #define OSVR_X(TYPE) \
64  void registerCallback(OSVR_##TYPE##Callback cb, void *userdata);
65 
68  OSVR_INVOKE_REPORT_TYPES_XMACRO()
69 #undef OSVR_X
70 
75  bool notEmpty() const;
76 
79 
82 
93  void free();
94 
97 
98  private:
99  ClientContext *m_ctx;
100  OSVR_ClientInterface m_interface;
101  util::boost_util::DeletableList m_deletables;
102  };
103 } // end namespace clientkit
104 
105 } // end namespace osvr
106 
107 #endif // INCLUDED_Interface_decl_h_GUID_8A07B1E7_4F57_4CA7_6BA8_3A262F486AB5
Header for boost::shared_ptr-based management of Deletables.
Interface handle object.
Definition: Interface_decl.h:54
Client context object: Create and keep one in your application.
Definition: Context_decl.h:57
void free()
Manually free the interface before the context is closed.
Definition: Interface.h:59
::boost::shared_ptr< Deletable > DeletablePtr
Shared-ownership smart pointer to a Deletable, using Boost&#39;s shared pointers.
Definition: BoostDeletable.h:42
Header declaring opaque types used by Client and ClientKit.
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
Interface()
Empty constructor.
Definition: Interface.h:49
::std::vector< DeletablePtr > DeletableList
Vector of shared-ownership smart pointers.
Definition: BoostDeletable.h:44
bool notEmpty() const
Determine if this interface object is empty (that is, was it once initialized).
Definition: Interface.h:51
Definition: ClientInterface.h:49
ClientContext & getContext()
Get the associated ClientContext.
Definition: Interface.h:57
void takeOwnership(util::boost_util::DeletablePtr const &obj)
Take (shared) ownership of some Deletable object.
Definition: Interface.h:67