rad  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StateMachine.h
Go to the documentation of this file.
1 /*
2  * scampl4cpp/engine
3  *
4  * Copyright by European Southern Observatory, 2012
5  * All rights reserved
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20  * 02111-1307 USA.
21  */
22 
23 /*
24  * $Id: StateMachine.h 1061 2015-07-13 15:03:59Z landolfa $
25  */
26 
27 #ifndef SCXML4CPP_STATEMACHINE_H
28 #define SCXML4CPP_STATEMACHINE_H
29 
30 #ifndef __cplusplus
31 #error This is a C++ include file and cannot be used from plain C
32 #endif
33 
34 #include <string>
35 #include <list>
36 
37 namespace scxml4cpp {
38 
39 class Transition;
40 class State;
41 class Helper;
42 class Action;
43 
44 class StateMachine
45 {
46  public:
47  StateMachine();
48  virtual ~StateMachine();
49 
50  const std::string& getId() const;
51  std::list<Transition*>& getInitialTrans();
52  std::list<State*>& getSubstates();
53  std::list<State*>& getParallel();
54 
55  void setId(const std::string& id);
56  void setInitialState(State*, Action*);
57  void setFinalState(State*);
58  void setSubstates(std::list<State*>& substates);
59  void setParallel(std::list<State*>& parallel);
60 
61  void addSubstate(State* s);
62  void addParallel(State* s);
63 
64  void reset();
65  bool isEmpty();
66 
67  private:
68  std::string mId;
69  std::list<Transition*> mInitialTrans;
70  std::list<State*> mSubstates;
71  std::list<State*> mParallel;
72 
73  StateMachine(const StateMachine&);
74  StateMachine& operator= (const StateMachine&);
75 
76 };
77 
78 } // namespace scxml4cpp
79 
80 #endif // SCXML4CPP_STATEMACHINE_H
void setSubstates(std::list< State * > &substates)
Definition: StateMachine.cpp:142
void setFinalState(State *)
Definition: StateMachine.cpp:135
std::list< State * > & getParallel()
Definition: StateMachine.cpp:110
void setParallel(std::list< State * > &parallel)
Definition: StateMachine.cpp:148
std::list< Transition * > & getInitialTrans()
Definition: StateMachine.cpp:98
void addSubstate(State *s)
Definition: StateMachine.cpp:154
std::list< State * > & getSubstates()
Definition: StateMachine.cpp:104
const std::string & getId() const
Definition: StateMachine.cpp:92
void setId(const std::string &id)
Definition: StateMachine.cpp:116
virtual ~StateMachine()
Definition: StateMachine.cpp:44
void addParallel(State *s)
Definition: StateMachine.cpp:168
void reset()
Definition: StateMachine.cpp:50
bool isEmpty()
Definition: StateMachine.cpp:79
void setInitialState(State *, Action *)
Definition: StateMachine.cpp:122
StateMachine()
Definition: StateMachine.cpp:39