OSVR Framework (Internal Development Docs)  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
GetVRPNConnection.cpp
Go to the documentation of this file.
1 
11 // Copyright 2014 Sensics, Inc.
12 //
13 // Licensed under the Apache License, Version 2.0 (the "License");
14 // you may not use this file except in compliance with the License.
15 // You may obtain a copy of the License at
16 //
17 // http://www.apache.org/licenses/LICENSE-2.0
18 //
19 // Unless required by applicable law or agreed to in writing, software
20 // distributed under the License is distributed on an "AS IS" BASIS,
21 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 // See the License for the specific language governing permissions and
23 // limitations under the License.
24 
25 // Internal Includes
27 #include "../Connection/VrpnConnectionKind.h" // Internal header!
28 
29 // Library/third-party includes
32 #include <vrpn_Connection.h>
33 
34 // Standard includes
35 // - none
36 
37 namespace osvr {
38 namespace vrpnserver {
39  vrpn_Connection *getVRPNConnection(OSVR_PluginRegContext ctx) {
40  return getVRPNConnection(
42  }
43 
44  vrpn_Connection *getVRPNConnection(
47  osvr::connection::Connection::retrieveConnection(
48  context.getParent());
49  vrpn_Connection *ret = nullptr;
50  if (std::string(conn->getConnectionKindID()) ==
51  osvr::connection::getVRPNConnectionKindID()) {
52  ret = static_cast<vrpn_Connection *>(conn->getUnderlyingObject());
53  }
54  return ret;
55  }
56 } // namespace vrpnserver
57 } // namespace osvr
Header.
Class providing the external interface of a registration context backing a single plugin...
shared_ptr< Connection > ConnectionPtr
How one must hold a Connection.
Definition: ConnectionPtr.h:40
vrpn_Connection * getVRPNConnection(OSVR_PluginRegContext ctx)
Retrieves the vrpn_Connection pointer from an OSVR_PluginRegContext.
virtual RegistrationContext & getParent()=0
Get parent registration context.
OSVR_EXTERN_C_BEGIN typedef void * OSVR_PluginRegContext
A context pointer passed in to your plugin's entry point and other locations of control flow transfer...
static PluginSpecificRegistrationContext & get(OSVR_PluginRegContext ctx)
Retrieve this interface from an OSVR_PluginRegContext opaque pointer.