spot
0.8.1
|
00001 // Copyright (C) 2009 Laboratoire de Recherche et Développement 00002 // de l'Epita (LRDE). 00003 // Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 00004 // 6 (LIP6), département Systèmes Répartis Coopératifs (SRC), 00005 // Université Pierre 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 00026 #ifndef SPOT_LTLAST_MULTOP_HH 00027 # define SPOT_LTLAST_MULTOP_HH 00028 00029 #include <vector> 00030 #include <map> 00031 #include <iosfwd> 00032 #include "refformula.hh" 00033 00034 namespace spot 00035 { 00036 namespace ltl 00037 { 00038 00043 class multop : public ref_formula 00044 { 00045 public: 00046 enum type { Or, And }; 00047 00049 typedef std::vector<formula*> vec; 00050 00063 static formula* instance(type op, formula* first, formula* second); 00064 00077 static formula* instance(type op, vec* v); 00078 00079 virtual void accept(visitor& v); 00080 virtual void accept(const_visitor& v) const; 00081 00083 unsigned size() const; 00087 const formula* nth(unsigned n) const; 00091 formula* nth(unsigned n); 00092 00094 type op() const; 00096 const char* op_name() const; 00097 00099 virtual std::string dump() const; 00100 00102 static unsigned instance_count(); 00103 00105 static std::ostream& dump_instances(std::ostream& os); 00106 00107 protected: 00108 typedef std::pair<type, vec*> pair; 00110 struct paircmp 00111 { 00112 bool 00113 operator () (const pair& p1, const pair& p2) const 00114 { 00115 if (p1.first != p2.first) 00116 return p1.first < p2.first; 00117 return *p1.second < *p2.second; 00118 } 00119 }; 00120 typedef std::map<pair, multop*, paircmp> map; 00121 static map instances; 00122 00123 multop(type op, vec* v); 00124 virtual ~multop(); 00125 00126 private: 00127 type op_; 00128 vec* children_; 00129 }; 00130 00131 } 00132 } 00133 00134 #endif // SPOT_LTLAST_MULTOP_HH