rad  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Helper.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: Helper.h 1139 2016-07-20 14:57:28Z landolfa $
25  */
26 
27 #ifndef SCXML4CPP_HELPER_H
28 #define SCXML4CPP_HELPER_H
29 
30 #ifndef __cplusplus
31 #error This is a C++ include file and cannot be used from plain C
32 #endif
33 
34 
35 #include <string>
36 #include <set>
37 #include <list>
38 
39 
40 namespace scxml4cpp {
41 
42 class Transition;
43 class StateMachine;
44 class State;
45 class Action;
46 class Activity;
47 class Event;
48 
49 
50 class Helper
51 {
52  public:
53  Helper();
54  ~Helper();
55 
56  const std::string printStateType(State* s);
57  const std::string printTransition(Transition* t);
58  const std::string printTransitions(std::list<Transition*>& transitions);
59  const std::string printTargetState(Transition* transitions);
60  const std::string printTargetStates(std::list<Transition*>& transitions);
61  const std::string printActions(std::list<Action*>& actions);
62  const std::string printActivities(std::list<Activity*>& activities);
63  const std::string printStates(State* s);
64  const std::string printStateMachine(StateMachine&);
65 
66  const std::string formatStatus(std::set<State*>& status);
67 
68  int countParents(State*);
69  bool isDescendant(State*, State*);
70 
71  std::set<State*> getAncestors(std::list<State*>& states);
72  std::list<State*> getAncestorsList(std::set<State*>& states);
73  std::set<State*> getAncestors(State*);
74  std::list<State*> getAncestorsList(State*);
75  std::list<State*> getProperAncestors(State*, State*);
76 
77  State* findLeastCommonAncestor(State*, State*);
78  bool eventMatch(const Event&, const Event&);
79 
80  std::list<State*> getAtomicStates(std::set<State*>& states);
81  std::list<State*> getAtomicStates(std::list<State*>& states);
82 
83  bool isPreempted(State*, std::list<Transition*>& transitions);
84 
85  private:
86  Helper(const Helper&);
87  Helper& operator= (const Helper&);
88 };
89 
90 } // namespace scxml4cpp
91 
92 #endif // SCXML4CPP_HELPER_H
93 
94 
95 
const std::string printTransitions(std::list< Transition * > &transitions)
Definition: Helper.cpp:147
const std::string printActions(std::list< Action * > &actions)
Definition: Helper.cpp:190
std::list< State * > getAtomicStates(std::set< State * > &states)
Definition: Helper.cpp:497
int countParents(State *)
Definition: Helper.cpp:352
Helper()
Definition: Helper.cpp:45
std::list< State * > getAncestorsList(std::set< State * > &states)
Definition: Helper.cpp:404
const std::string printTransition(Transition *t)
Definition: Helper.cpp:86
bool isPreempted(State *, std::list< Transition * > &transitions)
Definition: Helper.cpp:529
const std::string printActivities(std::list< Activity * > &activities)
Definition: Helper.cpp:203
const std::string printStateType(State *s)
Definition: Helper.cpp:57
~Helper()
Definition: Helper.cpp:50
const std::string printTargetState(Transition *transitions)
Definition: Helper.cpp:161
const std::string printStateMachine(StateMachine &)
Definition: Helper.cpp:268
const std::string formatStatus(std::set< State * > &status)
Definition: Helper.cpp:299
std::set< State * > getAncestors(std::list< State * > &states)
Definition: Helper.cpp:385
const std::string printTargetStates(std::list< Transition * > &transitions)
Definition: Helper.cpp:177
const std::string printStates(State *s)
Definition: Helper.cpp:216
State * findLeastCommonAncestor(State *, State *)
Definition: Helper.cpp:454
bool isDescendant(State *, State *)
Definition: Helper.cpp:325
bool eventMatch(const Event &, const Event &)
Definition: Helper.cpp:483
std::list< State * > getProperAncestors(State *, State *)
Definition: Helper.cpp:364