sabastate.hh

Go to the documentation of this file.
00001 // Copyright (C) 2009 Laboratoire de Recherche et Développement
00002 // de l'Epita (LRDE).
00003 //
00004 // This file is part of Spot, a model checking library.
00005 //
00006 // Spot is free software; you can redistribute it and/or modify it
00007 // under the terms of the GNU General Public License as published by
00008 // the Free Software Foundation; either version 2 of the License, or
00009 // (at your option) any later version.
00010 //
00011 // Spot is distributed in the hope that it will be useful, but WITHOUT
00012 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00013 // or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
00014 // License for more details.
00015 //
00016 // You should have received a copy of the GNU General Public License
00017 // along with Spot; see the file COPYING.  If not, write to the Free
00018 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00019 // 02111-1307, USA.
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   // Functions related to shared_ptr.
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

Please comment this page and report errors about it on the RefDocComments page.
Generated on Mon Feb 7 2011 14:29:29 for spot by doxygen 1.7.1