本文整理汇总了C++中AbstractExpression::setInBytes方法的典型用法代码示例。如果您正苦于以下问题:C++ AbstractExpression::setInBytes方法的具体用法?C++ AbstractExpression::setInBytes怎么用?C++ AbstractExpression::setInBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AbstractExpression
的用法示例。
在下文中一共展示了AbstractExpression::setInBytes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
AbstractExpression*
AbstractExpression::buildExpressionTree_recurse(PlannerDomValue obj)
{
// build a tree recursively from the bottom upwards.
// when the expression node is instantiated, its type,
// value and child types will have been discovered.
ExpressionType peek_type = EXPRESSION_TYPE_INVALID;
ValueType value_type = VALUE_TYPE_INVALID;
bool inBytes = false;
AbstractExpression *left_child = NULL;
AbstractExpression *right_child = NULL;
std::vector<AbstractExpression*>* argsVector = NULL;
// read the expression type
peek_type = static_cast<ExpressionType>(obj.valueForKey("TYPE").asInt());
assert(peek_type != EXPRESSION_TYPE_INVALID);
if (obj.hasNonNullKey("VALUE_TYPE")) {
int32_t value_type_int = obj.valueForKey("VALUE_TYPE").asInt();
value_type = static_cast<ValueType>(value_type_int);
assert(value_type != VALUE_TYPE_INVALID);
if (obj.hasNonNullKey("IN_BYTES")) {
inBytes = true;
}
}
// add the value size
int valueSize = -1;
if (obj.hasNonNullKey("VALUE_SIZE")) {
valueSize = obj.valueForKey("VALUE_SIZE").asInt();
} else {
// This value size should be consistent with VoltType.java
valueSize = NValue::getTupleStorageSize(value_type);
}
// recurse to children
try {
if (obj.hasNonNullKey("LEFT")) {
PlannerDomValue leftValue = obj.valueForKey("LEFT");
left_child = AbstractExpression::buildExpressionTree_recurse(leftValue);
}
if (obj.hasNonNullKey("RIGHT")) {
PlannerDomValue rightValue = obj.valueForKey("RIGHT");
right_child = AbstractExpression::buildExpressionTree_recurse(rightValue);
}
// NULL argsVector corresponds to a missing ARGS value
// vs. an empty argsVector which corresponds to an empty array ARGS value.
// Different expression types could assert either a NULL or non-NULL argsVector initializer.
if (obj.hasNonNullKey("ARGS")) {
PlannerDomValue argsArray = obj.valueForKey("ARGS");
argsVector = new std::vector<AbstractExpression*>();
for (int i = 0; i < argsArray.arrayLen(); i++) {
PlannerDomValue argValue = argsArray.valueAtIndex(i);
AbstractExpression* argExpr = AbstractExpression::buildExpressionTree_recurse(argValue);
argsVector->push_back(argExpr);
}
}
// invoke the factory. obviously it has to handle null children.
// pass it the serialization stream in case a subclass has more
// to read. yes, the per-class data really does follow the
// child serializations.
AbstractExpression* finalExpr = ExpressionUtil::expressionFactory(obj, peek_type, value_type, valueSize,
left_child, right_child, argsVector);
finalExpr->setInBytes(inBytes);
return finalExpr;
}
catch (const SerializableEEException &ex) {
delete left_child;
delete right_child;
delete argsVector;
throw;
}
}