API Documentation
Loading...
Searching...
No Matches
TableColumnType.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Database
28File: TableColumnType
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#if __clang__
34 #pragma clang diagnostic push
35 #pragma clang diagnostic ignored "-Woverloaded-virtual"
36#endif
37#include "DLLInfo.h"
38#include <NDEVR/TableColumn.h>
39#include <NDEVR/RGBColor.h>
40#include <NDEVR/Matrix.h>
41#include <NDEVR/TypeInfo.h>
42#include <NDEVR/BinaryFile.h>
43#include <NDEVR/String.h>
44#include <NDEVR/Compressor.h>
45namespace NDEVR
46{
47 /**--------------------------------------------------------------------------------------------------
48 \brief A base class for a Table column with N-number of rows held in a Buffer object.
49 Allows for virtual memory access with the caller not needing to know how the data itself is stored.
50 **/
51 template<class t_type>
53 {
54 public:
55
58 , m_buffer(1U, Constant<t_type>::Invalid)
59 {
60 }
61 TableColumnBuffer(const String& label, const TypeInfo type, const t_type& default_value)
63 , m_buffer(1U, default_value)
64 {
65 }
68 , m_buffer(1U, Constant<t_type>::Invalid)
69 {
70 m_buffer.addAll(buffer);
71 }
72 virtual void mapFromFile(BinaryFile& file, uint08 version_number) override
73 {
74 if (version_number <= 1539350691)//versions <= 1539350691 had error in default value, so ignore
75 {
76 t_type default_value = defaultValue();
77 file.seek(file.position() + sizeof(t_type));
78 file.readNow(m_buffer);
79 m_buffer.add(0, default_value);
80 }
81 else if (version_number <= 1613942093)
82 {
83 Buffer<t_type> default_value_buffer;
84 file.readNow(default_value_buffer);
85 lib_assert(default_value_buffer.size() == 1, "Bad buffer read");
86 file.readNow(m_buffer);
87 m_buffer.add(0, default_value_buffer[0]);
88 }
89 else
90 {
91 file.read(m_buffer);
92 }
93 }
94 void setSize(uint04 size) override
95 {
96 size += 1;//add 1 for default value
97 uint04 old_size = m_buffer.size();
98 m_buffer.setSize(size);
99 if (old_size < size)
100 m_buffer.setAllToValue(defaultValue(), old_size, size - old_size);
101 }
102 private:
103 void insert(uint04 index) override
104 {
105 index += 1;
106 m_buffer.template addSpace<true>(index, 1U);
107 m_buffer[index] = defaultValue();
108 }
109
110 virtual void copyRow(uint04 source, uint04 destination) override
111 {
112 m_buffer[destination + 1] = m_buffer[source + 1];
113 }
114 virtual void copyRows(uint04 source, uint04 destination, uint04 size) override
115 {
116 destination += 1;
117 source += 1;
118 if (destination < source)//prevent overlap
119 {
120 for (uint04 i = 0; i < size; i++)
121 m_buffer[destination + i] = m_buffer[source + i];
122 }
123 else
124 {
125 for (uint04 i = size - 1; !IsInvalid(i); i--)
126 m_buffer[destination + i] = m_buffer[source + i];
127 }
128 }
129 void removeRow(uint04 index) override
130 {
131 m_buffer.removeIndex(index + 1);
132 }
133 virtual void removeRows(uint04 index, uint04 size) override
134 {
135 index += 1;
136 m_buffer.removeAllIndex(index, index + size);
137 }
138 virtual void removeRows(const Buffer<uint04>& sorted_romove_indices) override
139 {
140 if (sorted_romove_indices.size() == 0)
141 return;
142 uint04 current_position = 1;
143 uint04 current_remove_index = 0;
144 for (uint04 i = 1; i < m_buffer.size(); i++)
145 {
146 if (current_remove_index >= sorted_romove_indices.size() || (i - 1) != sorted_romove_indices[current_remove_index])
147 {
148 m_buffer[current_position++] = m_buffer[i];
149 }
150 else
151 {
152 current_remove_index++;
153 }
154 }
155 lib_assert(current_remove_index == sorted_romove_indices.size() + 1, "Unexpected end remove value");
156 m_buffer.setSize(current_position);
157 }
158
159 void removeRows(uint04 offset, const Buffer<bool>& indices) override
160 {
161 offset += 1;
162 uint04 current_position = offset;
163 for (uint04 i = 0; i < indices.size(); i++)
164 {
165 if (!indices[i])
166 {
167 m_buffer[current_position] = m_buffer[offset + i];
168 current_position++;
169 }
170 }
171 uint04 removed_size = current_position;
172 for (uint04 i = offset + indices.size(); i < m_buffer.size(); i++)
173 {
174 m_buffer[current_position] = m_buffer[i];
175 current_position++;
176 }
177 m_buffer.setSize(m_buffer.size() - (indices.size() - (removed_size - offset)));
178 }
179 virtual void compress(BinaryCompressionObject& object) override
180 {
182 object.compression_mode = m_compression_mode;
184 m_compression_object = object;
185 m_compression_valid = true;
186 }
187 virtual void mapToFile(BinaryFile& file, int compression) override
188 {
189 _mapToFile(file, cast<CompressionMode>(compression));
190 }
191 virtual void mapToFile(BinaryFile& file, BinaryCompressionObject& object) override
192 {
193 _mapToFile(file, object);
194 }
195
196 void* begin() override { lib_assert(!ObjectInfo<t_type>::Boolean, "Begin not supported for boolean"); return m_buffer.ptr() + 1; }
197 void* end() override { return ((uint01*)m_buffer.ptr()) + m_buffer.memSize(); }
198
199 const void* begin() const override { lib_assert(!ObjectInfo<t_type>::Boolean, "Begin not supported for boolean"); return m_buffer.ptr() + 1; }
200 const void* end() const override { return ((uint01*)m_buffer.ptr()) + m_buffer.memSize(); }
201
202 virtual void addRow() override
203 {
204 t_type value = defaultValue();
205 m_buffer.add(value);
206 }
207
208 virtual void insertRows(uint04 location, uint04 size) override
209 {
210 m_buffer.template addSpace<true>(location + 1U, size);
211 m_buffer.setAllToValue(defaultValue(), location + 1, size);
212 }
213 [[nodiscard]] bool isSame(uint04 index, const String& value) const override { return value == String(pullValue(index)); }
214 [[nodiscard]] bool isSame(uint04 index, const char* value) const override { return value == String(pullValue(index)); }
215 [[nodiscard]] bool contains(uint04 index, const String& value, bool ignore_case) const override { return String(pullValue(index)).hasSubString(value, ignore_case); }
216 [[nodiscard]] bool contains(uint04 index, const char* value, bool ignore_case) const override { return String(pullValue(index)).hasSubString(value, ignore_case); }
217 [[nodiscard]] bool beginsWith(uint04 index, const String& value, bool ignore_case) const override { return String(pullValue(index)).beginsWith(value, ignore_case); }
218 [[nodiscard]] bool beginsWith(uint04 index, const char* value, bool ignore_case) const override { return String(pullValue(index)).beginsWith(value, ignore_case); }
219 uint04 size() const override { return m_buffer.size() - 1; }
220 private:
221 void _mapToFile(BinaryFile& file, CompressionMode compression)
222 {
223 file.write(m_buffer, compression);
224 }
225 void _mapToFile(BinaryFile& file, BinaryCompressionObject& object)
226 {
227 file.writeCompression(object);
228 }
229 protected:
230 decltype(auto) pullValue(uint04 index)
231 {
232 return IsInvalid(index) ? defaultValue() : m_buffer[index + 1];
233 }
234 decltype(auto) pullValue(uint04 index) const
235 {
236 return IsInvalid(index) ? defaultValue() : m_buffer[index + 1];
237 }
238 decltype(auto) defaultValue()
239 {
240 return m_buffer[0];
241 }
242 decltype(auto) defaultValue() const
243 {
244 return m_buffer[0];
245 }
248 };
249
250 /**--------------------------------------------------------------------------------------------------
251 \brief A TableColumnBuffer that also has some number of defined rows stored in a Vector object
252 Allows for virtual memory access with the caller not needing to know how the data itself is stored.
253 **/
254 template<uint01 t_dims, class t_type>
255 class TableVectorType : public TableColumnBuffer<Vector<t_dims, t_type>>
256 {
257 public:
259 : TableColumnBuffer<Vector<t_dims, t_type>>(label, GetTypeInfo<Vector<t_dims, t_type>>())
260 {}
261
263 : TableColumnBuffer<Vector<t_dims, t_type>>(buffer, label, GetTypeInfo<Vector<t_dims, t_type>>())
264 {}
265 private:
266 virtual uint04 getRowSize(uint04) const override { return t_dims; };
267
268 void set(uint04 index, uint04 vector_pos, bool value) override { TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[cast<uint01>(vector_pos)] = cast<t_type>(value); };
269 void set(uint04 index, uint04 vector_pos, uint01 value) override { TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[cast<uint01>(vector_pos)] = cast<t_type>(value); };
270 void set(uint04 index, uint04 vector_pos, uint02 value) override { TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[cast<uint01>(vector_pos)] = cast<t_type>(value); };
271 void set(uint04 index, uint04 vector_pos, uint04 value) override { TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[cast<uint01>(vector_pos)] = cast<t_type>(value); };
272 void set(uint04 index, uint04 vector_pos, uint08 value) override { TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[cast<uint01>(vector_pos)] = cast<t_type>(value); };
273 void set(uint04 index, uint04 vector_pos, sint01 value) override { TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[cast<uint01>(vector_pos)] = cast<t_type>(value); };
274 void set(uint04 index, uint04 vector_pos, sint02 value) override { TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[cast<uint01>(vector_pos)] = cast<t_type>(value); };
275 void set(uint04 index, uint04 vector_pos, sint04 value) override { TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[cast<uint01>(vector_pos)] = cast<t_type>(value); };
276 void set(uint04 index, uint04 vector_pos, sint08 value) override { TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[cast<uint01>(vector_pos)] = cast<t_type>(value); };
277 void set(uint04 index, uint04 vector_pos, fltp04 value) override { TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[cast<uint01>(vector_pos)] = cast<t_type>(value); };
278 void set(uint04 index, uint04 vector_pos, fltp08 value) override { TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[cast<uint01>(vector_pos)] = cast<t_type>(value); };
279
280 void set(uint04 index, uint04 vector_pos, const String& value) override { TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[cast<uint01>(vector_pos)] = value.getAs<t_type>(); };
281
282 void set(uint04 index, bool value) override { TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index) = cast<t_type>(value); };
283 void set(uint04 index, uint01 value) override { TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index) = cast<t_type>(value); };
284 void set(uint04 index, uint02 value) override { TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index) = cast<t_type>(value); };
285 void set(uint04 index, uint04 value) override { TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index) = cast<t_type>(value); };
286 void set(uint04 index, uint08 value) override { TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index) = cast<t_type>(value); };
287 void set(uint04 index, sint01 value) override { TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index) = cast<t_type>(value); };
288 void set(uint04 index, sint02 value) override { TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index) = cast<t_type>(value); };
289 void set(uint04 index, sint04 value) override { TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index) = cast<t_type>(value); };
290 void set(uint04 index, sint08 value) override { TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index) = cast<t_type>(value); };
291 void set(uint04 index, fltp04 value) override { TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index) = cast<t_type>(value); };
292 void set(uint04 index, fltp08 value) override { TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index) = cast<t_type>(value); };
293 void set(uint04 index, const String& value) override { TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index) = value.getAs<Vector<t_dims, t_type>>(); };
294 void set(uint04 index, RGBColor value) override { TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index) = value.as<t_dims, t_type>(); };
295
296 void get(uint04 index, uint04 vector_pos, bool& value) const override { value = cast<bool>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[cast<uint01>(vector_pos)]); };
297 void get(uint04 index, uint04 vector_pos, uint01& value) const override { value = cast<uint01>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[cast<uint01>(vector_pos)]); };
298 void get(uint04 index, uint04 vector_pos, uint02& value) const override { value = cast<uint02>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[cast<uint01>(vector_pos)]); };
299 void get(uint04 index, uint04 vector_pos, uint04& value) const override { value = cast<uint04>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[cast<uint01>(vector_pos)]); };
300 void get(uint04 index, uint04 vector_pos, uint08& value) const override { value = cast<uint08>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[cast<uint01>(vector_pos)]); };
301 void get(uint04 index, uint04 vector_pos, sint01& value) const override { value = cast<sint01>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[cast<uint01>(vector_pos)]); };
302 void get(uint04 index, uint04 vector_pos, sint02& value) const override { value = cast<sint02>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[cast<uint01>(vector_pos)]); };
303 void get(uint04 index, uint04 vector_pos, sint04& value) const override { value = cast<sint04>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[cast<uint01>(vector_pos)]); };
304 void get(uint04 index, uint04 vector_pos, sint08& value) const override { value = cast<sint08>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[cast<uint01>(vector_pos)]); };
305 void get(uint04 index, uint04 vector_pos, fltp04& value) const override { value = cast<fltp04>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[cast<uint01>(vector_pos)]); };
306 void get(uint04 index, uint04 vector_pos, fltp08& value) const override { value = cast<fltp08>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[cast<uint01>(vector_pos)]); };
307 void get(uint04 index, uint04 vector_pos, String& value) const override { value = String(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[cast<uint01>(vector_pos)]); };
308
309 void get(uint04 index, bool& value) const override { if constexpr (t_dims == 1) value = cast<bool>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[0]); else value = cast<bool>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[0]); };
310 void get(uint04 index, uint01& value) const override { if constexpr (t_dims == 1) value = cast<uint01>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[0]); else value = cast<uint01>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[0]); };
311 void get(uint04 index, uint02& value) const override { if constexpr (t_dims == 1) value = cast<uint02>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[0]); else value = cast<uint02>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[0]); };
312 void get(uint04 index, uint04& value) const override { if constexpr (t_dims == 1) value = cast<uint04>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[0]); else value = cast<uint04>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[0]); };
313 void get(uint04 index, uint08& value) const override { if constexpr (t_dims == 1) value = cast<uint08>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[0]); else value = cast<uint08>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[0]); };
314 void get(uint04 index, sint01& value) const override { if constexpr (t_dims == 1) value = cast<sint01>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[0]); else value = cast<sint01>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[0]); };
315 void get(uint04 index, sint02& value) const override { if constexpr (t_dims == 1) value = cast<sint02>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[0]); else value = cast<sint02>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[0]); };
316 void get(uint04 index, sint04& value) const override { if constexpr (t_dims == 1) value = cast<sint04>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[0]); else value = cast<sint04>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[0]); };
317 void get(uint04 index, sint08& value) const override { if constexpr (t_dims == 1) value = cast<sint08>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[0]); else value = cast<sint08>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[0]); };
318 void get(uint04 index, fltp04& value) const override { if constexpr (t_dims == 1) value = cast<fltp04>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[0]); else value = cast<fltp04>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[0]); };
319 void get(uint04 index, fltp08& value) const override { if constexpr (t_dims == 1) value = cast<fltp08>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[0]); else value = cast<fltp08>(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)[0]); };
320 void get(uint04 index, String& value) const override { value = String(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index)); };
321 void get(uint04 index, RGBColor& value) const override { value = RGBColor(TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index).template as<4, t_type>()); };
322
323 void getVector(uint04 index, Vector<3, fltp04>& vector) const override
324 {
325 vector = TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index).template as<3, fltp04>();
326 }
327
328 void getVector(uint04 index, Vector<3, fltp08>& vector) const override
329 {
330 vector = TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index).template as<3, fltp08>();
331 }
332
333 void getVector(uint04 index, Vector<3, uint04>& vector) const override
334 {
335 vector = TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index).template as<3, uint04>();
336 }
337
338 void getVector(uint04 index, Vector<2, uint04>& vector) const override
339 {
340 vector = TableColumnBuffer<Vector<t_dims, t_type>>::pullValue(index).template as<2, uint04>();
341 }
342 uint08 tableHash() const override
343 {
344 uint08 result = 2166136261U;
345 std::hash<t_type> hash;
346 for (const Vector<t_dims, t_type>& v : TableColumnBuffer<Vector<t_dims, t_type>>::m_buffer)
347 {
348 for (uint01 i = 0; i < t_dims; i++)
349 result = (127 * result) + hash(v[i]);
350 }
351 return result;
352 }
353 TableVectorType<t_dims, t_type>* getSelected(const Buffer<bool>& selected_indices) const override
354 {
356 new_vector_array->setSize(selected_indices.count(true));
357 uint04 current_index = 1;
358 for (uint04 i = 0; i < selected_indices.size(); i++)
359 {
360 if (selected_indices[i])
361 {
362 new_vector_array->m_buffer[current_index++] = TableColumnBuffer<Vector<t_dims, t_type>>::m_buffer[i + 1];
363 }
364 }
365 return new_vector_array;
366 }
367
368 virtual void insertIndices(uint04 location, uint04 size) override
369 {
370 if (size == 0)
371 return;
372 Bounds<1, uint04> update_range = Constant<Bounds<1, uint04>>::Min;
373 for (uint04 i = 1; i < TableColumnBuffer<Vector<t_dims, t_type>>::m_buffer.size(); i++)
374 {
375 for (uint01 n = 0; n < t_dims; n++)
376 {
377 if (!IsInvalid(TableColumnBuffer<Vector<t_dims, t_type>>::m_buffer[i][n])
378 && cast<uint04>(TableColumnBuffer<Vector<t_dims, t_type>>::m_buffer[i][n]) >= location)
379 {
381 update_range.addToBounds(i);
382 }
383 }
384 }
385 if (update_range != Constant<Bounds<1, uint04>>::Min)
386 {
387 update_range -= 1U;
389 TableChange(TableChange::e_update, update_range[MIN], update_range.span()));
391 }
392 }
393 virtual void removeIndices(uint04 location, uint04 size) override
394 {
395 if (size == 0)
396 return;
397 Bounds<1, uint04> update_range = Constant<Bounds<1, uint04>>::Min;
398 for (uint04 i = 1; i < TableColumnBuffer<Vector<t_dims, t_type>>::m_buffer.size(); i++)
399 {
400 for (uint01 n = 0; n < t_dims; n++)
401 {
402 if (!IsInvalid(TableColumnBuffer<Vector<t_dims, t_type>>::m_buffer[i][n])
403 && cast<uint04>(TableColumnBuffer<Vector<t_dims, t_type>>::m_buffer[i][n]) >= location)
404 {
405 if (cast<uint04>(TableColumnBuffer<Vector<t_dims, t_type>>::m_buffer[i][n]) < location + size)
407 else
409 update_range.addToBounds(i);
410 }
411 }
412 }
413 if (update_range != Constant<Bounds<1, uint04>>::Min)
414 {
415 update_range -= 1U;
417 TableChange(TableChange::e_update, update_range[MIN], update_range.span()));
419 }
420 }
421 virtual void removeIndices(const Buffer<uint04>& offset_lookup_list) override
422 {
423 Bounds<1, uint04> update_range = Constant<Bounds<1, uint04>>::Min;
424 for (uint04 i = 1; i < TableColumnBuffer<Vector<t_dims, t_type>>::m_buffer.size(); i++)
425 {
426 for (uint01 n = 0; n < t_dims; n++)
427 {
428 if (!IsInvalid(TableColumnBuffer<Vector<t_dims, t_type>>::m_buffer[i][n]))
429 {
430 uint04 new_index = offset_lookup_list[cast<uint04>(TableColumnBuffer<Vector<t_dims, t_type>>::m_buffer[i][n])];;
432 update_range.addToBounds(i);
433 }
434 }
435 }
436 if (update_range != Constant<Bounds<1, uint04>>::Min)
437 {
438 update_range -= 1U;
440 TableChange(TableChange::e_update, update_range[MIN], update_range.span()));
442 }
443 }
444
445 };
446
447 /**--------------------------------------------------------------------------------------------------
448 \brief A TableColumnBuffer column of Matrices
449 Allows for virtual memory access with the caller not needing to know how the data itself is stored.
450 **/
451 template<class t_type, uint01 t_cols, uint01 t_rows>
452 class TableMatrixType : public TableVectorType<t_cols* t_rows, t_type>
453 {
454 public:
456 : TableVectorType<t_cols* t_rows, t_type>(label)
457 {}
458 private:
459 void set(uint04 index, const String& value) override
460 {
463 };
464 void get(uint04 index, String& value) const override
465 {
466 value = String(Matrix<t_type, t_cols, t_rows>(TableVectorType<t_cols * t_rows, t_type>::m_buffer[index + 1]));
467 };
468 virtual void get(uint04 index, Matrix<fltp08>& transform) const override
469 {
470 Matrix<t_type, t_cols, t_rows> matrix;
471 memcpy(&matrix, &TableVectorType<t_cols * t_rows, t_type>::pullValue(index), sizeof(Matrix<t_type, t_cols, t_rows>));
472 transform = matrix.template as<fltp08, 4, 4>();
473 }
474 virtual void get(uint04 index, Matrix<fltp04>& transform) const override
475 {
476 Matrix<t_type, t_cols, t_rows> matrix;
477 memcpy(&matrix, &TableVectorType<t_cols * t_rows, t_type>::pullValue(index), sizeof(Matrix<t_type, t_cols, t_rows>));
478 transform = matrix.template as<fltp04, 4, 4>();
479 }
480 virtual void set(uint04 index, const Matrix<fltp08>& transform) override
481 {
482 Matrix<t_type, t_cols, t_rows> matrix = transform.as<t_type, t_cols, t_rows>();
483 memcpy(&TableVectorType<t_cols * t_rows, t_type>::pullValue(index), &matrix, sizeof(Matrix<t_type, t_cols, t_rows>));
484 }
485 virtual void set(uint04 index, const Matrix<fltp04>& transform) override
486 {
487 Matrix<t_type, t_cols, t_rows> matrix = transform.as<t_type, t_cols, t_rows>();
488 memcpy(&TableVectorType<t_cols * t_rows, t_type>::pullValue(index), &matrix, sizeof(Matrix<t_type, t_cols, t_rows>));
489 }
490 };
491
492 /**--------------------------------------------------------------------------------------------------
493 \brief An obtimized single column TableVectorType that stores data in a simple buffer
494 Allows for virtual memory access with the caller not needing to know how the data itself is stored.
495 **/
496 template<class t_type>
497 class TableVectorType<1, t_type> : public TableColumnBuffer<t_type>
498 {
499 public:
501 : TableColumnBuffer<t_type>(label, GetTypeInfo<t_type>())
502 {}
503
505 : TableColumnBuffer<t_type>(buffer, label, GetTypeInfo<t_type>())
506 {}
507 private:
508 virtual uint04 getRowSize(uint04) const override { return 1; };
509
510 void set(uint04 index, uint04, bool value) override { TableColumnBuffer<t_type>::pullValue(index) = value; };
511 void set(uint04 index, uint04, uint01 value) override { TableColumnBuffer<t_type>::pullValue(index) = cast<t_type>(value); };
512 void set(uint04 index, uint04, uint02 value) override { TableColumnBuffer<t_type>::pullValue(index) = cast<t_type>(value); };
513 void set(uint04 index, uint04, uint04 value) override { TableColumnBuffer<t_type>::pullValue(index) = cast<t_type>(value); };
514 void set(uint04 index, uint04, uint08 value) override { TableColumnBuffer<t_type>::pullValue(index) = cast<t_type>(value); };
515 void set(uint04 index, uint04, sint01 value) override { TableColumnBuffer<t_type>::pullValue(index) = cast<t_type>(value); };
516 void set(uint04 index, uint04, sint02 value) override { TableColumnBuffer<t_type>::pullValue(index) = cast<t_type>(value); };
517 void set(uint04 index, uint04, sint04 value) override { TableColumnBuffer<t_type>::pullValue(index) = cast<t_type>(value); };
518 void set(uint04 index, uint04, sint08 value) override { TableColumnBuffer<t_type>::pullValue(index) = cast<t_type>(value); };
519 void set(uint04 index, uint04, fltp04 value) override { TableColumnBuffer<t_type>::pullValue(index) = cast<t_type>(value); };
520 void set(uint04 index, uint04, fltp08 value) override { TableColumnBuffer<t_type>::pullValue(index) = cast<t_type>(value); };
521
522 void set(uint04 index, uint04, const String& value) override { TableColumnBuffer<t_type>::pullValue(index) = value.getAs<t_type>(); };
523
524 void set(uint04 index, bool value) override { TableColumnBuffer<t_type>::pullValue(index) = value; };
525 void set(uint04 index, uint01 value) override { TableColumnBuffer<t_type>::pullValue(index) = cast<t_type>(value); };
526 void set(uint04 index, uint02 value) override { TableColumnBuffer<t_type>::pullValue(index) = cast<t_type>(value); };
527 void set(uint04 index, uint04 value) override { TableColumnBuffer<t_type>::pullValue(index) = cast<t_type>(value); };
528 void set(uint04 index, uint08 value) override { TableColumnBuffer<t_type>::pullValue(index) = cast<t_type>(value); };
529 void set(uint04 index, sint01 value) override { TableColumnBuffer<t_type>::pullValue(index) = cast<t_type>(value); };
530 void set(uint04 index, sint02 value) override { TableColumnBuffer<t_type>::pullValue(index) = cast<t_type>(value); };
531 void set(uint04 index, sint04 value) override { TableColumnBuffer<t_type>::pullValue(index) = cast<t_type>(value); };
532 void set(uint04 index, sint08 value) override { TableColumnBuffer<t_type>::pullValue(index) = cast<t_type>(value); };
533 void set(uint04 index, fltp04 value) override { TableColumnBuffer<t_type>::pullValue(index) = cast<t_type>(value); };
534 void set(uint04 index, fltp08 value) override { TableColumnBuffer<t_type>::pullValue(index) = cast<t_type>(value); };
535 void set(uint04 index, const String& value) override { TableColumnBuffer<t_type>::pullValue(index) = value.getAs<t_type>(); };
536 void set(uint04, RGBColor) override { /*TableColumnBuffer<t_type>::pullValue(index) = value.getAs<Vector<t_dims, t_type>>();*/ };
537
538 void get(uint04 index, uint04, bool& value) const override { value = cast<bool>(TableColumnBuffer<t_type>::pullValue(index)); };
539 void get(uint04 index, uint04, uint01& value) const override { value = cast<uint01>(TableColumnBuffer<t_type>::pullValue(index)); };
540 void get(uint04 index, uint04, uint02& value) const override { value = cast<uint02>(TableColumnBuffer<t_type>::pullValue(index)); };
541 void get(uint04 index, uint04, uint04& value) const override { value = cast<uint04>(TableColumnBuffer<t_type>::pullValue(index)); };
542 void get(uint04 index, uint04, uint08& value) const override { value = cast<uint08>(TableColumnBuffer<t_type>::pullValue(index)); };
543 void get(uint04 index, uint04, sint01& value) const override { value = cast<sint01>(TableColumnBuffer<t_type>::pullValue(index)); };
544 void get(uint04 index, uint04, sint02& value) const override { value = cast<sint02>(TableColumnBuffer<t_type>::pullValue(index)); };
545 void get(uint04 index, uint04, sint04& value) const override { value = cast<sint04>(TableColumnBuffer<t_type>::pullValue(index)); };
546 void get(uint04 index, uint04, sint08& value) const override { value = cast<sint08>(TableColumnBuffer<t_type>::pullValue(index)); };
547 void get(uint04 index, uint04, fltp04& value) const override { value = cast<fltp04>(TableColumnBuffer<t_type>::pullValue(index)); };
548 void get(uint04 index, uint04, fltp08& value) const override { value = cast<fltp08>(TableColumnBuffer<t_type>::pullValue(index)); };
549 void get(uint04 index, uint04, String& value) const override { value = String(TableColumnBuffer<t_type>::pullValue(index)); };
550
551 void get(uint04 index, bool& value) const override { value = TableColumnBuffer<t_type>::pullValue(index); };
552 void get(uint04 index, uint01& value) const override { value = cast<uint01>(TableColumnBuffer<t_type>::pullValue(index)); };
553 void get(uint04 index, uint02& value) const override { value = cast<uint02>(TableColumnBuffer<t_type>::pullValue(index)); };
554 void get(uint04 index, uint04& value) const override { value = cast<uint04>(TableColumnBuffer<t_type>::pullValue(index)); };
555 void get(uint04 index, uint08& value) const override { value = cast<uint08>(TableColumnBuffer<t_type>::pullValue(index)); };
556 void get(uint04 index, sint01& value) const override { value = cast<sint01>(TableColumnBuffer<t_type>::pullValue(index)); };
557 void get(uint04 index, sint02& value) const override { value = cast<sint02>(TableColumnBuffer<t_type>::pullValue(index)); };
558 void get(uint04 index, sint04& value) const override { value = cast<sint04>(TableColumnBuffer<t_type>::pullValue(index)); };
559 void get(uint04 index, sint08& value) const override { value = cast<sint08>(TableColumnBuffer<t_type>::pullValue(index)); };
560 void get(uint04 index, fltp04& value) const override { value = cast<fltp04>(TableColumnBuffer<t_type>::pullValue(index)); };
561 void get(uint04 index, fltp08& value) const override { value = cast<fltp08>(TableColumnBuffer<t_type>::pullValue(index)); };
562 void get(uint04 index, String& value) const override { value = String(TableColumnBuffer<t_type>::pullValue(index)); };
563 void get(uint04, RGBColor&) const override { /*value = RGBColor(m_buffer[index].getAs<4, t_type>());*/ };
564 TableVectorType<1, t_type>* getSelected(const Buffer<bool>& selected_indices) const override
565 {
566 TableVectorType<1, t_type>* new_vector_array = new TableVectorType<1, t_type>(TableColumn::label());
567 new_vector_array->setSize(selected_indices.count(true));
568 uint04 current_index = 1;
569 for (uint04 i = 0; i < selected_indices.size(); i++)
570 {
571 if (selected_indices[i])
572 {
573 new_vector_array->m_buffer[current_index++] = TableColumnBuffer<t_type>::m_buffer[i + 1];
574 }
575 }
576 return new_vector_array;
577 }
578 virtual void insertIndices(uint04 location, uint04 size) override
579 {
580 this->template _insertIndices<t_type>(location, size);
581 }
582 virtual void removeIndices(uint04 location, uint04 size) override
583 {
584 this->template _removeIndices<t_type>(location, size);
585 }
586 virtual void removeIndices(const Buffer<uint04>& offset_lookup_list) override
587 {
588 this->template _removeIndices<t_type>(offset_lookup_list);
589 }
590 private:
591 template<class t_n_type>
592 void _insertIndices(uint04 location, typename std::enable_if<ObjectInfo<t_n_type>::Number && ObjectInfo<t_n_type>::Dimensions < 16, uint04>::type size)
593 {
594 if (size == 0)
595 return;
596 Bounds<1, uint04> update_range = Constant<Bounds<1, uint04>>::Min;
597 for (uint04 i = 1; i < TableColumnBuffer<t_type>::m_buffer.size(); i++)
598 {
600 uint04 value = cast<uint04>(it);
601 if (value >= location && !IsInvalid(value))
602 {
603 it += cast<t_type>(size);
604 update_range.addToBounds(i);
605 }
606 }
607 if (update_range != Constant<Bounds<1, uint04>>::Min)
608 {
609 update_range -= 1U;
611 TableChange(TableChange::e_update, update_range[MIN], update_range.span()));
613 }
614 }
615 template<class t_n_type>
616 void _insertIndices(uint04 location, typename std::enable_if<!ObjectInfo<t_n_type>::Number || ObjectInfo<t_n_type>::Dimensions >= 16, uint04>::type size) {
617 UNUSED(location);
618 UNUSED(size);
619 };
620
621 template<class t_n_type>
622 void _removeIndices(uint04 location, typename std::enable_if<ObjectInfo<t_n_type>::Number && ObjectInfo<t_n_type>::Dimensions < 16, uint04>::type size)
623 {
624 if (size == 0)
625 return;
626 Bounds<1, uint04> update_range = Constant<Bounds<1, uint04>>::Min;
627 for (uint04 i = 1; i < TableColumnBuffer<t_type>::m_buffer.size(); i++)
628 {
630 {
631 if (cast<uint04>(TableColumnBuffer<t_type>::m_buffer[i]) < location + size)
633 else
635 update_range.addToBounds(i);
636 }
637 }
638 if (update_range != Constant<Bounds<1, uint04>>::Min)
639 {
640 update_range -= 1U;
642 TableChange(TableChange::e_update, update_range[MIN], update_range.span()));
644 }
645 }
646 template<class t_n_type>
647 void _removeIndices(uint04 location, typename std::enable_if<!ObjectInfo<t_n_type>::Number || ObjectInfo<t_n_type>::Dimensions >= 16, uint04>::type size) {UNUSED(location); UNUSED(size); }
648
649 template<class t_n_type>
650 void _removeIndices(typename std::enable_if<ObjectInfo<t_n_type>::Number, const Buffer<uint04>&>::type offset_lookup_list)
651 {
652 Bounds<1, uint04> update_range = Constant<Bounds<1, uint04>>::Min;
653 for (uint04 i = 1; i < TableColumnBuffer<t_type>::m_buffer.size(); i++)
654 {
656 {
657 uint04 value = offset_lookup_list[cast<uint04>(TableColumnBuffer<t_type>::m_buffer[i])];
659 {
661 update_range.addToBounds(i);
662 }
663 }
664 }
665 if (update_range != Constant<Bounds<1, uint04>>::Min)
666 {
667 update_range -= 1U;
669 TableChange(TableChange::e_update, update_range[MIN], update_range.span()));
671 }
672 }
673
674 template<class t_n_type>
675 void _removeIndices(typename std::enable_if<!ObjectInfo<t_n_type>::Number, const Buffer<uint04>&>::type offset_lookup_list) {UNUSED(offset_lookup_list);}
676
677 };
678
679 /**--------------------------------------------------------------------------------------------------
680 \brief A TableVectorType optimized for storing UUID objects
681 Allows for virtual memory access with the caller not needing to know how the data itself is stored.
682 **/
683 template<>
684 class TableVectorType<1, UUID> : public TableVectorType<16, uint01>
685 {
686 public:
692 {
693 UNUSED(type);//We already know the type
694 }
695 private:
696 void get(uint04, bool& value) const override { value = false; };
697 void set(uint04 index, bool value) override { TableVectorType<16, uint01>::pullValue(index) = UUID(0).appendUUID(value); };
698 void set(uint04 index, uint01 value) override { TableVectorType<16, uint01>::pullValue(index) = UUID(0).appendUUID(value); };
699 void set(uint04 index, uint02 value) override { TableVectorType<16, uint01>::pullValue(index) = UUID(0).appendUUID(value); };
700 void set(uint04 index, uint04 value) override { TableVectorType<16, uint01>::pullValue(index) = UUID(0).appendUUID(value); };
701 void set(uint04 index, uint08 value) override { TableVectorType<16, uint01>::pullValue(index) = UUID(0).appendUUID(value); };
702 void set(uint04 index, sint01 value) override { TableVectorType<16, uint01>::pullValue(index) = UUID(0).appendUUID(value); };
703 void set(uint04 index, sint02 value) override { TableVectorType<16, uint01>::pullValue(index) = UUID(0).appendUUID(value); };
704 void set(uint04 index, sint04 value) override { TableVectorType<16, uint01>::pullValue(index) = UUID(0).appendUUID(value); };
705 void set(uint04 index, sint08 value) override { TableVectorType<16, uint01>::pullValue(index) = UUID(0).appendUUID(value); };
706 void set(uint04 index, fltp04 value) override { TableVectorType<16, uint01>::pullValue(index) = UUID(0).appendUUID(value); };
707 void set(uint04 index, fltp08 value) override { TableVectorType<16, uint01>::pullValue(index) = UUID(0).appendUUID(value); };
708 void set(uint04 index, RGBColor value) override { UNUSED(index); UNUSED(value);/*TableColumnBuffer<t_type>::pullValue(index) = value.getAs<Vector<t_dims, t_type>>();*/ };
709 void set(uint04 index, const String& value) override { TableVectorType<16, uint01>::pullValue(index) = value.getAs<UUID>(); };
710 void get(uint04 index, String& value) const override { value = String(UUID(TableVectorType<16, uint01>::pullValue(index))); };
711 virtual void set(uint04 index, const UUID& value) final override
712 {
714 }
715 virtual void get(uint04 index, UUID& id) const final override
716 {
718 }
719 decltype(auto) pullValue(uint04 index)
720 {
721 return IsInvalid(index) ? defaultValue() : m_buffer[index + 1];
722 }
723 decltype(auto) pullValue(uint04 index) const
724 {
725 return IsInvalid(index) ? defaultValue() : m_buffer[index + 1];
726 }
727 };
728
729 /**--------------------------------------------------------------------------------------------------
730 \brief A TableColumnBuffer of buffers. Meaning each row has some potentially unique N-number of columns
731 Allows for virtual memory access with the caller not needing to know how the data itself is stored.
732 **/
733 template<class t_type>
734 class TableColumnTypeBuffer : public TableColumnBuffer<Buffer<t_type>>
735 {
736 public:
740 private:
741 void set(uint04 index, uint04 vector_pos, bool value) override { TableColumnBuffer<Buffer<t_type>>::pullValue(index)[vector_pos] = cast<t_type>(value); };
742 void set(uint04 index, uint04 vector_pos, uint01 value) override { TableColumnBuffer<Buffer<t_type>>::pullValue(index)[vector_pos] = cast<t_type>(value); };
743 void set(uint04 index, uint04 vector_pos, uint02 value) override { TableColumnBuffer<Buffer<t_type>>::pullValue(index)[vector_pos] = cast<t_type>(value); };
744 void set(uint04 index, uint04 vector_pos, uint04 value) override { TableColumnBuffer<Buffer<t_type>>::pullValue(index)[vector_pos] = cast<t_type>(value); };
745 void set(uint04 index, uint04 vector_pos, uint08 value) override { TableColumnBuffer<Buffer<t_type>>::pullValue(index)[vector_pos] = cast<t_type>(value); };
746 void set(uint04 index, uint04 vector_pos, sint01 value) override { TableColumnBuffer<Buffer<t_type>>::pullValue(index)[vector_pos] = cast<t_type>(value); };
747 void set(uint04 index, uint04 vector_pos, sint02 value) override { TableColumnBuffer<Buffer<t_type>>::pullValue(index)[vector_pos] = cast<t_type>(value); };
748 void set(uint04 index, uint04 vector_pos, sint04 value) override { TableColumnBuffer<Buffer<t_type>>::pullValue(index)[vector_pos] = cast<t_type>(value); };
749 void set(uint04 index, uint04 vector_pos, sint08 value) override { TableColumnBuffer<Buffer<t_type>>::pullValue(index)[vector_pos] = cast<t_type>(value); };
750 void set(uint04 index, uint04 vector_pos, fltp04 value) override { TableColumnBuffer<Buffer<t_type>>::pullValue(index)[vector_pos] = cast<t_type>(value); };
751 void set(uint04 index, uint04 vector_pos, fltp08 value) override { TableColumnBuffer<Buffer<t_type>>::pullValue(index)[vector_pos] = cast<t_type>(value); };
752
753 void set(uint04 index, uint04 vector_pos, const String& value) override { UNUSED(index); UNUSED(vector_pos); UNUSED(value);/*TableColumnBuffer<Buffer<t_type>>::pullValue(index)[vector_pos] = value.getAs<t_type>();*/ };
754
755 void set(uint04 index, bool value) override { TableColumnBuffer<Buffer<t_type>>::pullValue(index).setAllToValue(cast<t_type>(value)); };
756 void set(uint04 index, uint01 value) override { TableColumnBuffer<Buffer<t_type>>::pullValue(index).setAllToValue(cast<t_type>(value)); };
757 void set(uint04 index, uint02 value) override { TableColumnBuffer<Buffer<t_type>>::pullValue(index).setAllToValue(cast<t_type>(value)); };
758 void set(uint04 index, uint04 value) override { TableColumnBuffer<Buffer<t_type>>::pullValue(index).setAllToValue(cast<t_type>(value)); };
759 void set(uint04 index, uint08 value) override { TableColumnBuffer<Buffer<t_type>>::pullValue(index).setAllToValue(cast<t_type>(value)); };
760 void set(uint04 index, sint01 value) override { TableColumnBuffer<Buffer<t_type>>::pullValue(index).setAllToValue(cast<t_type>(value)); };
761 void set(uint04 index, sint02 value) override { TableColumnBuffer<Buffer<t_type>>::pullValue(index).setAllToValue(cast<t_type>(value)); };
762 void set(uint04 index, sint04 value) override { TableColumnBuffer<Buffer<t_type>>::pullValue(index).setAllToValue(cast<t_type>(value)); };
763 void set(uint04 index, sint08 value) override { TableColumnBuffer<Buffer<t_type>>::pullValue(index).setAllToValue(cast<t_type>(value)); };
764 void set(uint04 index, fltp04 value) override { TableColumnBuffer<Buffer<t_type>>::pullValue(index).setAllToValue(cast<t_type>(value)); };
765 void set(uint04 index, fltp08 value) override { TableColumnBuffer<Buffer<t_type>>::pullValue(index).setAllToValue(cast<t_type>(value)); };
766 void set(uint04 index, const String& value) override { UNUSED(index); UNUSED(value);/*TableColumnBuffer<Buffer<t_type>>::pullValue(index).setAllToValue(value.getAs<Vector<t_dims, t_type>>());*/ };
767 void set(uint04 index, RGBColor value) override { UNUSED(index); UNUSED(value);/*TableColumnBuffer<Buffer<t_type>>::pullValue(index).setAllToValue(value.getAs<t_dims, t_type>());*/ };
768
769 void get(uint04 index, uint04 vector_pos, bool& value) const override { value = cast<bool>(TableColumnBuffer<Buffer<t_type>>::pullValue(index)[vector_pos]); };
770 void get(uint04 index, uint04 vector_pos, uint01& value) const override { value = cast<uint01>(TableColumnBuffer<Buffer<t_type>>::pullValue(index)[vector_pos]); };
771 void get(uint04 index, uint04 vector_pos, uint02& value) const override { value = cast<uint02>(TableColumnBuffer<Buffer<t_type>>::pullValue(index)[vector_pos]); };
772 void get(uint04 index, uint04 vector_pos, uint04& value) const override { value = cast<uint04>(TableColumnBuffer<Buffer<t_type>>::pullValue(index)[vector_pos]); };
773 void get(uint04 index, uint04 vector_pos, uint08& value) const override { value = cast<uint08>(TableColumnBuffer<Buffer<t_type>>::pullValue(index)[vector_pos]); };
774 void get(uint04 index, uint04 vector_pos, sint01& value) const override { value = cast<sint01>(TableColumnBuffer<Buffer<t_type>>::pullValue(index)[vector_pos]); };
775 void get(uint04 index, uint04 vector_pos, sint02& value) const override { value = cast<sint02>(TableColumnBuffer<Buffer<t_type>>::pullValue(index)[vector_pos]); };
776 void get(uint04 index, uint04 vector_pos, sint04& value) const override { value = cast<sint04>(TableColumnBuffer<Buffer<t_type>>::pullValue(index)[vector_pos]); };
777 void get(uint04 index, uint04 vector_pos, sint08& value) const override { value = cast<sint08>(TableColumnBuffer<Buffer<t_type>>::pullValue(index)[vector_pos]); };
778 void get(uint04 index, uint04 vector_pos, fltp04& value) const override { value = cast<fltp04>(TableColumnBuffer<Buffer<t_type>>::pullValue(index)[vector_pos]); };
779 void get(uint04 index, uint04 vector_pos, fltp08& value) const override { value = cast<fltp08>(TableColumnBuffer<Buffer<t_type>>::pullValue(index)[vector_pos]); };
780 void get(uint04 index, uint04 vector_pos, String& value) const override { UNUSED(index); UNUSED(vector_pos); UNUSED(value);/*value = String(TableColumnBuffer<Buffer<t_type>>::pullValue(index)[vector_pos]);*/ };
781
782
783 void get(uint04 index, bool& value) const override { value = cast<bool>(TableColumnBuffer<Buffer<t_type>>::pullValue(index).last()); };
784 void get(uint04 index, uint01& value) const override { value = cast<uint01>(TableColumnBuffer<Buffer<t_type>>::pullValue(index).last()); };
785 void get(uint04 index, uint02& value) const override { value = cast<uint02>(TableColumnBuffer<Buffer<t_type>>::pullValue(index).last()); };
786 void get(uint04 index, uint04& value) const override { value = cast<uint04>(TableColumnBuffer<Buffer<t_type>>::pullValue(index).last()); };
787 void get(uint04 index, uint08& value) const override { value = cast<uint08>(TableColumnBuffer<Buffer<t_type>>::pullValue(index).last()); };
788 void get(uint04 index, sint01& value) const override { value = cast<sint01>(TableColumnBuffer<Buffer<t_type>>::pullValue(index).last()); };
789 void get(uint04 index, sint02& value) const override { value = cast<sint02>(TableColumnBuffer<Buffer<t_type>>::pullValue(index).last()); };
790 void get(uint04 index, sint04& value) const override { value = cast<sint04>(TableColumnBuffer<Buffer<t_type>>::pullValue(index).last()); };
791 void get(uint04 index, sint08& value) const override { value = cast<sint08>(TableColumnBuffer<Buffer<t_type>>::pullValue(index).last()); };
792 void get(uint04 index, fltp04& value) const override { value = cast<fltp04>(TableColumnBuffer<Buffer<t_type>>::pullValue(index).last()); };
793 void get(uint04 index, fltp08& value) const override { value = cast<fltp08>(TableColumnBuffer<Buffer<t_type>>::pullValue(index).last()); };
794 void get(uint04 index, String& value) const override { UNUSED(index); UNUSED(value);/*value = String(TableColumnBuffer<Buffer<t_type>>::pullValue(index));*/ };
795 void get(uint04 index, RGBColor& value) const override { UNUSED(index); UNUSED(value);/*value = RGBColor(m_buffer[index].last());*/ };
796 virtual void insertIndices(uint04 location, uint04 size) override
797 {
798 this->template _insertIndices<t_type>(location, size);
799 }
800 virtual void removeIndices(uint04 location, uint04 size) override
801 {
802 this->template _removeIndices<t_type>(location, size);
803 }
804 virtual void removeIndices(const Buffer<uint04>& offset_lookup_list) override
805 {
806 this->template _removeIndices<t_type>(offset_lookup_list);
807 }
808 uint08 tableHash() const override
809 {
810 uint08 result = 2166136261U;
811 std::hash<t_type> hash;
812 for (const Buffer<t_type>& b : TableColumnBuffer<Buffer<t_type>>::m_buffer)
813 {
814 for(uint04 i = 0; i < b.size(); i++)
815 result = (127 * result) + hash(b[i]);
816 }
817 return result;
818 }
819 void setRowSize(uint04 index, uint04 size) override { TableColumnBuffer<Buffer<t_type>>::m_buffer[index + 1].setSize(size); };
820 uint04 getRowSize(uint04 index) const override { return TableColumnBuffer<Buffer<t_type>>::m_buffer[index + 1].size(); };
821 TableColumnTypeBuffer<t_type>* getSelected(const Buffer<bool>& selected_indices) const override { UNUSED(selected_indices); return nullptr; };
822 private:
823 template<class t_n_type>
824 void _insertIndices(uint04 location, typename std::enable_if<ObjectInfo<t_n_type>::Number, uint04>::type size)
825 {
826 if (size == 0)
827 return;
828 Bounds<1, uint04> update_range = Constant<Bounds<1, uint04>>::Min;
829 for (uint04 i = 1; i < TableColumnBuffer<Buffer<t_type>>::m_buffer.size(); i++)
830 {
831 for (uint04 n = 0; n < TableColumnBuffer<Buffer<t_type>>::m_buffer[i].size(); n++)
832 {
833 if (TableColumnBuffer<Buffer<t_type>>::m_buffer[i][n] >= cast<t_type>(location)
834 && !IsInvalid(TableColumnBuffer<Buffer<t_type>>::m_buffer[i][n]))
835 {
837 update_range.addToBounds(i);
838 }
839 }
840 }
841 if (update_range != Constant<Bounds<1, uint04>>::Min)
842 {
843 update_range -= 1U;
845 TableChange(TableChange::e_update, update_range[MIN], update_range.span()));
847 }
848 }
849 template<class t_n_type>
850 void _insertIndices(uint04 location, typename std::enable_if<!ObjectInfo<t_n_type>::Number, uint04>::type size) { UNUSED(location); UNUSED(size); }
851
852 template<class t_n_type>
853 void _removeIndices(uint04 location, typename std::enable_if<ObjectInfo<t_n_type>::Number, uint04>::type size)
854 {
855 if (size == 0)
856 return;
857 Bounds<1, uint04> update_range = Constant<Bounds<1, uint04>>::Min;
858 for (uint04 i = 1; i < TableColumnBuffer<Buffer<t_type>>::m_buffer.size(); i++)
859 {
860 for (uint04 n = TableColumnBuffer<Buffer<t_type>>::m_buffer[i].size() - 1; !IsInvalid(n); --n)
861 {
862 if (TableColumnBuffer<Buffer<t_type>>::m_buffer[i][n] >= cast<t_type>(location) && !IsInvalid(TableColumnBuffer<Buffer<t_type>>::m_buffer[i][n]))
863 {
864 if (TableColumnBuffer<Buffer<t_type>>::m_buffer[i][n] < cast<t_type>(location + size))
866 else
868 update_range.addToBounds(i);
869 }
870 }
871 }
872 if (update_range != Constant<Bounds<1, uint04>>::Min)
873 {
874 update_range -= 1U;
876 TableChange(TableChange::e_update, update_range[MIN], update_range.span()));
878 }
879 }
880
881 template<class t_n_type>
882 void _removeIndices(uint04 location, typename std::enable_if<!ObjectInfo<t_n_type>::Number, uint04>::type size)
883 {
884 UNUSED(location);
885 UNUSED(size);
886 }
887
888 template<class t_n_type>
889 void _removeIndices(typename std::enable_if<ObjectInfo<t_n_type>::Number, const Buffer<uint04>&>::type offset_lookup_list)
890 {
891 Bounds<1, uint04> update_range = Constant<Bounds<1, uint04>>::Min;
892 for (uint04 i = 1; i < TableColumnBuffer<Buffer<t_type>>::m_buffer.size(); i++)
893 {
894 for (uint04 n = TableColumnBuffer<Buffer<t_type>>::m_buffer[i].size() - 1; !IsInvalid(n); --n)
895 {
896 if (!IsInvalid(TableColumnBuffer<Buffer<t_type>>::m_buffer[i][n]))
897 {
898 uint04 value = offset_lookup_list[cast<uint04>(TableColumnBuffer<Buffer<t_type>>::m_buffer[i][n])];
899 if (IsInvalid(value))
900 {
902 update_range.addToBounds(i);
903 }
904 else if(TableColumnBuffer<Buffer<t_type>>::m_buffer[i][n] != cast<t_type>(value))
905 {
907 update_range.addToBounds(i);
908 }
909 }
910 }
911 }
912 if (update_range != Constant<Bounds<1, uint04>>::Min)
913 {
914 update_range -= 1U;
916 TableChange(TableChange::e_update, update_range[MIN], update_range.span()));
918 }
919 }
920
921 template<class t_n_type>
922 void _removeIndices(typename std::enable_if<!ObjectInfo<t_n_type>::Number, const Buffer<uint04>&>::type offset_lookup_list)
923 {
924 UNUSED(offset_lookup_list);
925 }
926 };
927
928 /**--------------------------------------------------------------------------------------------------
929 \brief A TableColumnBuffer of Strings
930 Allows for virtual memory access with the caller not needing to know how the data itself is stored.
931 **/
933 {
934 public:
937 {}
938 private:
939 void removeRows(uint04 offset, const Buffer<bool>& indices) override { UNUSED(offset); UNUSED(indices);};
940 void set(uint04 index, uint04 vector_pos, bool value) override { TableColumnBuffer<String>::pullValue(index).insert(vector_pos, String(value)); };
941 void set(uint04 index, uint04 vector_pos, uint01 value) override { TableColumnBuffer<String>::pullValue(index).insert(vector_pos, String(value)); };
942 void set(uint04 index, uint04 vector_pos, uint02 value) override { TableColumnBuffer<String>::pullValue(index).insert(vector_pos, String(value)); };
943 void set(uint04 index, uint04 vector_pos, uint04 value) override { TableColumnBuffer<String>::pullValue(index).insert(vector_pos, String(value)); };
944 void set(uint04 index, uint04 vector_pos, uint08 value) override { TableColumnBuffer<String>::pullValue(index).insert(vector_pos, String(value)); };
945 void set(uint04 index, uint04 vector_pos, sint01 value) override { TableColumnBuffer<String>::pullValue(index).insert(vector_pos, String(value)); };
946 void set(uint04 index, uint04 vector_pos, sint02 value) override { TableColumnBuffer<String>::pullValue(index).insert(vector_pos, String(value)); };
947 void set(uint04 index, uint04 vector_pos, sint04 value) override { TableColumnBuffer<String>::pullValue(index).insert(vector_pos, String(value)); };
948 void set(uint04 index, uint04 vector_pos, sint08 value) override { TableColumnBuffer<String>::pullValue(index).insert(vector_pos, String(value)); };
949 void set(uint04 index, uint04 vector_pos, fltp04 value) override { TableColumnBuffer<String>::pullValue(index).insert(vector_pos, String(value)); };
950 void set(uint04 index, uint04 vector_pos, fltp08 value) override { TableColumnBuffer<String>::pullValue(index).insert(vector_pos, String(value)); };
951
952 void set(uint04 index, uint04 vector_pos, const String& value) override { TableColumnBuffer<String>::pullValue(index).insert(vector_pos, value); };
953
954 void set(uint04 index, bool value) override { TableColumnBuffer<String>::pullValue(index) = String(value); };
955 void set(uint04 index, uint01 value) override { TableColumnBuffer<String>::pullValue(index) = String(value); };
956 void set(uint04 index, uint02 value) override { TableColumnBuffer<String>::pullValue(index) = String(value); };
957 void set(uint04 index, uint04 value) override { TableColumnBuffer<String>::pullValue(index) = String(value); };
958 void set(uint04 index, uint08 value) override { TableColumnBuffer<String>::pullValue(index) = String(value); };
959 void set(uint04 index, sint01 value) override { TableColumnBuffer<String>::pullValue(index) = String(value); };
960 void set(uint04 index, sint02 value) override { TableColumnBuffer<String>::pullValue(index) = String(value); };
961 void set(uint04 index, sint04 value) override { TableColumnBuffer<String>::pullValue(index) = String(value); };
962 void set(uint04 index, sint08 value) override { TableColumnBuffer<String>::pullValue(index) = String(value); };
963 void set(uint04 index, fltp04 value) override { TableColumnBuffer<String>::pullValue(index) = String(value); };
964 void set(uint04 index, fltp08 value) override { TableColumnBuffer<String>::pullValue(index) = String(value); };
965 void set(uint04 index, const String& value) override { TableColumnBuffer<String>::pullValue(index) = value; };
966 void set(uint04 index, RGBColor value) override { TableColumnBuffer<String>::pullValue(index) = String(value); };
967
968 void get(uint04 index, uint04 vector_pos, bool& value) const override { value = String(&TableColumnBuffer<String>::pullValue(index)[vector_pos]).getAs<bool>(); };
969 void get(uint04 index, uint04 vector_pos, uint01& value) const override { value = String(&TableColumnBuffer<String>::pullValue(index)[vector_pos]).getAs<uint01>(); };
970 void get(uint04 index, uint04 vector_pos, uint02& value) const override { value = String(&TableColumnBuffer<String>::pullValue(index)[vector_pos]).getAs<uint02>(); };
971 void get(uint04 index, uint04 vector_pos, uint04& value) const override { value = String(&TableColumnBuffer<String>::pullValue(index)[vector_pos]).getAs<uint04>(); };
972 void get(uint04 index, uint04 vector_pos, uint08& value) const override { value = String(&TableColumnBuffer<String>::pullValue(index)[vector_pos]).getAs<uint08>(); };
973 void get(uint04 index, uint04 vector_pos, sint01& value) const override { value = String(&TableColumnBuffer<String>::pullValue(index)[vector_pos]).getAs<uint01>(); };
974 void get(uint04 index, uint04 vector_pos, sint02& value) const override { value = String(&TableColumnBuffer<String>::pullValue(index)[vector_pos]).getAs<sint02>(); };
975 void get(uint04 index, uint04 vector_pos, sint04& value) const override { value = String(&TableColumnBuffer<String>::pullValue(index)[vector_pos]).getAs<sint04>(); };
976 void get(uint04 index, uint04 vector_pos, sint08& value) const override { value = String(&TableColumnBuffer<String>::pullValue(index)[vector_pos]).getAs<sint08>(); };
977 void get(uint04 index, uint04 vector_pos, fltp04& value) const override { value = String(&TableColumnBuffer<String>::pullValue(index)[vector_pos]).getAs<fltp04>(); };
978 void get(uint04 index, uint04 vector_pos, fltp08& value) const override { value = String(&TableColumnBuffer<String>::pullValue(index)[vector_pos]).getAs<fltp08>(); };
979 void get(uint04 index, uint04 vector_pos, String& value) const override { value = String(&TableColumnBuffer<String>::pullValue(index)[vector_pos]); };
980
981 void get(uint04 index, bool& value) const override { value = TableColumnBuffer<String>::pullValue(index).getAs<bool>(); };
982 void get(uint04 index, uint01& value) const override { value = TableColumnBuffer<String>::pullValue(index).getAs<uint01>(); };
983 void get(uint04 index, uint02& value) const override { value = TableColumnBuffer<String>::pullValue(index).getAs<uint02>(); };
984 void get(uint04 index, uint04& value) const override { value = TableColumnBuffer<String>::pullValue(index).getAs<uint04>(); };
985 void get(uint04 index, uint08& value) const override { value = TableColumnBuffer<String>::pullValue(index).getAs<uint08>(); };
986 void get(uint04 index, sint01& value) const override { value = TableColumnBuffer<String>::pullValue(index).getAs<sint01>(); };
987 void get(uint04 index, sint02& value) const override { value = TableColumnBuffer<String>::pullValue(index).getAs<sint02>(); };
988 void get(uint04 index, sint04& value) const override { value = TableColumnBuffer<String>::pullValue(index).getAs<sint04>(); };
989 void get(uint04 index, sint08& value) const override { value = TableColumnBuffer<String>::pullValue(index).getAs<sint08>(); };
990 void get(uint04 index, fltp04& value) const override { value = TableColumnBuffer<String>::pullValue(index).getAs<fltp04>(); };
991 void get(uint04 index, fltp08& value) const override { value = TableColumnBuffer<String>::pullValue(index).getAs<fltp08>(); };
992 void get(uint04 index, String& value) const override { value = TableColumnBuffer<String>::pullValue(index); };
993 void get(uint04 index, RGBColor& value) const override { value = TableColumnBuffer<String>::pullValue(index).getAs<RGBColor>(); };
994
995 TableColumnString* getSelected(const Buffer<bool>& selected_indices) const override { UNUSED(selected_indices); return nullptr; };
996 virtual void insertIndices(uint04 location, uint04 size) override
997 {
998 Bounds<1, uint04> update_range = Constant<Bounds<1, uint04>>::Min;
999 for (uint04 i = 1; i < m_buffer.size(); i++)
1000 {
1001 uint04 value = m_buffer[i].getAs<uint04>();
1002 if (!IsInvalid(value) && value >= location)
1003 {
1004 m_buffer[i] = String(value + size);
1005 update_range.addToBounds(i);
1006 }
1007 }
1008 if (update_range != Constant<Bounds<1, uint04>>::Min)
1009 {
1010 update_range -= 1U;
1011 m_changes.add(TableChange(TableChange::e_update, update_range[MIN], update_range.span()));
1012 m_modified_time = Time::SystemTime();
1013 }
1014 }
1015 uint08 tableHash() const override
1016 {
1017 uint08 result = 2166136261U;
1018 for (const String& s : m_buffer)
1019 result = (127 * result) ^ s.hash();
1020 return result;
1021 }
1022 virtual void removeIndices(uint04 location, uint04 size) override
1023 {
1024 if (size == 0)
1025 return;
1026 Bounds<1, uint04> update_range = Constant<Bounds<1, uint04>>::Min;
1027 for (uint04 i = 1; i < m_buffer.size(); i++)
1028 {
1029 uint04 value = m_buffer[i].getAs<uint04>();
1030 if (!IsInvalid(value) && value > location)
1031 {
1032 if (value < location + size)
1033 m_buffer[i] = "NaN";
1034 else
1035 m_buffer[i] = String(value -= size);
1036 update_range.addToBounds(i);
1037 }
1038 }
1039 if (update_range != Constant<Bounds<1, uint04>>::Min)
1040 {
1041 update_range -= 1U;
1042 m_changes.add(TableChange(TableChange::e_update, update_range[MIN], update_range.span()));
1043 m_modified_time = Time::SystemTime();
1044 }
1045 }
1046 virtual void removeIndices(const Buffer<uint04>& offset_lookup_list) override
1047 {
1048 UNUSED(offset_lookup_list);
1049 lib_assert(false, "Not yet implemented");
1050 }
1051
1052 virtual void mapFromFile(BinaryFile& file, uint08 version_number) override
1053 {
1054 if (version_number >= 1614203273)//versions <= 1539350691 had error in default value, so ignore
1055 {
1056 if (version_number > 1614739690 && m_compression_object.compression_mode != e_default_compression && m_compression_object.compression_mode != e_string_reference && m_compression_object.compression_mode != e_string_compression)
1057 {
1058 TableColumnBuffer<String>::mapFromFile(file, version_number);
1059 }
1060 else
1061 {
1062 bool allow_multithreading = false;
1063 file.readStringBuffer(m_buffer, allow_multithreading);
1064 }
1065 }
1066 else
1067 {
1068 TableColumnBuffer<String>::mapFromFile(file, version_number);
1069 }
1070 }
1071 void setRowSize(uint04 index, uint04 size) override { m_buffer[index + 1].setSize(size); }
1072 [[nodiscard]] uint04 getRowSize(uint04 index) const override { return m_buffer[index + 1].size(); }
1073 [[nodiscard]] bool isSame(uint04 index, const String& value) const override { return value == m_buffer[index + 1];}
1074 [[nodiscard]] bool isSame(uint04 index, const char* value) const override { return value == m_buffer[index + 1]; }
1075 [[nodiscard]] bool contains(uint04 index, const String& value, bool ignore_case) const final override { return pullValue(index).hasSubString(value, ignore_case); }
1076 [[nodiscard]] bool contains(uint04 index, const char* value, bool ignore_case) const final override { return pullValue(index).hasSubString(value, ignore_case); }
1077 [[nodiscard]] bool beginsWith(uint04 index, const String& value, bool ignore_case) const final override { return pullValue(index).beginsWith(value, ignore_case); }
1078 [[nodiscard]] bool beginsWith(uint04 index, const char* value, bool ignore_case) const final override { return pullValue(index).beginsWith(value, ignore_case); }
1079 };
1080
1081 /**--------------------------------------------------------------------------------------------------
1082 \brief A TableColumnBuffer of Colors
1083 Allows for virtual memory access with the caller not needing to know how the data itself is stored.
1084 **/
1086 {
1087 public:
1094 private:
1095 void set(uint04 index, uint04 vector_pos, bool value) override { RGBColor color(TableColumnBuffer<RGBColor>::pullValue(index)); color[cast<uint01>(vector_pos)] = value ? 255 : 0; TableColumnBuffer<RGBColor>::pullValue(index) = color; };
1096 void set(uint04 index, uint04 vector_pos, uint01 value) override { RGBColor color(TableColumnBuffer<RGBColor>::pullValue(index)); color[cast<uint01>(vector_pos)] = cast<uint01>(value); TableColumnBuffer<RGBColor>::pullValue(index) = color; };
1097 void set(uint04 index, uint04 vector_pos, uint02 value) override { RGBColor color(TableColumnBuffer<RGBColor>::pullValue(index)); color[cast<uint01>(vector_pos)] = cast<uint01>(value); TableColumnBuffer<RGBColor>::pullValue(index) = color; };
1098 void set(uint04 index, uint04 vector_pos, uint04 value) override { RGBColor color(TableColumnBuffer<RGBColor>::pullValue(index)); color[cast<uint01>(vector_pos)] = cast<uint01>(value); TableColumnBuffer<RGBColor>::pullValue(index) = color; };
1099 void set(uint04 index, uint04 vector_pos, uint08 value) override { RGBColor color(TableColumnBuffer<RGBColor>::pullValue(index)); color[cast<uint01>(vector_pos)] = cast<uint01>(value); TableColumnBuffer<RGBColor>::pullValue(index) = color; };
1100 void set(uint04 index, uint04 vector_pos, sint01 value) override { RGBColor color(TableColumnBuffer<RGBColor>::pullValue(index)); color[cast<uint01>(vector_pos)] = cast<uint01>(value); TableColumnBuffer<RGBColor>::pullValue(index) = color; };
1101 void set(uint04 index, uint04 vector_pos, sint02 value) override { RGBColor color(TableColumnBuffer<RGBColor>::pullValue(index)); color[cast<uint01>(vector_pos)] = cast<uint01>(value); TableColumnBuffer<RGBColor>::pullValue(index) = color; };
1102 void set(uint04 index, uint04 vector_pos, sint04 value) override { RGBColor color(TableColumnBuffer<RGBColor>::pullValue(index)); color[cast<uint01>(vector_pos)] = cast<uint01>(value); TableColumnBuffer<RGBColor>::pullValue(index) = color; };
1103 void set(uint04 index, uint04 vector_pos, sint08 value) override { RGBColor color(TableColumnBuffer<RGBColor>::pullValue(index)); color[cast<uint01>(vector_pos)] = cast<uint01>(value); TableColumnBuffer<RGBColor>::pullValue(index) = color; };
1104 void set(uint04 index, uint04 vector_pos, fltp04 value) override { RGBColor color(TableColumnBuffer<RGBColor>::pullValue(index)); color[cast<uint01>(vector_pos)] = cast<uint01>(value * 255); TableColumnBuffer<RGBColor>::pullValue(index) = color; };
1105 void set(uint04 index, uint04 vector_pos, fltp08 value) override { RGBColor color(TableColumnBuffer<RGBColor>::pullValue(index)); color[cast<uint01>(vector_pos)] = cast<uint01>(value * 255); TableColumnBuffer<RGBColor>::pullValue(index) = color; };
1106 void set(uint04 index, uint04 vector_pos, const String& value) override { set(index, vector_pos, value.getAs<uint01>()); };
1107
1108 void set(uint04 index, bool value) override { TableColumnBuffer<RGBColor>::pullValue(index) = value ? RGBColor(255, 255, 255) : RGBColor(0, 0, 0); };
1109 void set(uint04 index, uint02 value) override { TableColumnBuffer<RGBColor>::pullValue(index) = RGBColor(value); };
1110 void set(uint04 index, uint01 value) override { TableColumnBuffer<RGBColor>::pullValue(index) = RGBColor(cast<uint04>(value)); };
1111 void set(uint04 index, sint02 value) override { TableColumnBuffer<RGBColor>::pullValue(index) = RGBColor(value); };
1112 void set(uint04 index, sint01 value) override { TableColumnBuffer<RGBColor>::pullValue(index) = RGBColor(cast<uint04>(value)); };
1113 void set(uint04 index, uint04 value) override { TableColumnBuffer<RGBColor>::pullValue(index) = RGBColor(value); };
1114 void set(uint04 index, uint08 value) override { TableColumnBuffer<RGBColor>::pullValue(index) = RGBColor(cast<uint04>(value)); };
1115 void set(uint04 index, sint04 value) override { TableColumnBuffer<RGBColor>::pullValue(index) = RGBColor(cast<uint04>(value)); };
1116 void set(uint04 index, sint08 value) override { TableColumnBuffer<RGBColor>::pullValue(index) = RGBColor(cast<uint04>(value)); };
1117 void set(uint04 index, fltp04 value) override { TableColumnBuffer<RGBColor>::pullValue(index) = RGBColor(value, value, value); };
1118 void set(uint04 index, fltp08 value) override { TableColumnBuffer<RGBColor>::pullValue(index) = RGBColor(value, value, value); };
1119 void set(uint04 index, const String& value) override { TableColumnBuffer<RGBColor>::pullValue(index) = value.getAs<RGBColor>(); };
1120 void set(uint04 index, RGBColor value) override { TableColumnBuffer<RGBColor>::pullValue(index) = value; };
1121
1122 void get(uint04 index, uint04 vector_pos, bool& value) const override { value = cast<bool>(TableColumnBuffer<RGBColor>::pullValue(index)[cast<uint01>(vector_pos)]); };
1123 void get(uint04 index, uint04 vector_pos, uint01& value) const override { value = cast<uint01>(TableColumnBuffer<RGBColor>::pullValue(index)[cast<uint01>(vector_pos)]); };
1124 void get(uint04 index, uint04 vector_pos, uint02& value) const override { value = cast<uint02>(TableColumnBuffer<RGBColor>::pullValue(index)[cast<uint01>(vector_pos)]); };
1125 void get(uint04 index, uint04 vector_pos, uint04& value) const override { value = cast<uint04>(TableColumnBuffer<RGBColor>::pullValue(index)[cast<uint01>(vector_pos)]); };
1126 void get(uint04 index, uint04 vector_pos, uint08& value) const override { value = cast<uint08>(TableColumnBuffer<RGBColor>::pullValue(index)[cast<uint01>(vector_pos)]); };
1127 void get(uint04 index, uint04 vector_pos, sint01& value) const override { value = cast<sint01>(TableColumnBuffer<RGBColor>::pullValue(index)[cast<uint01>(vector_pos)]); };
1128 void get(uint04 index, uint04 vector_pos, sint02& value) const override { value = cast<sint02>(TableColumnBuffer<RGBColor>::pullValue(index)[cast<uint01>(vector_pos)]); };
1129 void get(uint04 index, uint04 vector_pos, sint04& value) const override { value = cast<sint04>(TableColumnBuffer<RGBColor>::pullValue(index)[cast<uint01>(vector_pos)]); };
1130 void get(uint04 index, uint04 vector_pos, sint08& value) const override { value = cast<sint08>(TableColumnBuffer<RGBColor>::pullValue(index)[cast<uint01>(vector_pos)]); };
1131 void get(uint04 index, uint04 vector_pos, fltp04& value) const override { value = TableColumnBuffer<RGBColor>::pullValue(index).getF(cast<uint01>(vector_pos)); };
1132 void get(uint04 index, uint04 vector_pos, fltp08& value) const override { value = TableColumnBuffer<RGBColor>::pullValue(index).getF(cast<uint01>(vector_pos)); };
1133 void get(uint04 index, uint04 vector_pos, String& value) const override { value = String(TableColumnBuffer<RGBColor>::pullValue(index)[cast<uint01>(vector_pos)]); };
1134
1135 void get(uint04 index, bool& value) const override { value = TableColumnBuffer<RGBColor>::pullValue(index).convertToRGBA32BitColor() == 0; };
1136 void get(uint04 index, sint01& value) const override { value = cast<sint01>(TableColumnBuffer<RGBColor>::pullValue(index).convertToRGBA32BitColor()); lib_assert(false, "unexpected conversion"); };
1137 void get(uint04 index, sint02& value) const override { value = cast<sint02>(TableColumnBuffer<RGBColor>::pullValue(index).convertToRGBA32BitColor()); lib_assert(false, "unexpected conversion"); };
1138 void get(uint04 index, uint01& value) const override { value = cast<uint01>(TableColumnBuffer<RGBColor>::pullValue(index).convertToRGBA32BitColor()); lib_assert(false, "unexpected conversion"); };
1139 void get(uint04 index, uint02& value) const override { value = cast<uint02>(TableColumnBuffer<RGBColor>::pullValue(index).convertToRGBA32BitColor()); lib_assert(false, "unexpected conversion"); };
1140 void get(uint04 index, uint04& value) const override { value = TableColumnBuffer<RGBColor>::pullValue(index).convertToRGBA32BitColor(); };
1141 void get(uint04 index, uint08& value) const override { value = TableColumnBuffer<RGBColor>::pullValue(index).convertToRGBA32BitColor(); };
1142 void get(uint04 index, sint04& value) const override { value = rcast<sint04>(TableColumnBuffer<RGBColor>::pullValue(index).convertToRGBA32BitColor()); };
1143 void get(uint04 index, sint08& value) const override { value = cast<sint08>(TableColumnBuffer<RGBColor>::pullValue(index).convertToRGBA32BitColor()); };
1144 void get(uint04 index, fltp04& value) const override { value = TableColumnBuffer<RGBColor>::pullValue(index).luminance(); };
1145 void get(uint04 index, fltp08& value) const override { value = TableColumnBuffer<RGBColor>::pullValue(index).luminance(); };
1146 void get(uint04 index, String& value) const override { value = String(TableColumnBuffer<RGBColor>::pullValue(index)); };
1147 void get(uint04 index, RGBColor& value) const override { value = TableColumnBuffer<RGBColor>::pullValue(index); };
1148 void insertIndices(uint04 location, uint04 size) override { UNUSED(location); UNUSED(size); lib_assert(false, "Insert indices not implemented for color channel"); }
1149 void removeIndices(uint04 location, uint04 size) override { UNUSED(location); UNUSED(size); lib_assert(false, "Remove indices not implemented for color channel"); }
1150 void removeIndices(const Buffer<uint04>& offset_lookup_list) override { UNUSED(offset_lookup_list); lib_assert(false, "Remove indices not implemented for color channel"); }
1151 TableColumnColorType* getSelected(const Buffer<bool>& selected_indices) const override
1152 {
1154 new_vector_array->setSize(selected_indices.count(true));
1155 uint04 current_index = 1;
1156 for (uint04 i = 0; i < selected_indices.size(); i++)
1157 {
1158 if (selected_indices[i])
1159 {
1160 new_vector_array->m_buffer[current_index++] = TableColumnBuffer<RGBColor>::m_buffer[i + 1];
1161 }
1162 }
1163 return new_vector_array;
1164 }
1165 };
1166}
1167#if __clang__
1168 #pragma clang diagnostic pop
1169#endif
#define UNUSED(expr)
Definition BaseValues.hpp:409
#define NDEVR_DATABASE_API
Definition DLLInfo.h:50
#define lib_assert(expression, message)
Definition LibAssert.h:61
Logic for reading or writing to a binary file including logic for.
Definition BinaryFile.h:59
void seek(uint08 location)
Definition BinaryFile.h:475
void readNow(Buffer< t_type, t_index_type, t_memory_allocator, t_memory_manager > &data)
Definition BinaryFile.h:335
uint08 position()
Definition BinaryFile.h:455
t_type read()
Definition BinaryFile.h:233
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
constexpr t_index_type size() const
Definition Buffer.hpp:823
static std::enable_if<!ObjectInfo< t_type >::Buffer >::type Compress(BinaryCompressionObject &object, Buffer< uint01 > &compression_data, const Buffer< t_type, t_index_type, t_memory_allocator, t_memory_manager > &data)
Definition Compressor.h:117
Definition Matrix.hpp:176
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:54
The core String class for the NDEVR API.
Definition String.h:69
t_type getAs() const
Converts a string into an object. To use this function an object must have overwritten StringStream<t...
Definition String.h:143
A base class for a Table column with N-number of rows held in a Buffer object. Allows for virtual mem...
Definition TableColumnType.h:53
decltype(auto) pullValue(uint04 index)
Definition TableColumnType.h:230
Buffer< t_type > m_buffer
Definition TableColumnType.h:246
void setSize(uint04 size) override
Definition TableColumnType.h:94
decltype(auto) pullValue(uint04 index) const
Definition TableColumnType.h:234
TableColumnBuffer(const String &label, const TypeInfo type)
Definition TableColumnType.h:56
decltype(auto) defaultValue()
Definition TableColumnType.h:238
TableColumnBuffer(const String &label, const TypeInfo type, const t_type &default_value)
Definition TableColumnType.h:61
Buffer< uint01 > m_compressed_data
Definition TableColumnType.h:247
virtual void mapFromFile(BinaryFile &file, uint08 version_number) override
Definition TableColumnType.h:72
decltype(auto) defaultValue() const
Definition TableColumnType.h:242
TableColumnBuffer(const Buffer< t_type > &buffer, const String &label, const TypeInfo type)
Definition TableColumnType.h:66
A TableColumnBuffer of Colors Allows for virtual memory access with the caller not needing to know ho...
Definition TableColumnType.h:1086
TableColumnColorType(const Buffer< RGBColor > &buffer, const String &label)
Definition TableColumnType.h:1091
TableColumnColorType(const String &label)
Definition TableColumnType.h:1088
A virtual storage type that is used with Table class to store data where the actual mechanism for sto...
Definition TableColumn.h:76
bool m_compression_valid
Definition TableColumn.h:621
Time m_modified_time
Definition TableColumn.h:615
CompressionMode m_compression_mode
Definition TableColumn.h:620
BinaryCompressionObject m_compression_object
Definition TableColumn.h:614
const String & label() const
virtual TypeInfo type() const
Definition TableColumn.h:86
Buffer< TableChange > m_changes
Definition TableColumn.h:619
A TableColumnBuffer of Strings Allows for virtual memory access with the caller not needing to know h...
Definition TableColumnType.h:933
TableColumnString(const String &label)
Definition TableColumnType.h:935
A TableColumnBuffer of buffers. Meaning each row has some potentially unique N-number of columns Allo...
Definition TableColumnType.h:735
TableColumnTypeBuffer(const String &label)
Definition TableColumnType.h:737
A TableColumnBuffer column of Matrices Allows for virtual memory access with the caller not needing t...
Definition TableColumnType.h:453
TableMatrixType(const String &label)
Definition TableColumnType.h:455
TableVectorType(const String &label)
Definition TableColumnType.h:687
TableVectorType(const String &label, const TypeInfo type)
Definition TableColumnType.h:690
TableVectorType(const String &label)
Definition TableColumnType.h:500
TableVectorType(const Buffer< bool > &buffer, const String &label)
Definition TableColumnType.h:504
A TableColumnBuffer that also has some number of defined rows stored in a Vector object Allows for vi...
Definition TableColumnType.h:256
TableVectorType(const String &label)
Definition TableColumnType.h:258
TableVectorType(const Buffer< Vector< t_dims, t_type > > &buffer, const String &label)
Definition TableColumnType.h:262
static Time SystemTime()
Retrieves the current system time.
Stores information about a type, relevant for certain templated functions. To get information about a...
Definition TypeInfo.h:43
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:60
A fixed-size array with better performance compared to dynamic containers.
Definition Vector.hpp:60
Definition ACIColor.h:37
int32_t sint04
-Defines an alias representing a 4 byte, signed integer. -Can represent exact integer values -2147483...
Definition BaseValues.hpp:64
constexpr bool IsInvalid(const t_type &value)
Query if 'value' is valid or invalid. Invalid values should return invalid if used for calculations o...
Definition BaseFunctions.hpp:170
constexpr std::enable_if<!ObjectInfo< t_type >::Buffer, TypeInfo >::type GetTypeInfo()
Definition TypeInfo.h:103
int64_t sint08
-Defines an alias representing an 8 byte, signed integer -Can represent exact integer values -9223372...
Definition BaseValues.hpp:71
@ MIN
Definition BaseValues.hpp:196
float fltp04
Defines an alias representing a 4 byte floating-point number Bit layout is as follows: -Sign: 1 bit a...
Definition BaseValues.hpp:127
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:80
int8_t sint01
-Defines an alias representing a 1 byte, signed integer. -Can represent exact integer values -127 thr...
Definition BaseValues.hpp:50
constexpr t_to rcast(t_from value)
Casts the given value. Is equivalent to reinterpret_cast except allows for the option of special case...
Definition BaseValues.hpp:403
CompressionMode
Logical information about the type of compression implemented or requested.
Definition Compressor.h:16
@ e_default_compression
Definition Compressor.h:18
int16_t sint02
-Defines an alias representing a 2 byte, signed integer. -Can represent exact integer values -32767 t...
Definition BaseValues.hpp:57
uint64_t uint08
-Defines an alias representing an 8 byte, unsigned integer
Definition BaseValues.hpp:106
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96
constexpr t_to cast(const Angle< t_from > &value)
Definition Angle.h:375
uint16_t uint02
-Defines an alias representing a 2 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:88
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:149
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Definition BaseValues.hpp:233
static const t_type Invalid
Definition BaseValues.hpp:234
@ e_update
Definition TableColumn.h:56