metaSMT git

metaSMT/transform/fmiToQF_BV.hpp

Go to the documentation of this file.
00001 #pragma once
00002 
00003 #include "../frontend/QF_BV.hpp"
00004 #include <boost/proto/transform.hpp>
00005 #include "rewrite.hpp"
00006 
00007 
00008 namespace metaSMT {
00009   namespace transform {
00010     namespace proto = boost::proto;
00011 
00012     struct fmiToQF_BV;
00013 
00014     struct fmiToQF_BV_c
00015     {
00016       // The primary template matches nothing:
00017       template<typename Tag>
00018         struct case_
00019         : proto::nary_expr<proto::_, proto::vararg<fmiToQF_BV> >
00020         {};
00021     };
00022 
00023     template<>
00024     struct fmiToQF_BV_c::case_<proto::tag::terminal>
00025       : proto::_ 
00026     {};
00027 
00028     struct make_bvand: proto::callable
00029     {
00030         template<typename Sig>
00031         struct result;
00032     
00033         template<typename This, typename Left, typename Right>
00034         struct result<This(Left, Right)>
00035         // this class provides ::type
00036         : boost::proto::result_of::make_expr< 
00037               logic::QF_BV::tag::bvand_tag
00038             , logic::QF_BV::QF_BV_Domain
00039             , Left
00040             , Right
00041           >
00042         {};
00043     
00044         template<typename Left, typename Right>
00045         typename make_bvand::result<make_bvand(Left,Right)>::type 
00046         operator()(Left const & left, Right const & right) const
00047         {
00048             return boost::proto::make_expr<logic::QF_BV::tag::bvand_tag, logic::QF_BV::QF_BV_Domain>( left, right);
00049         }
00050     };
00051 
00052    
00053 #define TRANSLATE_FMI_QF_BV( tag1, tag2) \
00054     template<>\
00055     struct fmiToQF_BV_c::case_<tag1>\
00056       : proto::call< \
00057           proto::functional::make_expr<tag2>( \
00058                 fmiToQF_BV(proto::_left)\
00059               , fmiToQF_BV(proto::_right)\
00060             )>\
00061     {};
00062 
00063     TRANSLATE_FMI_QF_BV( proto::tag::bitwise_and,    logic::QF_BV::tag::bvand_tag)
00064     TRANSLATE_FMI_QF_BV( proto::tag::bitwise_xor,    logic::QF_BV::tag::bvxor_tag)
00065     TRANSLATE_FMI_QF_BV( proto::tag::equal_to,       logic::tag::equal_tag)
00066     TRANSLATE_FMI_QF_BV( proto::tag::not_equal_to,   logic::tag::nequal_tag)
00067     TRANSLATE_FMI_QF_BV( proto::tag::modulus_assign, logic::tag::equal_tag)
00068     TRANSLATE_FMI_QF_BV( proto::tag::shift_left,     logic::QF_BV::tag::bvshl_tag)
00069 
00070 #undef TRANSLATE_FMI_QF_BV
00071 
00072 
00073     struct fmiToQF_BV : proto::switch_< fmiToQF_BV_c > {};
00074   
00075   } /* transform */
00076 } /* metaSMT */
00077 
00078 
00079 // vim: tabstop=2 shiftwidth=2 expandtab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines