libSplash
generateCollectionType.cpp
1 
23 #ifndef GENERATE_COLLECTION_TYPE_H
24 #define GENERATE_COLLECTION_TYPE_H
25 
26 
27 #include "splash/basetypes/generateCollectionType.hpp"
28 #include "splash/basetypes/basetypes.hpp"
29 #include <typeinfo>
30 #include <cassert>
31 
32 namespace splash
33 {
34 
45 #define TRY_COLTYPE(_name) \
46 { \
47  CollectionType* t = ColType##_name::genType(datatype_id); \
48  assert(t == NULL || typeid(*t) == typeid(ColType##_name)); \
49  if(t != NULL) return t; \
50 } \
51 
52 
66 {
67  // basetypes atomic
68  TRY_COLTYPE(Int8)
69  TRY_COLTYPE(Int16)
70  TRY_COLTYPE(Int32)
71  TRY_COLTYPE(Int64)
72 
73  TRY_COLTYPE(UInt8)
74  TRY_COLTYPE(UInt16)
75  TRY_COLTYPE(UInt32)
76  TRY_COLTYPE(UInt64)
77 
78  TRY_COLTYPE(Float)
79  TRY_COLTYPE(Double)
80  TRY_COLTYPE(Char)
81  TRY_COLTYPE(Int)
82 
83 
84  // ColType Bool -> must be before the other enum types!
85  TRY_COLTYPE(Bool)
86 
87 
88  // ColType String
89  TRY_COLTYPE(String)
90 
91 
92  // ColTypeArray()
93  TRY_COLTYPE(Float2Array)
94  TRY_COLTYPE(Float3Array)
95  TRY_COLTYPE(Float4Array)
96 
97  TRY_COLTYPE(Double2Array)
98  TRY_COLTYPE(Double3Array)
99  TRY_COLTYPE(Double4Array)
100 
101  TRY_COLTYPE(Int4Array)
102  TRY_COLTYPE(Int3Array)
103  TRY_COLTYPE(Int2Array)
104 
105 
106  // ColTypeDimArray
107  TRY_COLTYPE(DimArray)
108 
109 
110  // ColType Dim
111  TRY_COLTYPE(Dim)
112 
113 
114  // Coltype Compound
115  TRY_COLTYPE(Float2)
116  TRY_COLTYPE(Float3)
117  TRY_COLTYPE(Float4)
118 
119  TRY_COLTYPE(Double2)
120  TRY_COLTYPE(Double3)
121  TRY_COLTYPE(Double4)
122 
123  TRY_COLTYPE(Int2)
124  TRY_COLTYPE(Int3)
125  TRY_COLTYPE(Int4)
126 
127  return new ColTypeUnknown;
128 }
129 
130 #undef TRY_COLTYPE
131 
132 } /* namespace splash */
133 
134 
135 #endif /* GENERATE_COLLECTION_TYPE_H */
CollectionType * generateCollectionType(hid_t datatype_id)