54 enum struct tDataType :
size_t
71 dt_computed_from_index = 12
74 tDataType type = tDataType::dt_boolean;
76 static constexpr size_t Size(
const tDataType& eType)
noexcept
80 case tDataType::dt_boolean:
81 case tDataType::dt_uint8:
82 case tDataType::dt_int8:
86 case tDataType::dt_uint16:
87 case tDataType::dt_int16:
88 case tDataType::dt_float16:
92 case tDataType::dt_uint32:
93 case tDataType::dt_int32:
94 case tDataType::dt_float32:
98 case tDataType::dt_uint64:
99 case tDataType::dt_int64:
100 case tDataType::dt_float64:
104 case tDataType::dt_computed_from_index:
114 enum struct eEndianess :
size_t
120 eEndianess endianess = eEndianess::endian_little;
127 constexpr bool operator==(
const tInMemory& oOther)
const noexcept
129 return oOther.endianess == endianess && oOther.offset == offset && oOther.stride == stride;
132 constexpr bool operator!=(
const tInMemory& oOther)
const noexcept
134 return !(oOther == *
this);
143 size_t stride_to_increment = 1;
145 size_t stride_to_reset = 0;
147 double increment = 0.0;
151 double Get(
size_t index)
const
153 return ((index % stride_to_reset) / stride_to_increment) * increment + offset;
158 return oOther.stride_to_increment == stride_to_increment && oOther.stride_to_reset == stride_to_reset &&
159 oOther.increment == increment && oOther.offset == offset;
164 return !(oOther == *
this);
170 constexpr size_t Size() const noexcept
175 constexpr bool operator==(
const tAttribute& oOther)
const noexcept
177 if (type == tDataType::dt_computed_from_index)
179 return oOther.type == type && oOther.sComputed == sComputed;
183 return oOther.type == type && oOther.sInMemory == sInMemory;
187 constexpr bool operator!=(
const tAttribute& oOther)
const noexcept
189 return !(oOther == *
this);
223 using value_type = std::tuple<std::string, T>;
225 bool add(
const std::string& name, T attribute)
232 attributes.emplace_back(name, std::move(attribute));
233 return indices.try_emplace(name, attributes.size() - 1).second;
236 const T& at(
const std::string& key)
const
238 return std::get<T>(attributes.at(indices.at(key)));
241 const T& at(
size_t index)
const
243 return std::get<T>(attributes.at(index));
248 return attributes.size();
251 bool exists(
const std::string& key)
const
253 return indices.find(key) != indices.end();
258 return attributes.empty();
267 typename std::vector<value_type>::iterator begin()
269 return attributes.begin();
272 typename std::vector<value_type>::iterator end()
274 return attributes.end();
277 typename std::vector<value_type>::const_iterator begin()
const
279 return attributes.cbegin();
282 typename std::vector<value_type>::const_iterator end()
const
284 return attributes.cend();
289 return oOther.attributes == attributes;
294 return !(*
this == oOther);
298 std::vector<value_type> attributes;
299 std::unordered_map<std::string, size_t> indices;