OSVR-Core
DevicesWithParameters.h
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 #ifndef INCLUDED_DevicesWithParameters_h_GUID_45F0E8B4_E094_4AAF_7D19_0EF3AFB7A11C
26 #define INCLUDED_DevicesWithParameters_h_GUID_45F0E8B4_E094_4AAF_7D19_0EF3AFB7A11C
27 
28 // Internal Includes
29 #include "VRPNMultiserver.h"
30 
31 // Library/third-party includes
33 
34 // Standard includes
35 #include <iostream>
36 
37 typedef void (*DriverConstructor)(VRPNMultiserverData &data,
39  const char *params);
40 
41 template <DriverConstructor F>
42 OSVR_ReturnCode wrappedConstructor(OSVR_PluginRegContext ctx,
43  const char *params, void *userData) {
44  VRPNMultiserverData *data = static_cast<VRPNMultiserverData *>(userData);
45  try {
46  F(*data, ctx, params);
47  return OSVR_RETURN_SUCCESS;
48  } catch (std::exception &e) {
49  std::cerr << "\nERROR: " << e.what() << "\n" << std::endl;
50  return OSVR_RETURN_FAILURE;
51  } catch (...) {
52  return OSVR_RETURN_FAILURE;
53  }
54 }
55 
56 void createYEI(VRPNMultiserverData &data, OSVR_PluginRegContext ctx,
57  const char *params);
58 
59 #endif // INCLUDED_DevicesWithParameters_h_GUID_45F0E8B4_E094_4AAF_7D19_0EF3AFB7A11C
Definition: VRPNMultiserver.h:38
Header declaring plugin callback types.
#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
OSVR_EXTERN_C_BEGIN typedef void * OSVR_PluginRegContext
A context pointer passed in to your plugin&#39;s entry point and other locations of control flow transfer...
Definition: PluginRegContextC.h:47