ethzasl-msf - Modular Sensor Fusion
Time delay compensated single and multi sensor fusion framework based on an EKF
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
msf_typetraits.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2013 Simon Lynen, ASL, ETH Zurich, Switzerland
3  * You can contact the author at <slynen at ethz dot ch>
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 #ifndef MDF_TYPETRAITS_H_
18 #define MDF_TYPETRAITS_H_
19 
20 namespace msf_tmp {
21 
22 // Two types of same type.
23 template<typename T, typename U> struct SameType {
24  enum {
25  value = false
26  };
27 };
28 template<typename T> struct SameType<T, T> {
29  enum {
30  value = true
31  };
32 };
33 
34 // Strip qualifiers.
35 template<typename T>
37  typedef T result_t;
38 };
39 template<typename T>
40 struct StripReference<T&> {
41  typedef T result_t;
42 };
43 template<typename T>
44 struct StripReference<const T> {
45  typedef const T result_t;
46 };
47 template<typename T>
48 struct StripReference<const T&> {
49  typedef const T result_t;
50 };
51 
52 template<typename T>
54  typedef T result_t;
55 };
56 template<typename T>
57 struct StripConstReference<T&> {
58  typedef T result_t;
59 };
60 template<typename T>
61 struct StripConstReference<const T&> {
62  typedef T result_t;
63 };
64 template<typename T>
65 struct StripConstReference<const T> {
66  typedef T result_t;
67 };
68 
69 template<typename T>
70 struct StripConstPtr {
71  typedef T result_t;
72 };
73 template<typename T>
74 struct StripConstPtr<T*> {
75  typedef T result_t;
76 };
77 template<typename T>
78 struct StripConstPtr<const T*> {
79  typedef T result_t;
80 };
81 template<typename T>
82 struct StripConstPtr<const T> {
83  typedef T result_t;
84 };
85 
86 // Add qualifiers.
87 template<typename T>
88 struct AddReference {
89  typedef T& result_t;
90 };
91 template<typename T>
92 struct AddReference<T&> {
93  typedef T& result_t;
94 };
95 template<typename T>
96 struct AddReference<const T> {
97  typedef const T& result_t;
98 };
99 template<typename T>
100 struct AddReference<const T&> {
101  typedef const T& result_t;
102 };
103 
104 template<typename T>
106  typedef const T& result_t;
107 };
108 template<typename T>
109 struct AddConstReference<T&> {
110  typedef const T& result_t;
111 };
112 template<typename T>
113 struct AddConstReference<const T> {
114  typedef const T& result_t;
115 };
116 template<typename T>
117 struct AddConstReference<const T&> {
118  typedef const T& result_t;
119 };
120 
121 template<typename T>
122 struct AddPtr {
123  typedef T* result_t;
124 };
125 template<typename T>
126 struct AddPtr<T*> {
127  typedef T* result_t;
128 };
129 template<typename T>
130 struct AddPtr<const T> {
131  typedef const T* result_t;
132 };
133 template<typename T>
134 struct AddPtr<const T*> {
135  typedef const T* result_t;
136 };
137 
138 template<typename T>
139 struct AddConstPtr {
140  typedef const T* result_t;
141 };
142 template<typename T>
143 struct AddConstPtr<T*> {
144  typedef const T* result_t;
145 };
146 template<typename T>
147 struct AddConstPtr<const T> {
148  typedef const T* result_t;
149 };
150 template<typename T>
151 struct AddConstPtr<const T*> {
152  typedef const T* result_t;
153 };
154 
155 template<typename T>
157  enum {
158  value = false
159  };
160 };
161 template<typename T>
162 struct IsReferenceType<T&> {
163  enum {
164  value = true
165  };
166 };
167 template<typename T>
168 struct IsReferenceType<const T&> {
169  enum {
170  value = true
171  };
172 };
173 
174 template<typename T>
176  enum {
177  value = false
178  };
179 };
180 template<typename T>
181 struct IsPointerType<T*> {
182  enum {
183  value = true
184  };
185 };
186 template<typename T>
187 struct IsPointerType<const T*> {
188  enum {
189  value = true
190  };
191 };
192 
193 }
194 
195 #endif // MDF_TYPETRAITS_TPP_