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

tgbaexplicit.hh

Go to the documentation of this file.
00001 // Copyright (C) 2003, 2004  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 
00038   class tgba_explicit: public tgba
00039   {
00040   public:
00041     tgba_explicit(bdd_dict* dict);
00042 
00043     struct transition;
00044     typedef std::list<transition*> state;
00045 
00047     struct transition
00048     {
00049       bdd condition;
00050       bdd acceptance_conditions;
00051       const state* dest;
00052     };
00053 
00054     state* set_init_state(const std::string& state);
00055 
00056     transition*
00057     create_transition(const std::string& source, const std::string& dest);
00058     transition*
00059     create_transition(state* source, const state* dest);
00060 
00061     void add_condition(transition* t, const ltl::formula* f);
00063     void add_conditions(transition* t, bdd f);
00064     void declare_acceptance_condition(const ltl::formula* f);
00065 
00070     void copy_acceptance_conditions_of(const tgba *a);
00071 
00072     bool has_acceptance_condition(const ltl::formula* f) const;
00073     void add_acceptance_condition(transition* t, const ltl::formula* f);
00075     void add_acceptance_conditions(transition* t, bdd f);
00076     void complement_all_acceptance_conditions();
00077     void merge_transitions();
00078 
00081     state* add_state(const std::string& name);
00082 
00083     // tgba interface
00084     virtual ~tgba_explicit();
00085     virtual spot::state* get_init_state() const;
00086     virtual tgba_succ_iterator*
00087     succ_iter(const spot::state* local_state,
00088               const spot::state* global_state = 0,
00089               const tgba* global_automaton = 0) const;
00090     virtual bdd_dict* get_dict() const;
00091     virtual std::string format_state(const spot::state* state) const;
00092 
00093     virtual bdd all_acceptance_conditions() const;
00094     virtual bdd neg_acceptance_conditions() const;
00095 
00096   protected:
00097     virtual bdd compute_support_conditions(const spot::state* state) const;
00098     virtual bdd compute_support_variables(const spot::state* state) const;
00099 
00100     bdd get_acceptance_condition(const ltl::formula* f);
00101 
00102     typedef Sgi::hash_map<const std::string, tgba_explicit::state*,
00103                           string_hash> ns_map;
00104     typedef Sgi::hash_map<const tgba_explicit::state*, std::string,
00105                           ptr_hash<tgba_explicit::state> > sn_map;
00106     ns_map name_state_map_;
00107     sn_map state_name_map_;
00108     bdd_dict* dict_;
00109     tgba_explicit::state* init_;
00110     mutable bdd all_acceptance_conditions_;
00111     bdd neg_acceptance_conditions_;
00112     mutable bool all_acceptance_conditions_computed_;
00113 
00114   private:
00115     // Disallow copy.
00116     tgba_explicit(const tgba_explicit& other);
00117     tgba_explicit& tgba_explicit::operator=(const tgba_explicit& other);
00118   };
00119 
00120 
00123   class state_explicit : public spot::state
00124   {
00125   public:
00126     state_explicit(const tgba_explicit::state* s)
00127       : state_(s)
00128     {
00129     }
00130 
00131     virtual int compare(const spot::state* other) const;
00132     virtual size_t hash() const;
00133     virtual state_explicit* clone() const;
00134 
00135     virtual ~state_explicit()
00136     {
00137     }
00138 
00139     const tgba_explicit::state* get_state() const;
00140   private:
00141     const tgba_explicit::state* state_;
00142   };
00143 
00144 
00147   class tgba_explicit_succ_iterator: public tgba_succ_iterator
00148   {
00149   public:
00150     tgba_explicit_succ_iterator(const tgba_explicit::state* s, bdd all_acc);
00151 
00152     virtual
00153     ~tgba_explicit_succ_iterator()
00154     {
00155     }
00156 
00157     virtual void first();
00158     virtual void next();
00159     virtual bool done() const;
00160 
00161     virtual state_explicit* current_state() const;
00162     virtual bdd current_condition() const;
00163     virtual bdd current_acceptance_conditions() const;
00164 
00165   private:
00166     const tgba_explicit::state* s_;
00167     tgba_explicit::state::const_iterator i_;
00168     bdd all_acceptance_conditions_;
00169   };
00170 
00171 }
00172 
00173 #endif // SPOT_TGBA_TGBAEXPLICIT_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