This library is designed to create and run state graphs. It supports hierarchical states and the parallel execution
Diff: StateMachineLib/Transitions.h
- Revision:
- 0:f4fdca2c4c67
diff -r 000000000000 -r f4fdca2c4c67 StateMachineLib/Transitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/StateMachineLib/Transitions.h Tue Oct 03 08:29:22 2017 +0000 @@ -0,0 +1,52 @@ +//////////////////////////////////////////////////////////////////////////////// +// Copyright Rottor SAS 2017 +// All rigths reserved. +// +// File Name : Transitions.h +// Authors : Martin Matignon +// +// If you find any bug or if you have any question please contact +// Martin Matignon <martin.matignon@rottor.fr> +// Nicolas Forestier <nicolas.forestier@rottor.fr> +// +//////////////////////////////////////////////////////////////////////////////// + +#ifndef __SM_TRANSITIONS_H__ +#define __SM_TRANSITIONS_H__ + +#include <string> +#include "State.h" + +class Transitions{ + +public: + + typedef struct Transition_t{ + + const char *outcome; + const char *_exit_; + State *target; + Transition_t *next; + + Transition_t(const char* _outcome, State* _target, const char* _exit=NULL); + + }Transition_t; + + Transitions(); + + Transitions* addTransition(const char* outcome, State* target); + + Transitions* addTransition(Transition_t *transition); + + Transition_t* getTransition(const char* outcome); + + State* getTargetState(const char* outcome); + + void printList(string level=""); + +private: + Transition_t *m_transitionsList; +}; + + +#endif /* #ifndef __SM_TRANSITIONS_H__*/ \ No newline at end of file