DiaDes  0.1
DIAgnosis of Discrete-Event System
BeliefState.hh
Go to the documentation of this file.
1 #ifndef __DIADES__AUTOMATA__BELIEFSTATE__HH
2 #define __DIADES__AUTOMATA__BELIEFSTATE__HH
3 
4 #include<set>
9 
10 
11 using namespace Diades::Graph;
12 
13 
14 namespace Diades
15 {
16  namespace Automata
17  {
21  class BeliefStateInvalid : public runtime_error, public domain_error
22  {
23 
24  public:
28  BeliefStateInvalid(const string& whatArg) : runtime_error(whatArg), domain_error(whatArg)
29  {
30  cerr << "EXCEPTION BeliefState -> " << whatArg << endl;
31  }
32 
33  };
34 
35 
37 
38 
41 
42  class Event;
43  class Component;
44 
45 
53  class BeliefState: public GraphNodeSet
54  {
55 
56  private:
57 
58  const Component & _comp;
59 
60  public:
61 
66  BeliefState(const Component & comp);
67 
75  BeliefState(const Component & comp, State s);
76 
84  BeliefState(const Component & comp, const set<State> & s);
85 
93  BeliefState(const Component & comp, const unordered_set<State> & s);
94 
97  BeliefState(const BeliefState & bs);
98 
99 
100 
105  {
106  require(BeliefStateInvalid,&_grph == &bs._grph,
107  "Operator=: the belief state does not have the same graph");
108  require(BeliefStateInvalid,&_comp == &bs._comp,
109  "Operator=: the belief state does not have the same component");
110  if(&bs != this)
111  {
112  _nodes = bs._nodes;
113  }
114  return *this;
115  }
116 
117 
124  BeliefState * nextBeliefState(Event e) const;
125 
137  BeliefState * nextBeliefState(Event e, const set<Event> & ignored) const;
138 
139 
140 
148  BeliefState * previousBeliefState(Event e) const;
149 
150 
155  bool operator==(const BeliefState & bs) const
156  {
157  return (&_comp == &bs._comp) && GraphNodeSet::operator==(bs);
158  }
159 
160 
161 
166  const Component & component() const { return _comp; }
167 
168 
169  };
170 
171 
172 
173 
174 
175 
176  };
177 
178 };
179 
180 #endif /*BELIEFSTATE_HH_*/
BeliefState & operator=(const BeliefState &bs)
Definition: BeliefState.hh:104
const Component & component() const
Definition: BeliefState.hh:166
bool operator==(const GraphNodeSet &ns) const
Diades::Graph::GraphNodeSet::Iterator BeliefStateIterator
Definition: BeliefState.hh:40
AutFsm::State State
Definition: Run.cc:72
bool operator==(const BeliefState &bs) const
Definition: BeliefState.hh:155
#define require(Exception, expr, message)
Definition: Assertion.hh:90
Namespace of the Diades project.
set< Node >::const_iterator Iterator
Definition: GraphNodeSet.hh:41
BeliefStateInvalid(const string &whatArg)
Definition: BeliefState.hh:28
Namespace of the Graph library (libGraph)
Definition: BFS.hh:9