rad  5.1.0
StateMachine.h
Go to the documentation of this file.
1 
10 /*
11  * scampl4cpp/engine
12  *
13  * Copyright by European Southern Observatory, 2012
14  * All rights reserved
15  *
16  * This library is free software; you can redistribute it and/or
17  * modify it under the terms of the GNU Lesser General Public
18  * License as published by the Free Software Foundation; either
19  * version 2.1 of the License, or (at your option) any later version.
20  *
21  * This library is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24  * Lesser General Public License for more details.
25  *
26  * You should have received a copy of the GNU Lesser General Public
27  * License along with this library; if not, write to the Free Software
28  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
29  * 02111-1307 USA.
30  */
31 
32 #ifndef SCXML4CPP_STATEMACHINE_H
33 #define SCXML4CPP_STATEMACHINE_H
34 
35 #ifndef __cplusplus
36 #error This is a C++ include file and cannot be used from plain C
37 #endif
38 
39 #include <string>
40 #include <list>
41 
42 namespace scxml4cpp {
43 
44 class Transition;
45 class State;
46 class Helper;
47 class Action;
48 
64 {
65  public:
69  StateMachine();
70 
76  virtual ~StateMachine();
77 
81  const std::string& getId() const;
82 
87  std::list<Transition*>& getInitialTrans();
88 
92  std::list<State*>& getSubstates();
93 
97  std::list<State*>& getParallel();
98 
104  void setId(const std::string& id);
105 
114  void setInitialState(State* initialState, Action* a);
115 
121  void setFinalState(State* finalState);
122 
128  void setSubstates(std::list<State*>& substates);
129 
135  void setParallel(std::list<State*>& parallel);
136 
142  void addSubstate(State* s);
143 
149  void addParallel(State* s);
150 
157  void reset();
158 
164  bool isEmpty();
165 
166  private:
167  std::string mId;
168  std::list<Transition*> mInitialTrans;
169  std::list<State*> mSubstates;
170  std::list<State*> mParallel;
171 
172  StateMachine(const StateMachine&);
173  StateMachine& operator= (const StateMachine&);
174 };
175 
176 } // namespace scxml4cpp
177 
178 #endif // SCXML4CPP_STATEMACHINE_H
Definition: Action.h:66
Definition: StateMachine.h:64
void setId(const std::string &id)
Definition: StateMachine.cpp:121
StateMachine()
Definition: StateMachine.cpp:44
void setFinalState(State *finalState)
Definition: StateMachine.cpp:140
std::list< State * > & getParallel()
Definition: StateMachine.cpp:115
void addParallel(State *s)
Definition: StateMachine.cpp:173
void setInitialState(State *initialState, Action *a)
Definition: StateMachine.cpp:127
const std::string & getId() const
Definition: StateMachine.cpp:97
void addSubstate(State *s)
Definition: StateMachine.cpp:159
virtual ~StateMachine()
Definition: StateMachine.cpp:49
std::list< Transition * > & getInitialTrans()
Definition: StateMachine.cpp:103
void reset()
Definition: StateMachine.cpp:55
std::list< State * > & getSubstates()
Definition: StateMachine.cpp:109
void setSubstates(std::list< State * > &substates)
Definition: StateMachine.cpp:147
void setParallel(std::list< State * > &parallel)
Definition: StateMachine.cpp:153
bool isEmpty()
Definition: StateMachine.cpp:84
Definition: State.h:60
Definition: Action.h:40