NeuralEngine
A Game Engine with embeded Machine Learning algorithms based on Gaussian Processes.
NeArray4.h
1
11#pragma once
12
13#include <NeCoreLib.h>
14#include <cstddef>
15#include <vector>
16
17namespace NeuralEngine
18{
19
20 template <typename T>
21
30 class Array4
31 {
32 public:
33
50 Array4(size_t bound0, size_t bound1, size_t bound2, size_t bound3);
51
69 Array4(size_t bound0, size_t bound1, size_t bound2, size_t bound3, T* objects);
70
71
83 Array4();
84 Array4(Array4 const&);
85 Array4& operator=(Array4 const&);
86 Array4(Array4&&);
87 Array4& operator=(Array4&&);
88
89 // Access to the array. Sample usage is
90 // Array4<T> myArray(5, 4, 3, 2);
91 // T*** cuboid1 = myArray[1];
92 // T** cuboid1Slice2 = myArray[1][2];
93 // T* cuboid1Slice2Row3 = myArray[1][2][3];
94 // T cuboid1Slice2Row3Col4 = myArray[1][2][3][4];
95 inline size_t GetBound0() const;
96 inline size_t GetBound1() const;
97 inline size_t GetBound2() const;
98 inline size_t GetBound3() const;
99 inline T** const* operator[] (int cuboid) const;
100 inline T*** operator[] (int cuboid);
101
102 private:
103 void SetPointers(T* objects);
104 void SetPointers(Array4 const& other);
105
106 size_t mBound0, mBound1, mBound2, mBound3;
107 std::vector<T> mObjects;
108 std::vector<T*> mIndirect1;
109 std::vector<T**> mIndirect2;
110 std::vector<T***> mIndirect3;
111 };
112#include "NeArray4.inl"
113}
The Array4 class represents a 4-dimensional array that minimizes the number of new and delete calls....
Definition: NeArray4.h:31
Array4()
Default constructor.
Definition: NeArray4.inl:41