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

tgba/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 void merge_transitions(); 00068 00069 // tgba interface 00070 virtual ~tgba_explicit(); 00071 virtual spot::state* get_init_state() const; 00072 virtual tgba_succ_iterator* 00073 succ_iter(const spot::state* local_state, 00074 const spot::state* global_state = 0, 00075 const tgba* global_automaton = 0) const; 00076 virtual bdd_dict* get_dict() const; 00077 virtual std::string format_state(const spot::state* state) const; 00078 00079 virtual bdd all_acceptance_conditions() const; 00080 virtual bdd neg_acceptance_conditions() const; 00081 00082 protected: 00083 virtual bdd compute_support_conditions(const spot::state* state) const; 00084 virtual bdd compute_support_variables(const spot::state* state) const; 00085 00086 state* add_state(const std::string& name); 00087 bdd get_acceptance_condition(const ltl::formula* f); 00088 00089 typedef Sgi::hash_map<const std::string, tgba_explicit::state*, 00090 string_hash> ns_map; 00091 typedef Sgi::hash_map<const tgba_explicit::state*, std::string, 00092 ptr_hash<tgba_explicit::state> > sn_map; 00093 ns_map name_state_map_; 00094 sn_map state_name_map_; 00095 bdd_dict* dict_; 00096 tgba_explicit::state* init_; 00097 mutable bdd all_acceptance_conditions_; 00098 bdd neg_acceptance_conditions_; 00099 mutable bool all_acceptance_conditions_computed_; 00100 00101 private: 00102 // Disallow copy. 00103 tgba_explicit(const tgba_explicit& other); 00104 tgba_explicit& tgba_explicit::operator=(const tgba_explicit& other); 00105 }; 00106 00107 00109 class state_explicit : public spot::state 00110 { 00111 public: 00112 state_explicit(const tgba_explicit::state* s) 00113 : state_(s) 00114 { 00115 } 00116 00117 virtual int compare(const spot::state* other) const; 00118 virtual size_t hash() const; 00119 virtual state_explicit* clone() const; 00120 00121 virtual ~state_explicit() 00122 { 00123 } 00124 00125 const tgba_explicit::state* get_state() const; 00126 private: 00127 const tgba_explicit::state* state_; 00128 }; 00129 00130 00132 class tgba_explicit_succ_iterator: public tgba_succ_iterator 00133 { 00134 public: 00135 tgba_explicit_succ_iterator(const tgba_explicit::state* s, bdd all_acc); 00136 00137 virtual 00138 ~tgba_explicit_succ_iterator() 00139 { 00140 } 00141 00142 virtual void first(); 00143 virtual void next(); 00144 virtual bool done() const; 00145 00146 virtual state_explicit* current_state() const; 00147 virtual bdd current_condition() const; 00148 virtual bdd current_acceptance_conditions() const; 00149 00150 private: 00151 const tgba_explicit::state* s_; 00152 tgba_explicit::state::const_iterator i_; 00153 bdd all_acceptance_conditions_; 00154 }; 00155 00156 } 00157 00158 #endif // SPOT_TGBA_TGBAEXPLICIT_HH

Generated on Tue Jun 29 17:00:36 2004 for spot by doxygen 1.3.7