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 )
96 Variable() : index1( 0 ), index2( 0 ), addr( ( const int * ) NULL )
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 )
void Print(const std::vector< T > &data)