rad  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Transition.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: Transition.h 1139 2016-07-20 14:57:28Z landolfa $
25  */
26 
27 #ifndef SCXML4CPP_TRANSITION_H
28 #define SCXML4CPP_TRANSITION_H
29 
30 #ifndef __cplusplus
31 #error This is a C++ include file and cannot be used from plain C
32 #endif
33 
34 #ifndef SCXML4CPP_HELPER_H
35 #include "scxml4cpp/Helper.h"
36 #endif
37 
38 #ifndef SCXML4CPP_EVENT_H
39 #include "scxml4cpp/Event.h"
40 #endif
41 
42 #include <string>
43 #include <list>
44 
45 namespace scxml4cpp
46 {
47 
48 class State;
49 class ExecutableContent;
50 class Action;
51 class Context;
52 class Helper;
53 
54 class Transition
55 {
56  public:
57  Transition();
58  virtual ~Transition();
59 
60  State* getSource();
61  const Event& getEvent();
62  std::list<State*>& getTargets();
63 
64  void addTarget(State* s);
65  void addAction(Action* a);
66  void addCondition(Action* c);
67 
68  ExecutableContent* getActions();
69  ExecutableContent* getConditions();
70 
71  bool isEnabled(Context* c);
72  bool isEnabled(const Event& e, Context* c);
73 
74  void setSource(State* source);
75  void setTargets(std::list<State*>& targets);
76  void setEvent(const Event& e);
77 
78  private:
79  Event mEvent;
80  ExecutableContent* mConditions;
81  ExecutableContent* mActions;
82  State* mSource;
83  std::list<State*> mTargets;
84  Helper mHelper;
85 
86  Transition(const Transition&);
87  Transition& operator= (const Transition&);
88 };
89 
90 } // namespace scxml4cpp
91 
92 #endif // SCXML4CPP_TRANSITION_H
93 
Definition: testCoroActivity.cpp:16
void setSource(State *source)
Definition: Transition.cpp:131
ExecutableContent * getActions()
Definition: Transition.cpp:124
ExecutableContent * getConditions()
Definition: Transition.cpp:112
virtual ~Transition()
Definition: Transition.cpp:51
const Event & getEvent()
Definition: Transition.cpp:118
void setTargets(std::list< State * > &targets)
Definition: Transition.cpp:138
void addAction(Action *a)
Definition: Transition.cpp:68
source
Definition: radgen_tool.py:43
State * getSource()
Definition: Transition.cpp:100
std::list< State * > & getTargets()
Definition: Transition.cpp:106
void addCondition(Action *c)
Definition: Transition.cpp:77
void addTarget(State *s)
Definition: Transition.cpp:59
void setEvent(const Event &e)
Definition: Transition.cpp:144
bool isEnabled(Context *c)
Definition: Transition.cpp:86
Transition()
Definition: Transition.cpp:37