powerset.hh

Go to the documentation of this file.
00001 // Copyright (C) 2011 Laboratoire de Recherche et Développement de
00002 // l'Epita.
00003 // Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
00004 // département Systèmes Répartis Coopératifs (SRC), Université Pierre
00005 // et Marie Curie.
00006 //
00007 // This file is part of Spot, a model checking library.
00008 //
00009 // Spot is free software; you can redistribute it and/or modify it
00010 // under the terms of the GNU General Public License as published by
00011 // the Free Software Foundation; either version 2 of the License, or
00012 // (at your option) any later version.
00013 //
00014 // Spot is distributed in the hope that it will be useful, but WITHOUT
00015 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00016 // or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
00017 // License for more details.
00018 //
00019 // You should have received a copy of the GNU General Public License
00020 // along with Spot; see the file COPYING.  If not, write to the Free
00021 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00022 // 02111-1307, USA.
00023 
00024 #ifndef SPOT_TGBAALGOS_POWERSET_HH
00025 # define SPOT_TGBAALGOS_POWERSET_HH
00026 
00027 # include <list>
00028 # include <map>
00029 # include "tgba/tgbaexplicit.hh"
00030 
00031 namespace spot
00032 {
00033 
00034   struct power_map
00035   {
00036     typedef std::set<const state*, state_ptr_less_than> power_state;
00037     typedef std::map<int, power_state> power_map_data;
00038     typedef Sgi::hash_set<const state*, state_ptr_hash,
00039                           state_ptr_equal> state_set;
00040 
00041     ~power_map()
00042     {
00043       // Release all states.
00044       state_set::const_iterator i = states.begin();
00045       while (i != states.end())
00046         {
00047           // Advance the iterator before deleting the key.
00048           const state* s = *i;
00049           ++i;
00050           s->destroy();
00051         }
00052     }
00053 
00054     const power_state&
00055     states_of(int s) const
00056     {
00057       return map_.find(s)->second;
00058     }
00059 
00060     const state*
00061     canonicalize(const state* s)
00062     {
00063       state_set::const_iterator i = states.find(s);
00064       if (i != states.end())
00065         {
00066           s->destroy();
00067           s = *i;
00068         }
00069       else
00070         {
00071           states.insert(s);
00072         }
00073       return s;
00074     }
00075 
00076     power_map_data map_;
00077     state_set states;
00078   };
00079 
00080 
00090 
00091   tgba_explicit_number* tgba_powerset(const tgba* aut, power_map& pm);
00092   tgba_explicit_number* tgba_powerset(const tgba* aut);
00094 }
00095 
00096 #endif // SPOT_TGBAALGOS_POWERSET_HH

Please comment this page and report errors about it on the RefDocComments page.
Generated on Mon Feb 7 2011 14:29:29 for spot by doxygen 1.7.1