galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
State.hpp
Go to the documentation of this file.
1
7
8#ifndef GALAXY_STATE_STATE_HPP_
9#define GALAXY_STATE_STATE_HPP_
10
11#include <string>
12
13namespace galaxy
14{
18 class State
19 {
20 public:
24 State(State&&) = default;
25
29 State& operator=(State&&) = default;
30
34 State(const State&) = default;
35
39 State& operator=(const State&) = default;
40
44 virtual ~State() = default;
45
49 virtual void on_push() = 0;
50
54 virtual void on_pop() = 0;
55
61 [[nodiscard]]
62 const std::string& name() const noexcept;
63
64 protected:
70 State(const std::string& name) noexcept;
71
72 protected:
76 std::string m_name;
77
78 private:
82 State() = delete;
83 };
84} // namespace galaxy
85
86#endif
A state to use in a finite state machine.
Definition State.hpp:19
State & operator=(const State &)=default
Copy assignment operator.
State(const State &)=default
Copy constructor.
virtual void on_push()=0
Triggered when state is pushed onto the stack.
virtual ~State()=default
Virtual destructor.
virtual void on_pop()=0
Triggered when state is popped off the stack.
const std::string & name() const noexcept
Get state name.
Definition State.cpp:17
State(State &&)=default
Move constructor.
State & operator=(State &&)=default
Move assignment operator.
std::string m_name
Name for debug purposes.
Definition State.hpp:76
Animated.cpp galaxy.
Definition Animated.cpp:16
STL namespace.