DiaDes  0.1
DIAgnosisofDiscrete-EventSystem
Transition.hh
Go to the documentation of this file.
1 #ifndef __DIADES__ALTARICA__TRANSITION__HH__
2 #define __DIADES__ALTARICA__TRANSITION__HH__
3 
16 
17 
18 
19 namespace Diades
20 {
21  namespace Altarica
22  {
23 
24  class NodeDecl;
25 
36  class Transition
37  {
38  public:
39  typedef reference_wrapper<Transition> Reference;
40  typedef reference_wrapper<Transition const> ConstReference;
41  typedef Transition * Pointer;
42  typedef const Transition * ConstPointer;
43 
44  private:
45 
46  vector< list<EventDecl::ConstReference> > _triggerEventDecls;
47  vector< list<Assignment::ConstReference> > _assignments;
50  public:
56  static string typeName() { return "Altarica::Transition"; }
58 
59 
67 
68 
74  Transition(const Transition & transition);
75 
76 
77 
78 
83  ~Transition();
84 
90  void setPrecondition(const Expression & expr);
91 
98  const NodeDecl & owner() const;
99 
107  bool valid() const;
108 
109 
110 
123  void addTarget(const list<EventDecl::ConstReference> & triggerEventDecls,
124  const list<Assignment::ConstReference> & assignments);
125 
126 
133  const Expression & precondition() const { return _precondition; }
134 
146  unsigned numberOfTargets() const { return _triggerEventDecls.size(); }
147 
154  unsigned firstTargetIndex() const { return 0; }
155 
156 
163  unsigned lastTargetIndex() const { return _triggerEventDecls.size() - 1; }
164 
165 
166 
174  const list<EventDecl::ConstReference> & getEventDeclsOfTargetAtIndex(unsigned index) const
175  {
176  return _triggerEventDecls[index];
177  }
178 
179 
188  const list<Assignment::ConstReference> & getPostConditionOfTargetAtIndex(unsigned index) const
189  {
190  return _assignments[index];
191  }
192 
193 
202  friend ostream & operator<<(ostream & os, const Transition & transition);
203  };
204 
205 
206  };
207 };
208 
209 
210 
211 
212 #endif
Event declaration.
void setPrecondition(const Expression &expr)
unsigned firstTargetIndex() const
Definition: Transition.hh:154
const NodeDecl & owner() const
reference_wrapper< Transition > Reference
Definition: Transition.hh:39
unsigned lastTargetIndex() const
Definition: Transition.hh:163
const list< EventDecl::ConstReference > & getEventDeclsOfTargetAtIndex(unsigned index) const
Definition: Transition.hh:174
reference_wrapper< Transition const > ConstReference
Definition: Transition.hh:40
const list< Assignment::ConstReference > & getPostConditionOfTargetAtIndex(unsigned index) const
Definition: Transition.hh:188
reference_wrapper< Expression const > ConstReference
Definition: Expression.hh:48
const Expression & precondition() const
Definition: Transition.hh:133
void addTarget(const list< EventDecl::ConstReference > &triggerEventDecls, const list< Assignment::ConstReference > &assignments)
Utils::Exception< Transition > Exception
Definition: Transition.hh:55
static string typeName()
Definition: Transition.hh:56
unsigned numberOfTargets() const
Definition: Transition.hh:146
Namespace of the Diades project.
Expression::ConstReference _precondition
Definition: Transition.hh:48
vector< list< Assignment::ConstReference > > _assignments
Definition: Transition.hh:47
Transition(NodeDecl &owner, const Expression &precondition)
friend ostream & operator<<(ostream &os, const Transition &transition)
const Transition * ConstPointer
Definition: Transition.hh:42
Internal structure for an Altarica Transition.
Definition: Transition.hh:36
vector< list< EventDecl::ConstReference > > _triggerEventDecls
Definition: Transition.hh:46