spot  0.9.1
binop.hh
Go to the documentation of this file.
00001 // Copyright (C) 2009, 2010, 2011, 2012 Laboratoire de Recherche et
00002 // Développement 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 
00029 #ifndef SPOT_LTLAST_BINOP_HH
00030 # define SPOT_LTLAST_BINOP_HH
00031 
00032 #include <map>
00033 #include <iosfwd>
00034 #include "refformula.hh"
00035 
00036 namespace spot
00037 {
00038   namespace ltl
00039   {
00040 
00043     class binop : public ref_formula
00044     {
00045     public:
00050       enum type { Xor,
00051                   Implies,
00052                   Equiv,
00053                   U, //< until
00054                   R, //< release (dual of until)
00055                   W, //< weak until
00056                   M,  //< strong release (dual of weak until)
00057                   EConcat, // Existential Concatenation
00058                   EConcatMarked, // Existential Concatenation, Marked
00059                   UConcat // Universal Concatenation
00060       };
00061 
00109       static const formula* instance(type op,
00110                                      const formula* first,
00111                                      const formula* second);
00112 
00113       virtual void accept(visitor& v) const;
00114 
00116       const formula* first() const;
00118       const formula* second() const;
00119 
00121       type op() const;
00123       const char* op_name() const;
00124 
00126       virtual std::string dump() const;
00127 
00129       static unsigned instance_count();
00130 
00132       static std::ostream& dump_instances(std::ostream& os);
00133 
00134     protected:
00135       typedef std::pair<const formula*, const formula*> pairf;
00136       typedef std::pair<type, pairf> pair;
00137       typedef std::map<pair, const binop*> map;
00138       static map instances;
00139 
00140       binop(type op, const formula* first, const formula* second);
00141       virtual ~binop();
00142 
00143     private:
00144       type op_;
00145       const formula* first_;
00146       const formula* second_;
00147     };
00148 
00153     inline
00154     const binop*
00155     is_binop(const formula* f)
00156     {
00157       if (f->kind() != formula::BinOp)
00158         return 0;
00159       return static_cast<const binop*>(f);
00160     }
00161 
00166     inline
00167     const binop*
00168     is_binop(const formula* f, binop::type op)
00169     {
00170       if (const binop* bo = is_binop(f))
00171         if (bo->op() == op)
00172           return bo;
00173       return 0;
00174     }
00175 
00180     inline
00181     const binop*
00182     is_binop(const formula* f, binop::type op1, binop::type op2)
00183     {
00184       if (const binop* bo = is_binop(f))
00185         if (bo->op() == op1 || bo->op() == op2)
00186           return bo;
00187       return 0;
00188     }
00189 
00193     inline
00194     const binop*
00195     is_U(const formula* f)
00196     {
00197       return is_binop(f, binop::U);
00198     }
00199 
00203     inline
00204     const binop*
00205     is_M(const formula* f)
00206     {
00207       return is_binop(f, binop::M);
00208     }
00209 
00213     inline
00214     const binop*
00215     is_R(const formula* f)
00216     {
00217       return is_binop(f, binop::R);
00218     }
00219 
00223     inline
00224     const binop*
00225     is_W(const formula* f)
00226     {
00227       return is_binop(f, binop::W);
00228     }
00229   }
00230 }
00231 
00232 #endif // SPOT_LTLAST_BINOP_HH

Please comment this page and report errors about it on the RefDocComments page.
Generated on Wed May 23 2012 12:06:45 for spot by doxygen 1.7.6.1