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

tgbaexplicit.hh

Go to the documentation of this file.
00001 // Copyright (C) 2003  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 
00022 #ifndef SPOT_TGBA_TGBAEXPLICIT_HH
00023 # define SPOT_TGBA_TGBAEXPLICIT_HH
00024 
00025 #include "misc/hash.hh"
00026 #include <list>
00027 #include "tgba.hh"
00028 #include "ltlast/formula.hh"
00029 
00030 namespace spot
00031 {
00032   // Forward declarations.  See below.
00033   class state_explicit;
00034   class tgba_explicit_succ_iterator;
00035 
00037   class tgba_explicit: public tgba
00038   {
00039   public:
00040     tgba_explicit(bdd_dict* dict);
00041 
00042     struct transition;
00043     typedef std::list<transition*> state;
00044 
00046     struct transition
00047     {
00048       bdd condition;
00049       bdd acceptance_conditions;
00050       state* dest;
00051     };
00052 
00053     void set_init_state(const std::string& state);
00054 
00055     transition*
00056     create_transition(const std::string& source, const std::string& dest);
00057 
00058     void add_condition(transition* t, const ltl::formula* f);
00060     void add_conditions(transition* t, bdd f);
00061     void declare_acceptance_condition(const ltl::formula* f);
00062     bool has_acceptance_condition(const ltl::formula* f) const;
00063     void add_acceptance_condition(transition* t, const ltl::formula* f);
00065     void add_acceptance_conditions(transition* t, bdd f);
00066     void complement_all_acceptance_conditions();
00067 
00068     // tgba interface
00069     virtual ~tgba_explicit();
00070     virtual spot::state* get_init_state() const;
00071     virtual tgba_succ_iterator*
00072     succ_iter(const spot::state* local_state,
00073               const spot::state* global_state = 0,
00074               const tgba* global_automaton = 0) const;
00075     virtual bdd_dict* get_dict() const;
00076     virtual std::string format_state(const spot::state* state) const;
00077 
00078     virtual bdd all_acceptance_conditions() const;
00079     virtual bdd neg_acceptance_conditions() const;
00080 
00081   protected:
00082     virtual bdd compute_support_conditions(const spot::state* state) const;
00083     virtual bdd compute_support_variables(const spot::state* state) const;
00084 
00085     state* add_state(const std::string& name);
00086     bdd get_acceptance_condition(const ltl::formula* f);
00087 
00088     typedef Sgi::hash_map<const std::string, tgba_explicit::state*,
00089                           string_hash> ns_map;
00090     typedef Sgi::hash_map<const tgba_explicit::state*, std::string,
00091                           ptr_hash<tgba_explicit::state> > sn_map;
00092     ns_map name_state_map_;
00093     sn_map state_name_map_;
00094     bdd_dict* dict_;
00095     tgba_explicit::state* init_;
00096     mutable bdd all_acceptance_conditions_;
00097     bdd neg_acceptance_conditions_;
00098     mutable bool all_acceptance_conditions_computed_;
00099 
00100   private:
00101     // Disallow copy.
00102     tgba_explicit(const tgba_explicit& other);
00103     tgba_explicit& tgba_explicit::operator=(const tgba_explicit& other);
00104   };
00105 
00106 
00108   class state_explicit : public spot::state
00109   {
00110   public:
00111     state_explicit(const tgba_explicit::state* s)
00112       : state_(s)
00113     {
00114     }
00115 
00116     virtual int compare(const spot::state* other) const;
00117     virtual size_t hash() const;
00118     virtual state_explicit* clone() const;
00119 
00120     virtual ~state_explicit()
00121     {
00122     }
00123 
00124     const tgba_explicit::state* get_state() const;
00125   private:
00126     const tgba_explicit::state* state_;
00127   };
00128 
00129 
00131   class tgba_explicit_succ_iterator: public tgba_succ_iterator
00132   {
00133   public:
00134     tgba_explicit_succ_iterator(const tgba_explicit::state* s, bdd all_acc);
00135 
00136     virtual
00137     ~tgba_explicit_succ_iterator()
00138     {
00139     }
00140 
00141     virtual void first();
00142     virtual void next();
00143     virtual bool done() const;
00144 
00145     virtual state_explicit* current_state() const;
00146     virtual bdd current_condition() const;
00147     virtual bdd current_acceptance_conditions() const;
00148 
00149   private:
00150     const tgba_explicit::state* s_;
00151     tgba_explicit::state::const_iterator i_;
00152     bdd all_acceptance_conditions_;
00153   };
00154 
00155 }
00156 
00157 #endif // SPOT_TGBA_TGBAEXPLICIT_HH

Generated on Mon Dec 1 11:33:54 2003 for spot by doxygen 1.3.4