Browse Source

data structures moved to data

Kajetan Johannes Hammerle 2 years ago
parent
commit
6199c611e4

+ 0 - 0
utils/Array.h → data/Array.h


+ 0 - 0
utils/ArrayList.h → data/ArrayList.h


+ 1 - 1
utils/BitArray.cpp → data/BitArray.cpp

@@ -1,4 +1,4 @@
-#include "utils/BitArray.h"
+#include "data/BitArray.h"
 #include "math/Math.h"
 
 static int roundUpDivide(int a, int b) {

+ 0 - 0
utils/BitArray.h → data/BitArray.h


+ 1 - 2
data/Components.h

@@ -1,8 +1,7 @@
 #ifndef COMPONENTS_H
 #define COMPONENTS_H
 
-#include "utils/HashMap.h"
-#include "utils/List.h"
+#include "data/HashMap.h"
 #include "utils/Types.h"
 
 typedef uint32 Entity;

+ 1 - 2
utils/HashMap.h → data/HashMap.h

@@ -1,9 +1,8 @@
 #ifndef HASHMAP_H
 #define HASHMAP_H
 
+#include "data/List.h"
 #include "math/Math.h"
-#include "utils/Array.h"
-#include "utils/List.h"
 #include "utils/StringBuffer.h"
 #include "utils/Types.h"
 

+ 0 - 0
utils/List.h → data/List.h


+ 1 - 1
utils/RingBuffer.h → data/RingBuffer.h

@@ -1,7 +1,7 @@
 #ifndef RINGBUFFER_H
 #define RINGBUFFER_H
 
-#include "utils/Array.h"
+#include "data/Array.h"
 
 template<typename T, int N>
 class RingBuffer final {

+ 1 - 1
utils/Stack.h → data/Stack.h

@@ -1,7 +1,7 @@
 #ifndef STACK_H
 #define STACK_H
 
-#include "utils/List.h"
+#include "data/List.h"
 
 template<typename T, int N>
 class Stack final {

+ 1 - 1
math/Frustum.h

@@ -1,9 +1,9 @@
 #ifndef FRUSTUM_H
 #define FRUSTUM_H
 
+#include "data/Array.h"
 #include "math/Matrix.h"
 #include "math/Plane.h"
-#include "utils/Array.h"
 #include "utils/StringBuffer.h"
 
 class Frustum final {

+ 1 - 1
math/MatrixStack.h

@@ -1,8 +1,8 @@
 #ifndef MATRIXSTACK_H
 #define MATRIXSTACK_H
 
+#include "data/ArrayList.h"
 #include "math/Matrix.h"
-#include "utils/ArrayList.h"
 
 template<int N>
 class MatrixStack final {

+ 1 - 1
meson.build

@@ -16,7 +16,7 @@ src = [
     'rendering/Texture.cpp',
     'rendering/VertexBuffer.cpp',
     'rendering/Window.cpp',
-    'utils/BitArray.cpp',
+    'data/BitArray.cpp',
     'utils/Buffer.cpp',
     'utils/Clock.cpp',
     'utils/Error.cpp',

+ 1 - 1
network/Server.cpp

@@ -1,8 +1,8 @@
 #include "libs/enet/include/enet.h"
 
+#include "data/HashMap.h"
 #include "network/ENet.h"
 #include "network/Server.h"
-#include "utils/HashMap.h"
 #include "utils/Logger.h"
 
 static_assert(sizeof(enet_uint16) == sizeof(Server::Port),

+ 2 - 2
rendering/Framebuffer.h

@@ -1,10 +1,10 @@
 #ifndef FRAMEBUFFER_H
 #define FRAMEBUFFER_H
 
+#include "data/Array.h"
+#include "data/ArrayList.h"
 #include "math/Vector.h"
 #include "rendering/Texture.h"
-#include "utils/Array.h"
-#include "utils/ArrayList.h"
 
 template<int N>
 class Framebuffer final {

+ 2 - 2
rendering/Shader.h

@@ -1,10 +1,10 @@
 #ifndef SHADER_H
 #define SHADER_H
 
+#include "data/Array.h"
+#include "data/List.h"
 #include "math/Vector.h"
-#include "utils/Array.h"
 #include "utils/Error.h"
-#include "utils/List.h"
 #include "wrapper/GL.h"
 
 class Shader final {

+ 1 - 1
rendering/VertexBuffer.h

@@ -1,7 +1,7 @@
 #ifndef VERTEXBUFFER_H
 #define VERTEXBUFFER_H
 
-#include "utils/ArrayList.h"
+#include "data/ArrayList.h"
 #include "wrapper/GL.h"
 
 class VertexBuffer final {

+ 2 - 2
rendering/Window.cpp

@@ -3,9 +3,9 @@
 #include "GL/glew.h"
 #include "GLFW/glfw3.h"
 
+#include "data/Array.h"
+#include "data/HashMap.h"
 #include "rendering/Window.h"
-#include "utils/Array.h"
-#include "utils/HashMap.h"
 
 static GLFWwindow* window = nullptr;
 static Clock fps;

+ 1 - 1
rendering/Window.h

@@ -1,10 +1,10 @@
 #ifndef WINDOW_H
 #define WINDOW_H
 
+#include "data/List.h"
 #include "math/Vector.h"
 #include "utils/Clock.h"
 #include "utils/Error.h"
-#include "utils/List.h"
 #include "utils/StringBuffer.h"
 
 namespace Window {

+ 1 - 1
tests/ArrayListTests.cpp

@@ -1,6 +1,6 @@
 #include "tests/ArrayListTests.h"
+#include "data/ArrayList.h"
 #include "tests/Test.h"
-#include "utils/ArrayList.h"
 #include "utils/StringBuffer.h"
 
 typedef ArrayList<int, 20> IntList;

+ 1 - 1
tests/ArrayTests.cpp

@@ -1,6 +1,6 @@
 #include "tests/ArrayTests.h"
+#include "data/Array.h"
 #include "tests/Test.h"
-#include "utils/Array.h"
 #include "utils/StringBuffer.h"
 
 typedef StringBuffer<50> String;

+ 10 - 5
tests/BitArrayTests.cpp

@@ -1,6 +1,6 @@
 #include "tests/BitArrayTests.h"
+#include "data/BitArray.h"
 #include "tests/Test.h"
-#include "utils/BitArray.h"
 #include "utils/StringBuffer.h"
 
 typedef StringBuffer<50> String;
@@ -20,7 +20,8 @@ static void testBigSetRead(Test& test) {
         bits.set(i, i);
     }
     for(int i = 0; i < bits.getLength(); i++) {
-        test.checkEqual(i, bits.get(i), "set and read correct value over long array");
+        test.checkEqual(i, bits.get(i),
+                        "set and read correct value over long array");
     }
 }
 
@@ -37,13 +38,16 @@ static void testRandomSetReadResize(Test& test) {
         }
     }
     for(int i = 0; i < bits.getLength(); i++) {
-        test.checkEqual(data[i], bits.get(i), "set and read correct value with random input");
+        test.checkEqual(data[i], bits.get(i),
+                        "set and read correct value with random input");
     }
     bits.resize(bits.getBits() + 1);
     test.checkEqual(14, bits.getBits(), "corrects bits after resize");
     test.checkEqual(100, bits.getLength(), "correct length after resize");
     for(int i = 0; i < bits.getLength(); i++) {
-        test.checkEqual(data[i], bits.get(i), "set and read correct value with random input after resize");
+        test.checkEqual(
+            data[i], bits.get(i),
+            "set and read correct value with random input after resize");
     }
 }
 
@@ -60,7 +64,8 @@ static void testReadOnly(Test& test) {
 static void testToString1(Test& test) {
     BitArray bits(4, 3);
     bits.set(0, 1).set(1, 2).set(2, 3).set(3, 4);
-    test.checkEqual(String("[1, 2, 3, 4]"), String(bits), "bit array to string 1");
+    test.checkEqual(String("[1, 2, 3, 4]"), String(bits),
+                    "bit array to string 1");
 }
 
 static void testToString2(Test& test) {

+ 1 - 1
tests/HashMapTests.cpp

@@ -1,6 +1,6 @@
 #include "tests/HashMapTests.h"
+#include "data/HashMap.h"
 #include "tests/Test.h"
-#include "utils/HashMap.h"
 #include "utils/StringBuffer.h"
 
 typedef HashMap<int, int> IntMap;

+ 1 - 1
tests/ListTests.cpp

@@ -1,6 +1,6 @@
 #include "tests/ListTests.h"
+#include "data/List.h"
 #include "tests/Test.h"
-#include "utils/List.h"
 #include "utils/StringBuffer.h"
 
 typedef List<int> IntList;

+ 3 - 2
tests/RandomTests.cpp

@@ -1,7 +1,7 @@
 #include "tests/RandomTests.h"
+#include "data/Array.h"
 #include "tests/Test.h"
 #include "utils/Random.h"
-#include "utils/Array.h"
 
 static void testAverage(Test& test) {
     Random r(553);
@@ -61,7 +61,8 @@ static void testFloatDistribution(Test& test) {
         c[r.nextFloat(1.0f, c.getLength() - 1)]++;
     }
     test.checkEqual(0, c[0], "float distribution does not underflow");
-    test.checkEqual(0, c[c.getLength() - 1], "float distribution does not overflow");
+    test.checkEqual(0, c[c.getLength() - 1],
+                    "float distribution does not overflow");
     for(int i = 1; i < c.getLength() - 1; i++) {
         test.checkFloat(0.01f, c[i] / 1000000.0f, 0.001f, "float distribution");
     }

+ 1 - 1
tests/RingBufferTests.cpp

@@ -1,6 +1,6 @@
 #include "tests/RingBufferTests.h"
+#include "data/RingBuffer.h"
 #include "tests/Test.h"
-#include "utils/RingBuffer.h"
 
 static void testReadAndWrite(Test& test) {
     RingBuffer<int, 5> buffer;

+ 1 - 1
tests/SplitStringTests.cpp

@@ -1,6 +1,6 @@
 #include "tests/SplitStringTests.h"
+#include "data/List.h"
 #include "tests/Test.h"
-#include "utils/List.h"
 #include "utils/SplitString.h"
 
 typedef StringBuffer<60> String;

+ 1 - 1
tests/StackTests.cpp

@@ -1,6 +1,6 @@
 #include "tests/StackTests.h"
+#include "data/Stack.h"
 #include "tests/Test.h"
-#include "utils/Stack.h"
 #include "utils/StringBuffer.h"
 
 typedef Stack<int, 10> IntStack;

+ 1 - 1
tests/StringBufferTests.cpp

@@ -1,6 +1,6 @@
 #include "tests/StringBufferTests.h"
+#include "data/HashMap.h"
 #include "tests/Test.h"
-#include "utils/HashMap.h"
 #include "utils/StringBuffer.h"
 
 typedef StringBuffer<20> String;

+ 1 - 1
utils/Clock.h

@@ -1,7 +1,7 @@
 #ifndef CLOCK_H
 #define CLOCK_H
 
-#include "utils/Array.h"
+#include "data/Array.h"
 #include "utils/Types.h"
 
 struct Clock final {

+ 1 - 1
utils/SplitString.h

@@ -1,7 +1,7 @@
 #ifndef SPLITSTRING_H
 #define SPLITSTRING_H
 
-#include "utils/List.h"
+#include "data/List.h"
 #include "utils/StringBuffer.h"
 
 template<int N>

+ 1 - 1
wrapper/GL.cpp

@@ -1,7 +1,7 @@
 #include "GL/glew.h"
 #include <type_traits>
 
-#include "utils/Array.h"
+#include "data/Array.h"
 #include "utils/Logger.h"
 #include "wrapper/GL.h"