]> git.tdb.fi Git - r2c2.git/blobdiff - source/3d/typemap.h
Use some template magic to deduce the proper 3D type
[r2c2.git] / source / 3d / typemap.h
diff --git a/source/3d/typemap.h b/source/3d/typemap.h
new file mode 100644 (file)
index 0000000..84a3eeb
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef R2C2_3D_TYPEMAP_H_
+#define R2C2_3D_TYPEMAP_H_
+
+#include <msp/core/meta.h>
+#include "signal.h"
+#include "track.h"
+#include "vehicle.h"
+
+namespace R2C2 {
+
+template<typename T>
+struct TypeMap3D;
+
+template<typename T>
+struct TypeMap3D<const T>: TypeMap3D<T>
+{ };
+
+template<> struct TypeMap3D<Signal> { typedef Signal3D Type3D; };
+template<> struct TypeMap3D<Track> { typedef Track3D Type3D; };
+template<> struct TypeMap3D<Vehicle> { typedef Vehicle3D Type3D; };
+
+} // namespace R2C2
+
+#endif