spot
0.9.1
|
00001 // -*- coding: utf-8 -*- 00002 // Copyright (C) 2008, 2009, 2012 Laboratoire de Recherche et 00003 // Développement de l'Epita (LRDE) 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 00024 #ifndef SPOT_LTLAST_AUTOMATOP_HH 00025 # define SPOT_LTLAST_AUTOMATOP_HH 00026 00027 # include <vector> 00028 # include <iosfwd> 00029 # include <map> 00030 # include "nfa.hh" 00031 # include "refformula.hh" 00032 00033 namespace spot 00034 { 00035 namespace ltl 00036 { 00040 class automatop : public ref_formula 00041 { 00042 public: 00044 typedef std::vector<const formula*> vec; 00045 00052 static const automatop* 00053 instance(const nfa::ptr nfa, vec* v, bool negated); 00054 00055 virtual void accept(visitor& v) const; 00056 00058 unsigned size() const; 00062 const formula* nth(unsigned n) const; 00063 00065 const spot::ltl::nfa::ptr get_nfa() const; 00066 00068 bool is_negated() const; 00069 00071 std::string dump() const; 00072 00074 static unsigned instance_count(); 00075 00077 static std::ostream& dump_instances(std::ostream& os); 00078 00079 00080 protected: 00081 typedef std::pair<std::pair<nfa::ptr, bool>, vec*> triplet; 00083 struct tripletcmp 00084 { 00085 bool 00086 operator () (const triplet& p1, const triplet& p2) const 00087 { 00088 if (p1.first.first != p2.first.first) 00089 return p1.first.first < p2.first.first; 00090 if (p1.first.second != p2.first.second) 00091 return p1.first.second < p2.first.second; 00092 return *p1.second < *p2.second; 00093 } 00094 }; 00095 typedef std::map<triplet, const automatop*, tripletcmp> map; 00096 static map instances; 00097 00098 automatop(const nfa::ptr, vec* v, bool negated); 00099 virtual ~automatop(); 00100 00101 private: 00102 const nfa::ptr nfa_; 00103 vec* children_; 00104 bool negated_; 00105 }; 00106 } 00107 } 00108 00109 #endif // SPOT_LTLAST_AUTOMATOP_HH