Browse Source

Started implementation of StateMachine (incomplete)

pcmattulat 4 years ago
parent
commit
10996bc066
5 changed files with 91 additions and 1 deletions
  1. 5 1
      CMakeLists.txt
  2. 13 0
      source/logic/State.cpp
  3. 30 0
      source/logic/State.hpp
  4. 13 0
      source/logic/StateMachine.cpp
  5. 30 0
      source/logic/StateMachine.hpp

+ 5 - 1
CMakeLists.txt

@@ -91,7 +91,11 @@ set(SOURCE_FILES
         ${CMAKE_CURRENT_SOURCE_DIR}/source/serialization/boxing/SerializableJSONDouble.hpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/serialization/boxing/SerializableJSONDouble.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/serialization/boxing/SerializableJSONBoolean.hpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/source/serialization/boxing/SerializableJSONBoolean.cpp)
+        ${CMAKE_CURRENT_SOURCE_DIR}/source/serialization/boxing/SerializableJSONBoolean.cpp
+        ${CMAKE_CURRENT_SOURCE_DIR}/source/logic/StateMachine.hpp
+        ${CMAKE_CURRENT_SOURCE_DIR}/source/logic/StateMachine.cpp
+        ${CMAKE_CURRENT_SOURCE_DIR}/source/logic/State.hpp
+        ${CMAKE_CURRENT_SOURCE_DIR}/source/logic/State.cpp)
 
 set(TEST_FILES
         ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/IntegerTest.cpp

+ 13 - 0
source/logic/State.cpp

@@ -0,0 +1,13 @@
+/*
+ * Author:          Patrick-Christopher Mattulat
+ * Company:         Lynar Studios
+ * E-Mail:          webmaster@lynarstudios.com
+ * Created:         2020-09-05
+ * Changed:         2020-09-05
+ *
+ * */
+
+#include "State.hpp"
+
+ls_std::State::State() : Class("State")
+{}

+ 30 - 0
source/logic/State.hpp

@@ -0,0 +1,30 @@
+/*
+ * Author:          Patrick-Christopher Mattulat
+ * Company:         Lynar Studios
+ * E-Mail:          webmaster@lynarstudios.com
+ * Created:         2020-09-05
+ * Changed:         2020-09-05
+ *
+ * */
+
+#ifndef LS_STD_STATE_HPP
+#define LS_STD_STATE_HPP
+
+#include <memory>
+#include <vector>
+#include "../base/Class.hpp"
+
+namespace ls_std {
+  class State : public Class {
+    public:
+
+      State();
+      ~State() = default;
+
+    private:
+
+      std::vector<std::shared_ptr<State>> connectedStates {};
+  };
+}
+
+#endif

+ 13 - 0
source/logic/StateMachine.cpp

@@ -0,0 +1,13 @@
+/*
+ * Author:          Patrick-Christopher Mattulat
+ * Company:         Lynar Studios
+ * E-Mail:          webmaster@lynarstudios.com
+ * Created:         2020-09-05
+ * Changed:         2020-09-05
+ *
+ * */
+
+#include "StateMachine.hpp"
+
+ls_std::StateMachine::StateMachine() : Class("StateMachine")
+{}

+ 30 - 0
source/logic/StateMachine.hpp

@@ -0,0 +1,30 @@
+/*
+ * Author:          Patrick-Christopher Mattulat
+ * Company:         Lynar Studios
+ * E-Mail:          webmaster@lynarstudios.com
+ * Created:         2020-09-05
+ * Changed:         2020-09-05
+ *
+ * */
+
+#ifndef LS_STD_STATE_MACHINE_HPP
+#define LS_STD_STATE_MACHINE_HPP
+
+#include <memory>
+#include "../base/Class.hpp"
+#include "State.hpp"
+
+namespace ls_std {
+  class StateMachine : public Class {
+    public:
+
+      StateMachine();
+      ~StateMachine() = default;
+
+    private:
+
+      std::shared_ptr<State> currentState {};
+  };
+}
+
+#endif