Ocular Engine
Types.hpp
1 
17 #pragma once
18 #ifndef __H__OCULAR_UTILITIES_TYPES__H__
19 #define __H__OCULAR_UTILITIES_TYPES__H__
20 
21 #include <cstdint>
22 #include <string>
23 
24 //------------------------------------------------------------------------------------------
25 
30 namespace Ocular
31 {
36  namespace Utils
37  {
65  template<typename T>
66  struct TypeName { static const char* name; };
67  }
71 }
94 #define OCULAR_REGISTER_TYPE(X) const char* Ocular::Utils::TypeName<X>::name = #X
95 
112 #define OCULAR_REGISTER_TYPE_CUSTOM(X,Y) const char* Ocular::Utils::TypeName<X>::name = Y
113 
126 #define OCULAR_TYPE_NAME(X) Ocular::Utils::TypeName<X>::name
127 
146 #define OCULAR_TYPE(X) OCULAR_TYPE_NAME(decltype(X))
147 
148 //----------------------------------------------------------------------------------
149 // REGISTERING TYPES
150 //----------------------------------------------------------------------------------
151 
152 OCULAR_REGISTER_TYPE(int8_t);
153 OCULAR_REGISTER_TYPE(uint8_t);
154 OCULAR_REGISTER_TYPE(int16_t);
155 OCULAR_REGISTER_TYPE(uint16_t);
156 OCULAR_REGISTER_TYPE(int32_t);
157 OCULAR_REGISTER_TYPE(uint32_t);
158 OCULAR_REGISTER_TYPE(int64_t);
159 OCULAR_REGISTER_TYPE(uint64_t);
160 OCULAR_REGISTER_TYPE(bool);
161 OCULAR_REGISTER_TYPE(float);
162 OCULAR_REGISTER_TYPE(double);
163 OCULAR_REGISTER_TYPE(long double);
164 
165 OCULAR_REGISTER_TYPE_CUSTOM(std::string, "String");
166 
167 //------------------------------------------------------------------------------------------
168 
169 #endif
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
Utility structure to convert a type T to a string representation.
Definition: Types.hpp:66