47 #ifdef CEXMC_USE_CUSTOM_FILTER
50 #include <boost/variant/recursive_variant.hpp>
56 using boost::recursive_wrapper;
81 Operator( OperatorType type_ = Uninitialized,
int priority_ = 0,
82 bool hasRLAssoc_ =
false ) :
83 type( type_ ), priority( priority_ ), hasRLAssoc( hasRLAssoc_ )
105 variant< const int *, const double * > addr;
111 typedef std::string Function;
113 typedef variant< int, double > Constant;
115 typedef variant< Variable, Constant > Leaf;
117 typedef recursive_wrapper< Subtree > Tree;
119 typedef variant< Tree, Leaf > Node;
121 typedef variant< Operator, Function > NodeType;
126 Subtree() : type( Operator( Uninitialized ) )
129 void Print(
int level = 0 )
const;
131 void PrintLeaf(
const Leaf * leaf,
int level = 0 )
const;
133 std::vector< Node > children;
137 static const int printIndent = 4;
144 typedef variant< int, double > ScalarValueType;
147 virtual ~BasicEval();
150 bool operator()(
const Subtree & ast )
const;
153 ScalarValueType GetScalarValue(
const Node & node )
const;
155 virtual ScalarValueType GetFunScalarValue(
const Subtree & ast )
158 virtual ScalarValueType GetVarScalarValue(
const Variable & var )
161 ScalarValueType GetBasicFunScalarValue(
162 const Subtree & ast,
bool & result )