cgv
reflection_traits_info.h
1 #pragma once
2 
3 #include <cgv/type/cond/is_base_of.h>
4 #include <cgv/type/cond/is_standard_type.h>
5 #include "reflection_traits.h"
6 #include "reflect_config.h"
7 
8 namespace cgv {
9  namespace reflect {
10 
11 template <bool is_self,typename T>
12 struct reflection_traits_info_self
13 {
14  static T* get_dummy_ptr() { return 0; }
15  static const bool use_get = true;
16 #ifdef REFLECT_TRAITS_WITH_DECLTYPE
17  typedef decltype(get_reflection_traits(*get_dummy_ptr())) traits_type;
18  static const ReflectionTraitsKind kind = traits_type::kind;
19 #else
20  static const ReflectionTraitsKind kind = RTK_EXTERNAL_SELF_REFLECT;
21 #endif
22 };
23 
24 template <typename T>
25 struct reflection_traits_info_self<true,T>
26 {
27  static const ReflectionTraitsKind kind = RTK_SELF_REFLECT;
28  static const bool use_get = false;
29  typedef reflection_traits<T, RTK_SELF_REFLECT, false> traits_type;
30 };
31 
32 template <bool is_std, typename T>
33 struct reflection_traits_info_std : public reflection_traits_info_self<cgv::type::cond::is_base_of<self_reflection_tag, T>::value, T> {};
34 
35 template <typename T>
36 struct reflection_traits_info_std<true,T>
37 {
38  static const ReflectionTraitsKind kind = RTK_STD_TYPE;
39  static const bool use_get = false;
40  typedef reflection_traits<T, RTK_STD_TYPE, true> traits_type;
41 };
42 
44 
52 template <typename T>
53 struct reflection_traits_info : public reflection_traits_info_std<cgv::type::cond::is_standard_type<T>::value, T>
54 {
55 };
56 
57  }
58 }
59 
60 #include <cgv/config/lib_end.h>
cgv::reflect::reflection_traits_info
the reflection_traits_info defines compile time information about reflection_traits for a given type ...
Definition: reflection_traits_info.h:54
cgv::reflect::ReflectionTraitsKind
ReflectionTraitsKind
different types of reflection traits
Definition: reflection_traits.h:20
cgv::math::reflect
vec< T > reflect(const vec< T > &v, const vec< T > &n)
calculates the reflected direction of v; n is the normal of the reflecting surface
Definition: vec.h:822
cgv
the cgv namespace
Definition: vr_calib.cxx:9