type_map + type_register
This commit is contained in:
parent
dd31760344
commit
a8e24efff2
4 changed files with 69 additions and 1 deletions
|
@ -152,6 +152,8 @@ namespace MultiArrayTools
|
|||
#define include_type(t,n) template <> struct TypeMap<n> { typedef t type; static constexpr size_t size = sizeof(t); }; \
|
||||
template <> struct NumTypeMap<t> { static constexpr size_t num = n; };
|
||||
|
||||
#include "ranges/type_register.h"
|
||||
/*
|
||||
include_type(size_t,1)
|
||||
include_type(int,2)
|
||||
include_type(char,3)
|
||||
|
@ -176,7 +178,7 @@ namespace MultiArrayTools
|
|||
include_type(std::array<int XCOMMAX() 7>,702)
|
||||
include_type(std::array<int XCOMMAX() 8>,802)
|
||||
include_type(std::array<int XCOMMAX() 9>,902)
|
||||
|
||||
*/
|
||||
#undef include_type
|
||||
|
||||
inline size_t sizeFromTypeNum(size_t tn)
|
||||
|
|
25
src/include/ranges/type_register.h
Normal file
25
src/include/ranges/type_register.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
|
||||
include_type(size_t,1)
|
||||
include_type(int,2)
|
||||
include_type(char,3)
|
||||
include_type(float,4)
|
||||
include_type(double,5)
|
||||
include_type(std::string,6)
|
||||
include_type(vector<size_t>,101)
|
||||
include_type(vector<int>,102)
|
||||
include_type(vector<double>,105)
|
||||
include_type(vector<std::string>,106)
|
||||
include_type(std::array<size_t XCOMMAX() 2>,201)
|
||||
include_type(std::array<int XCOMMAX() 2>,202)
|
||||
include_type(std::array<double XCOMMAX() 2>,205)
|
||||
include_type(std::array<size_t XCOMMAX() 3>,301)
|
||||
include_type(std::array<int XCOMMAX() 3>,302)
|
||||
include_type(std::array<double XCOMMAX() 3>,305)
|
||||
include_type(std::array<size_t XCOMMAX() 4>,401)
|
||||
include_type(std::array<int XCOMMAX() 4>,402)
|
||||
include_type(std::array<double XCOMMAX() 4>,405)
|
||||
include_type(std::array<int XCOMMAX() 5>,502)
|
||||
include_type(std::array<int XCOMMAX() 6>,602)
|
||||
include_type(std::array<int XCOMMAX() 7>,702)
|
||||
include_type(std::array<int XCOMMAX() 8>,802)
|
||||
include_type(std::array<int XCOMMAX() 9>,902)
|
|
@ -4,6 +4,7 @@ set(libmultiarray_a_SOURCES
|
|||
${CMAKE_SOURCE_DIR}/src/lib/ranges/anonymous_range.cc
|
||||
${CMAKE_SOURCE_DIR}/src/lib/ranges/dynamic_meta.cc
|
||||
${CMAKE_SOURCE_DIR}/src/lib/ranges/dynamic_range.cc
|
||||
${CMAKE_SOURCE_DIR}/src/lib/ranges/type_map.cc
|
||||
${CMAKE_SOURCE_DIR}/src/lib/ranges/multi_range_factory_product_map.cc
|
||||
${CMAKE_SOURCE_DIR}/src/lib/map_range_factory_product_map.cc
|
||||
)
|
||||
|
|
40
src/lib/ranges/type_map.cc
Normal file
40
src/lib/ranges/type_map.cc
Normal file
|
@ -0,0 +1,40 @@
|
|||
|
||||
#include "ranges/type_map.h"
|
||||
|
||||
namespace MultiArrayTools
|
||||
{
|
||||
#define XCOMMAX() ,
|
||||
#define include_type(t,n) template struct TypeMap<n>; \
|
||||
template struct NumTypeMap<t>;
|
||||
|
||||
#include "ranges/type_register.h"
|
||||
/*
|
||||
include_type(size_t,1)
|
||||
include_type(int,2)
|
||||
include_type(char,3)
|
||||
include_type(float,4)
|
||||
include_type(double,5)
|
||||
include_type(std::string,6)
|
||||
include_type(vector<size_t>,101)
|
||||
include_type(vector<int>,102)
|
||||
include_type(vector<double>,105)
|
||||
include_type(vector<std::string>,106)
|
||||
include_type(std::array<size_t XCOMMAX() 2>,201)
|
||||
include_type(std::array<int XCOMMAX() 2>,202)
|
||||
include_type(std::array<double XCOMMAX() 2>,205)
|
||||
include_type(std::array<size_t XCOMMAX() 3>,301)
|
||||
include_type(std::array<int XCOMMAX() 3>,302)
|
||||
include_type(std::array<double XCOMMAX() 3>,305)
|
||||
include_type(std::array<size_t XCOMMAX() 4>,401)
|
||||
include_type(std::array<int XCOMMAX() 4>,402)
|
||||
include_type(std::array<double XCOMMAX() 4>,405)
|
||||
include_type(std::array<int XCOMMAX() 5>,502)
|
||||
include_type(std::array<int XCOMMAX() 6>,602)
|
||||
include_type(std::array<int XCOMMAX() 7>,702)
|
||||
include_type(std::array<int XCOMMAX() 8>,802)
|
||||
include_type(std::array<int XCOMMAX() 9>,902)
|
||||
*/
|
||||
#undef include_type
|
||||
#undef XCOMMAX
|
||||
|
||||
}
|
Loading…
Reference in a new issue