Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

formula.hh

Go to the documentation of this file.
00001 // Copyright (C) 2003, 2004, 2005  Laboratoire d'Informatique de Paris 6 (LIP6),
00002 // département Systèmes Répartis Coopératifs (SRC), Université Pierre
00003 // et Marie Curie.
00004 //
00005 // This file is part of Spot, a model checking library.
00006 //
00007 // Spot is free software; you can redistribute it and/or modify it
00008 // under the terms of the GNU General Public License as published by
00009 // the Free Software Foundation; either version 2 of the License, or
00010 // (at your option) any later version.
00011 //
00012 // Spot is distributed in the hope that it will be useful, but WITHOUT
00013 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00014 // or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
00015 // License for more details.
00016 //
00017 // You should have received a copy of the GNU General Public License
00018 // along with Spot; see the file COPYING.  If not, write to the Free
00019 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00020 // 02111-1307, USA.
00021 
00024 #ifndef SPOT_LTLAST_FORMULA_HH
00025 # define SPOT_LTLAST_FORMULA_HH
00026 
00027 #include <string>
00028 #include <cassert>
00029 #include "predecl.hh"
00030 
00031 namespace spot
00032 {
00033   namespace ltl
00034   {
00038 
00041 
00044 
00048 
00051 
00054 
00057 
00060 
00063 
00064 
00071     class formula
00072     {
00073     public:
00075       virtual void accept(visitor& v) = 0;
00077       virtual void accept(const_visitor& v) const = 0;
00078 
00085       formula* ref();
00092       static void unref(formula* f);
00093 
00095       const std::string& dump() const;
00096 
00098       const size_t
00099       hash() const
00100       {
00101         return hash_key_;
00102       }
00103     protected:
00104       virtual ~formula();
00105 
00107       virtual void ref_();
00110       virtual bool unref_();
00111 
00115       void set_key_();
00117       std::string dump_;
00121       size_t hash_key_;
00122     };
00123 
00137     struct formula_ptr_less_than:
00138       public std::binary_function<const formula*, const formula*, bool>
00139     {
00140       bool
00141       operator()(const formula* left, const formula* right) const
00142       {
00143         assert(left);
00144         assert(right);
00145         size_t l = left->hash();
00146         size_t r = right->hash();
00147         if (1 != r)
00148           return l < r;
00149         return left->dump() < right->dump();
00150       }
00151     };
00152 
00167     struct formula_ptr_hash:
00168       public std::unary_function<const formula*, size_t>
00169     {
00170       size_t
00171       operator()(const formula* that) const
00172       {
00173         assert(that);
00174         return that->hash();
00175       }
00176     };
00177 
00178 
00179   }
00180 }
00181 
00182 #endif // SPOT_LTLAST_FORMULA_HH

Please comment this page and report errors about it on the RefDocComments page.
Generated on Mon Jan 31 12:54:24 2005 for spot by doxygen 1.4.0