OSVR Framework (Internal Development Docs)  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
InterfaceC.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
29 #include <osvr/Common/Tracing.h>
30 
31 // Library/third-party includes
32 // - none
33 
34 // Standard includes
35 // - none
36 
38  const char path[],
39  OSVR_ClientInterface *iface) {
40  if (nullptr == ctx) {
42  return OSVR_RETURN_FAILURE;
43  }
44  osvr::common::tracing::markGetInterface(path);
46  if (ret) {
47  *iface = ret.get();
48  return OSVR_RETURN_SUCCESS;
49  }
50  return OSVR_RETURN_FAILURE;
51 }
52 
54  OSVR_ClientInterface iface) {
55  if (nullptr == ctx) {
57  return OSVR_RETURN_FAILURE;
58  }
59  if (nullptr == iface) {
61  return OSVR_RETURN_FAILURE;
62  }
63 
67  if (!ptr) {
70  return OSVR_RETURN_FAILURE;
71  }
72  return OSVR_RETURN_SUCCESS;
73 }
OSVR_ReturnCode osvrClientGetInterface(OSVR_ClientContext ctx, const char path[], OSVR_ClientInterface *iface)
Get the interface associated with the given path.
Definition: InterfaceC.cpp:37
OSVR_ReturnCode osvrClientFreeInterface(OSVR_ClientContext ctx, OSVR_ClientInterface iface)
Free an interface object before context closure.
Definition: InterfaceC.cpp:53
shared_ptr< ClientInterface > ClientInterfacePtr
Pointer for holding ClientInterface objects safely.
osvr::common::ClientInterfacePtr getInterface(const char path[])
Creates an interface object for the given path. The context retains shared ownership.
osvr::common::ClientInterfacePtr releaseInterface(osvr::common::ClientInterface *iface)
Searches through this context to determine if the passed interface object has been retained...
#define OSVR_RETURN_FAILURE
The "failure" value for an OSVR_ReturnCode.
Definition: ReturnCodesC.h:47
#define OSVR_RETURN_SUCCESS
The "success" value for an OSVR_ReturnCode.
Definition: ReturnCodesC.h:45
Header.
Header.