spot
0.8.1
|
00001 // Copyright (C) 2008, 2009 Laboratoire de Recherche et Developpement 00002 // de l'Epita (LRDE) 00003 // 00004 // This file is part of Spot, a model checking library. 00005 // 00006 // Spot is free software; you can redistribute it and/or modify it 00007 // under the terms of the GNU General Public License as published by 00008 // the Free Software Foundation; either version 2 of the License, or 00009 // (at your option) any later version. 00010 // 00011 // Spot is distributed in the hope that it will be useful, but WITHOUT 00012 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00013 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 00014 // License for more details. 00015 // 00016 // You should have received a copy of the GNU General Public License 00017 // along with Spot; see the file COPYING. If not, write to the Free 00018 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00019 // 02111-1307, USA. 00020 00023 #ifndef SPOT_LTLAST_AUTOMATOP_HH 00024 # define SPOT_LTLAST_AUTOMATOP_HH 00025 00026 # include <vector> 00027 # include <iosfwd> 00028 # include <map> 00029 # include "nfa.hh" 00030 # include "refformula.hh" 00031 00032 namespace spot 00033 { 00034 namespace ltl 00035 { 00039 class automatop : public ref_formula 00040 { 00041 public: 00043 typedef std::vector<formula*> vec; 00044 00051 static automatop* 00052 instance(const nfa::ptr nfa, vec* v, bool negated); 00053 00054 virtual void accept(visitor& v); 00055 virtual void accept(const_visitor& v) const; 00056 00058 unsigned size() const; 00062 const formula* nth(unsigned n) const; 00066 formula* nth(unsigned n); 00067 00069 const spot::ltl::nfa::ptr get_nfa() const; 00070 00072 bool is_negated() const; 00073 00075 std::string dump() const; 00076 00078 static unsigned instance_count(); 00079 00081 static std::ostream& dump_instances(std::ostream& os); 00082 00083 00084 protected: 00085 typedef std::pair<std::pair<nfa::ptr, bool>, vec*> triplet; 00087 struct tripletcmp 00088 { 00089 bool 00090 operator () (const triplet& p1, const triplet& p2) const 00091 { 00092 if (p1.first.first != p2.first.first) 00093 return p1.first.first < p2.first.first; 00094 if (p1.first.second != p2.first.second) 00095 return p1.first.second < p2.first.second; 00096 return *p1.second < *p2.second; 00097 } 00098 }; 00099 typedef std::map<triplet, automatop*, tripletcmp> map; 00100 static map instances; 00101 00102 automatop(const nfa::ptr, vec* v, bool negated); 00103 virtual ~automatop(); 00104 00105 private: 00106 const nfa::ptr nfa_; 00107 vec* children_; 00108 bool negated_; 00109 }; 00110 } 00111 } 00112 00113 #endif // SPOT_LTLAST_AUTOMATOP_HH