OSVR-Core
ReportTraits.h
Go to the documentation of this file.
1 
16 // Copyright 2014 Sensics, Inc.
17 //
18 // Licensed under the Apache License, Version 2.0 (the "License");
19 // you may not use this file except in compliance with the License.
20 // You may obtain a copy of the License at
21 //
22 // http://www.apache.org/licenses/LICENSE-2.0
23 //
24 // Unless required by applicable law or agreed to in writing, software
25 // distributed under the License is distributed on an "AS IS" BASIS,
26 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27 // See the License for the specific language governing permissions and
28 // limitations under the License.
29 
30 #ifndef INCLUDED_ReportTraits_h_GUID_CEDB196C_04E8_4085_EDCF_C5A1BD81A827
31 #define INCLUDED_ReportTraits_h_GUID_CEDB196C_04E8_4085_EDCF_C5A1BD81A827
32 
33 // Internal Includes
34 #include <osvr/Util/ClientCallbackTypesC.h>
35 #include <osvr/TypePack/T.h>
36 #include <osvr/Util/ReportTypesX.h>
37 
38 // Library/third-party includes
39 // - none
40 
41 // Standard includes
42 // - none
43 
44 namespace osvr {
45 namespace common {
46  namespace traits {
50  template <typename T> struct CallbackType {};
51 
55  template <typename T> struct ReportFromCallback {};
56 
60  template <typename T> struct StateType {};
61 
62 #define OSVR_X(TYPE) \
63  template <> struct CallbackType<OSVR_##TYPE##Report> { \
64  typedef OSVR_##TYPE##Callback type; \
65  }; \
66  template <> struct ReportFromCallback<OSVR_##TYPE##Callback> { \
67  typedef OSVR_##TYPE##Report type; \
68  }; \
69  template <> struct StateType<OSVR_##TYPE##Report> { \
70  typedef OSVR_##TYPE##State type; \
71  };
72  OSVR_INVOKE_REPORT_TYPES_XMACRO()
73 #undef OSVR_X
74 
77  template <typename T>
79 
82  template <typename T>
84 
87  template <typename T>
89  } // namespace traits
90 
91 } // namespace common
92 } // namespace osvr
93 
94 #endif // INCLUDED_ReportTraits_h_GUID_CEDB196C_04E8_4085_EDCF_C5A1BD81A827
typepack::t_< StateType< T >> StateFromReport_t
Alias for the StateType associated with a given ReportType.
Definition: ReportTraits.h:83
Handles spatial transformations.
Definition: SerializationTraitExample_Complicated.h:40
Metafunction/trait taking a CallbackType and returning the associated ReportType. ...
Definition: ReportTraits.h:55
typepack::t_< ReportFromCallback< T >> ReportFromCallback_t
Alias for the ReportType associated with a given CallbackType.
Definition: ReportTraits.h:88
Metafunction/trait taking a ReportType and returning the associated CallbackType. ...
Definition: ReportTraits.h:50
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
Header.
Metafunction/trait taking a ReportType and returning the associated StateType.
Definition: ReportTraits.h:60
typename T::type t_
A convenience alias template to extract the nested type within the supplied T.
Definition: T.h:52
typepack::t_< CallbackType< T >> CallbackFromReport_t
Alias for the CallbackType associated with a given ReportType.
Definition: ReportTraits.h:78