state.hh 1.26 KB
Newer Older
1
2
3
#ifndef SPOT_TGBA_STATE_HH
# define SPOT_TGBA_STATE_HH

4
5
#include <bdd.h>

6
7
namespace spot
{
8
9

  /// \brief Abstract class for states.
10
11
12
  class state
  {
  public:
13
14
15
16
17
18
19
20
21
22
23
    /// \brief Compares two states (that come from the same automaton).
    ///
    /// This method returns an integer less than, equal to, or greater
    /// than zero if \a this is found, respectively, to be less than, equal
    /// to, or greater than \a other according to some implicit total order.
    ///
    /// This method should not be called to compare states from
    /// different automata.
    ///
    /// \sa spot::state_ptr_less_than
    virtual int compare(const state* other) const = 0;
24

25
26
27
28
    virtual ~state()
    {
    }
  };
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

  /// \brief Strict Weak Ordering for \c state*.
  ///
  /// This is meant to be used as a comparison functor for
  /// STL \c map whose key are of type \c state*.
  ///
  /// For instance here is how one could declare
  /// a map of \c state*.
  /// \code
  ///   // Remember how many times each state has been visited.
  ///   std::map<spot::state*, int, spot::state_ptr_less_than> seen;
  /// \endcode
  struct state_ptr_less_than
  {
    bool
    operator()(const state* left, const state *right)
    {
      return left->compare(right) < 0;
    }
  };

50
51
52
}

#endif // SPOT_TGBA_STATE_HH