ifw  0.0.1-dev
 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 HELPER_H
28 #define 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 
43  class Transition;
44  class StateMachine;
45  class State;
46  class Action;
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 printStates(State* s);
63  const std::string printStateMachine(StateMachine&);
64 
65  const std::string formatStatus(std::set<State*>& status);
66 
67  int countParents(State*);
68  bool isDescendant(State*, State*);
69 
70  std::set<State*> getAncestors(std::list<State*>& states);
71  std::list<State*> getAncestorsList(std::set<State*>& states);
72  std::set<State*> getAncestors(State*);
73  std::list<State*> getAncestorsList(State*);
74  std::list<State*> getProperAncestors(State*, State*);
75 
77  bool eventMatch(const Event&, const Event&);
78 
79  std::list<State*> getAtomicStates(std::set<State*>& states);
80  std::list<State*> getAtomicStates(std::list<State*>& states);
81 
82  bool isPreempted(State*, std::list<Transition*>& transitions);
83 
84  private:
85  Helper(const Helper&);
86  Helper& operator= (const Helper&);
87  };
88 
89 }
90 #endif
const std::string printTransitions(std::list< Transition * > &transitions)
Definition: Helper.cpp:146
Definition: State.h:48
const std::string printActions(std::list< Action * > &actions)
Definition: Helper.cpp:189
std::list< State * > getAtomicStates(std::set< State * > &states)
Definition: Helper.cpp:478
int countParents(State *)
Definition: Helper.cpp:333
Helper()
Definition: Helper.cpp:44
std::list< State * > getAncestorsList(std::set< State * > &states)
Definition: Helper.cpp:385
const std::string printTransition(Transition *t)
Definition: Helper.cpp:85
bool isPreempted(State *, std::list< Transition * > &transitions)
Definition: Helper.cpp:510
const std::string printStateType(State *s)
Definition: Helper.cpp:56
Definition: StateMachine.h:44
~Helper()
Definition: Helper.cpp:49
Definition: Helper.h:50
const std::string printTargetState(Transition *transitions)
Definition: Helper.cpp:160
const std::string printStateMachine(StateMachine &)
Definition: Helper.cpp:254
const std::string formatStatus(std::set< State * > &status)
Definition: Helper.cpp:285
std::set< State * > getAncestors(std::list< State * > &states)
Definition: Helper.cpp:366
Definition: Transition.h:54
const std::string printTargetStates(std::list< Transition * > &transitions)
Definition: Helper.cpp:176
const std::string printStates(State *s)
Definition: Helper.cpp:202
State * findLeastCommonAncestor(State *, State *)
Definition: Helper.cpp:435
Definition: Event.h:39
bool isDescendant(State *, State *)
Definition: Helper.cpp:311
bool eventMatch(const Event &, const Event &)
Definition: Helper.cpp:464
std::list< State * > getProperAncestors(State *, State *)
Definition: Helper.cpp:345