rad  5.1.0
Transition.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_TRANSITION_H
33 #define SCXML4CPP_TRANSITION_H
34 
35 #ifndef __cplusplus
36 #error This is a C++ include file and cannot be used from plain C
37 #endif
38 
39 #ifndef SCXML4CPP_HELPER_H
40 #include "scxml4cpp/Helper.h"
41 #endif
42 
43 #ifndef SCXML4CPP_EVENT_H
44 #include "scxml4cpp/Event.h"
45 #endif
46 
47 #include <string>
48 #include <list>
49 
50 namespace scxml4cpp
51 {
52 
53 class State;
54 class ExecutableContent;
55 class Action;
56 class Context;
57 class Helper;
58 
68 {
69  public:
77  Transition();
78 
86  virtual ~Transition();
87 
91  State* getSource();
92 
96  const Event& getEvent();
97 
101  std::list<State*>& getTargets();
102 
108  void addTarget(State* s);
109 
116  void addAction(Action* a);
117 
124  void addCondition(Action* c);
125 
131 
137 
141  bool isEnabled(Context* c);
142 
147  bool isEnabled(const Event& e, Context* c);
148 
154  void setSource(State* source);
155 
161  void setTargets(std::list<State*>& targets);
162 
166  void setEvent(const Event& e);
167 
168  private:
169  Event mEvent;
170  ExecutableContent* mConditions;
171  ExecutableContent* mActions;
172  State* mSource;
173  std::list<State*> mTargets;
174  Helper mHelper;
175 
176  Transition(const Transition&);
177  Transition& operator= (const Transition&);
178 };
179 
180 } // namespace scxml4cpp
181 
182 #endif // SCXML4CPP_TRANSITION_H
183 
Event header.
Helper header.
Definition: Action.h:66
Definition: Context.h:58
Definition: Event.h:66
Definition: ExecutableContent.h:57
Definition: Helper.h:57
Definition: State.h:60
Definition: Transition.h:68
void setTargets(std::list< State * > &targets)
Definition: Transition.cpp:143
void addAction(Action *a)
Definition: Transition.cpp:73
void addTarget(State *s)
Definition: Transition.cpp:64
bool isEnabled(Context *c)
Definition: Transition.cpp:91
std::list< State * > & getTargets()
Definition: Transition.cpp:111
void addCondition(Action *c)
Definition: Transition.cpp:82
Transition()
Definition: Transition.cpp:42
ExecutableContent * getActions()
Definition: Transition.cpp:129
void setSource(State *source)
Definition: Transition.cpp:136
virtual ~Transition()
Definition: Transition.cpp:56
ExecutableContent * getConditions()
Definition: Transition.cpp:117
State * getSource()
Definition: Transition.cpp:105
const Event & getEvent()
Definition: Transition.cpp:123
void setEvent(const Event &e)
Definition: Transition.cpp:149
source
Definition: radgen_tool.py:43
Definition: Action.h:40
Definition: testCoroActivity.cpp:16