MultiAgentDecisionProcess  Release 0.2.1
BeliefIterator.h
Go to the documentation of this file.
1 
28 /* Only include this header file once. */
29 #ifndef _BELIEFITERATOR_H_
30 #define _BELIEFITERATOR_H_ 1
31 
32 /* the include directives */
33 #include "Globals.h"
35 #include "Belief.h"
36 
39 {
40 private:
41 
43  const Belief *_m_belief;
44 
45 protected:
46 
47 public:
48 
49  // Constructor, destructor and copy assignment.
51  BeliefIterator(const Belief *b) : _m_i(0), _m_belief(b){}
52 
54  virtual ~BeliefIterator(){}
55 
56  double GetProbability() const { return(_m_belief->_m_b[_m_i]); }
57  Index GetStateIndex() const { return(_m_i); }
58  bool Next()
59  {
60  if(_m_i>=(_m_belief->_m_b.size()-1))
61  return(false);
62  else
63  {
64  _m_i++;
65  return(true);
66  }
67  }
68 
70  virtual BeliefIterator* Clone() const
71  { return new BeliefIterator(*this); }
72 
73 };
74 
75 
76 #endif /* !_BELIEFITERATOR_H_ */
77 
78 // Local Variables: ***
79 // mode:c++ ***
80 // End: ***