state.hh
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef SPOT_TGBA_STATE_HH
00025 # define SPOT_TGBA_STATE_HH
00026
00027 #include <cstddef>
00028 #include <bdd.h>
00029 #include <cassert>
00030 #include <functional>
00031 #include <boost/shared_ptr.hpp>
00032
00033 namespace spot
00034 {
00035
00038 class state
00039 {
00040 public:
00051 virtual int compare(const state* other) const = 0;
00052
00072 virtual size_t hash() const = 0;
00073
00075 virtual state* clone() const = 0;
00076
00077 virtual ~state()
00078 {
00079 }
00080 };
00081
00094 struct state_ptr_less_than:
00095 public std::binary_function<const state*, const state*, bool>
00096 {
00097 bool
00098 operator()(const state* left, const state* right) const
00099 {
00100 assert(left);
00101 return left->compare(right) < 0;
00102 }
00103 };
00104
00118 struct state_ptr_equal:
00119 public std::binary_function<const state*, const state*, bool>
00120 {
00121 bool
00122 operator()(const state* left, const state* right) const
00123 {
00124 assert(left);
00125 return 0 == left->compare(right);
00126 }
00127 };
00128
00143 struct state_ptr_hash:
00144 public std::unary_function<const state*, size_t>
00145 {
00146 size_t
00147 operator()(const state* that) const
00148 {
00149 assert(that);
00150 return that->hash();
00151 }
00152 };
00153
00154
00156
00157 typedef boost::shared_ptr<const state> shared_state;
00158
00172 struct state_shared_ptr_less_than:
00173 public std::binary_function<shared_state,
00174 shared_state, bool>
00175 {
00176 bool
00177 operator()(shared_state left,
00178 shared_state right) const
00179 {
00180 assert(left);
00181 return left->compare(right.get()) < 0;
00182 }
00183 };
00184
00200 struct state_shared_ptr_equal:
00201 public std::binary_function<shared_state,
00202 shared_state, bool>
00203 {
00204 bool
00205 operator()(shared_state left,
00206 shared_state right) const
00207 {
00208 assert(left);
00209 return 0 == left->compare(right.get());
00210 }
00211 };
00212
00229 struct state_shared_ptr_hash:
00230 public std::unary_function<shared_state, size_t>
00231 {
00232 size_t
00233 operator()(shared_state that) const
00234 {
00235 assert(that);
00236 return that->hash();
00237 }
00238 };
00239
00240 }
00241
00242 #endif // SPOT_TGBA_STATE_HH