sabastate.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 #ifndef SPOT_SABA_SABASTATE_HH
00022 # define SPOT_SABA_SABASTATE_HH
00023
00024 #include <bdd.h>
00025 #include <functional>
00026 #include <boost/shared_ptr.hpp>
00027
00028 namespace spot
00029 {
00030
00033 class saba_state
00034 {
00035 public:
00046 virtual int compare(const saba_state* other) const = 0;
00047
00067 virtual size_t hash() const = 0;
00068
00070 virtual saba_state* clone() const = 0;
00071
00076 virtual bdd acceptance_conditions() const = 0;
00077
00078 virtual ~saba_state()
00079 {
00080 }
00081 };
00082
00095 struct saba_state_ptr_less_than:
00096 public std::binary_function<const saba_state*, const saba_state*, bool>
00097 {
00098 bool
00099 operator()(const saba_state* left, const saba_state* right) const
00100 {
00101 assert(left);
00102 return left->compare(right) < 0;
00103 }
00104 };
00105
00119 struct saba_state_ptr_equal:
00120 public std::binary_function<const saba_state*, const saba_state*, bool>
00121 {
00122 bool
00123 operator()(const saba_state* left, const saba_state* right) const
00124 {
00125 assert(left);
00126 return 0 == left->compare(right);
00127 }
00128 };
00129
00144 struct saba_state_ptr_hash:
00145 public std::unary_function<const saba_state*, size_t>
00146 {
00147 size_t
00148 operator()(const saba_state* that) const
00149 {
00150 assert(that);
00151 return that->hash();
00152 }
00153 };
00154
00155
00157
00158 typedef boost::shared_ptr<const saba_state> shared_saba_state;
00159
00174 struct saba_state_shared_ptr_less_than:
00175 public std::binary_function<shared_saba_state,
00176 shared_saba_state, bool>
00177 {
00178 bool
00179 operator()(shared_saba_state left,
00180 shared_saba_state right) const
00181 {
00182 assert(left);
00183 return left->compare(right.get()) < 0;
00184 }
00185 };
00186
00202 struct saba_state_shared_ptr_equal:
00203 public std::binary_function<shared_saba_state,
00204 shared_saba_state, bool>
00205 {
00206 bool
00207 operator()(shared_saba_state left,
00208 shared_saba_state right) const
00209 {
00210 assert(left);
00211 return 0 == left->compare(right.get());
00212 }
00213 };
00214
00232 struct saba_state_shared_ptr_hash:
00233 public std::unary_function<shared_saba_state, size_t>
00234 {
00235 size_t
00236 operator()(shared_saba_state that) const
00237 {
00238 assert(that);
00239 return that->hash();
00240 }
00241 };
00242
00243 }
00244
00245 #endif // SPOT_SABA_SABASTATE_HH