00001 // Copyright (C) 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_EVTGBA_EXPLICIT_HH 00023 # define SPOT_EVTGBA_EXPLICIT_HH 00024 00025 #include "evtgba.hh" 00026 #include <list> 00027 #include "misc/hash.hh" 00028 00029 namespace spot 00030 { 00031 // FIXME: doc me 00032 class evtgba_explicit: public evtgba 00033 { 00034 public: 00035 struct transition; 00036 typedef std::list<transition*> transition_list; 00037 struct state 00038 { 00039 transition_list in, out; 00040 }; 00041 00043 struct transition 00044 { 00045 const symbol* label; 00046 symbol_set acceptance_conditions; 00047 state* in; 00048 state* out; 00049 }; 00050 00051 evtgba_explicit(); 00052 virtual ~evtgba_explicit(); 00053 00054 // evtgba interface 00055 virtual evtgba_iterator* init_iter() const; 00056 virtual evtgba_iterator* succ_iter(const spot::state* s) const; 00057 virtual evtgba_iterator* pred_iter(const spot::state* s) const; 00058 virtual std::string format_state(const spot::state* state) const; 00059 virtual const symbol_set& all_acceptance_conditions() const; 00060 virtual const symbol_set& alphabet() const; 00061 00062 transition* add_transition(const std::string& source, 00063 const rsymbol& label, 00064 rsymbol_set acc, 00065 const std::string& dest); 00069 void set_init_state(const std::string& name); 00070 void declare_acceptance_condition(const rsymbol& acc); 00071 protected: 00072 00073 state* declare_state(const std::string& name); 00074 00075 typedef Sgi::hash_map<const std::string, evtgba_explicit::state*, 00076 string_hash> ns_map; 00077 typedef Sgi::hash_map<const evtgba_explicit::state*, std::string, 00078 ptr_hash<evtgba_explicit::state> > sn_map; 00079 00080 ns_map name_state_map_; 00081 sn_map state_name_map_; 00082 00083 symbol_set acc_set_; 00084 symbol_set alphabet_; 00085 transition_list init_states_; 00086 }; 00087 00089 class state_evtgba_explicit : public spot::state 00090 { 00091 public: 00092 state_evtgba_explicit(const evtgba_explicit::state* s) 00093 : state_(s) 00094 { 00095 } 00096 00097 virtual int compare(const spot::state* other) const; 00098 virtual size_t hash() const; 00099 virtual state_evtgba_explicit* clone() const; 00100 00101 virtual ~state_evtgba_explicit() 00102 { 00103 } 00104 00105 const evtgba_explicit::state* get_state() const; 00106 private: 00107 const evtgba_explicit::state* state_; 00108 }; 00109 00110 } 00111 00112 #endif // SPOT_EVTGBA_EXPLICIT_HH