aboutsummaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-06-26 15:44:26 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-06-26 15:44:26 +0200
commitee5d161f6153e1f9da73e477f63f38dcf52ca10c (patch)
tree926413950f64ed7b0f45f6b3551c16446ecd08d4 /shared
parentc77d271d9cb86bf6893098ec6c431fc87945e6c9 (diff)
`make format`
Diffstat (limited to 'shared')
-rw-r--r--shared/FSM.h60
1 files changed, 30 insertions, 30 deletions
diff --git a/shared/FSM.h b/shared/FSM.h
index 792a44f..db1de07 100644
--- a/shared/FSM.h
+++ b/shared/FSM.h
@@ -13,38 +13,38 @@
/// class.</typeparam>
template <class TState> class FSM {
public:
- template <class... TPState> FSM(TPState &...args) {
- int i = 0;
-
- ((void)_states.emplace(i++, args), ...);
- }
-
- /// <summary>
- /// Implement with FSM::act()
- /// </summary>
- void act();
-
- /// <summary>
- /// Used to check current state.
- /// </summary>
- /// <returns>Current state.</returns>
- std::shared_ptr<TState> &get_state() { return _currentState; }
-
- /// <summary>
- /// Used to get all states.
- /// </summary>
- /// <returns>Current states.</returns>
- std::map<int, std::shared_ptr<TState>> get_states();
-
- /// <summary>
- /// Sets current state, calls appropiate functions.
- /// </summary>
- /// <param name="">State to transition into.</param>
- void set_state(std::shared_ptr<TState>);
+ template <class... TPState> FSM(TPState &... args) {
+ int i = 0;
+
+ ((void) _states.emplace(i++, args), ...);
+ }
+
+ /// <summary>
+ /// Implement with FSM::act()
+ /// </summary>
+ void act();
+
+ /// <summary>
+ /// Used to check current state.
+ /// </summary>
+ /// <returns>Current state.</returns>
+ std::shared_ptr<TState> & get_state() { return _currentState; }
+
+ /// <summary>
+ /// Used to get all states.
+ /// </summary>
+ /// <returns>Current states.</returns>
+ std::map<int, std::shared_ptr<TState>> get_states();
+
+ /// <summary>
+ /// Sets current state, calls appropiate functions.
+ /// </summary>
+ /// <param name="">State to transition into.</param>
+ void set_state(std::shared_ptr<TState>);
private:
- std::map<int, std::shared_ptr<TState>> _states;
- std::shared_ptr<TState> _currentState;
+ std::map<int, std::shared_ptr<TState>> _states;
+ std::shared_ptr<TState> _currentState;
};
#endif // _FSM_H_ \ No newline at end of file