本文整理汇总了C++中ExecutionContext::getPrimitiveTree方法的典型用法代码示例。如果您正苦于以下问题:C++ ExecutionContext::getPrimitiveTree方法的具体用法?C++ ExecutionContext::getPrimitiveTree怎么用?C++ ExecutionContext::getPrimitiveTree使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExecutionContext
的用法示例。
在下文中一共展示了ExecutionContext::getPrimitiveTree方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getArgument
/*!
* \brief Return a handle to the value of the Nth argument of the primitive.
* \param inIndex Index of the actual primitive in the primitive tree.
* \param inN Number of the argument to get the index.
* \param ioContext A reference to the execution context.
* \return A handle to the value of the Nth argument of the primitive.
*/
AnyType::Handle Primitive::getArgument(unsigned int inIndex, unsigned int inN, ExecutionContext& ioContext) const {
schnaps_StackTraceBeginM();
unsigned int lNodeIndex = getArgumentIndex(inIndex, inN, ioContext);
AnyType::Handle outResult = ioContext.getPrimitiveTree()[lNodeIndex].mPrimitive->execute(lNodeIndex, ioContext);
return outResult;
schnaps_StackTraceEndM("AnyType::Handle Primitive::getArgument(unsigned int, unsigned int, SCHNAPS::Core::ExecutionContext&) const");
}
示例2: getArgumentIndex
/*!
* \brief Return the index of the Nth argument of the primitive.
* \param inIndex Index of the actual primitive in the primitive tree.
* \param inN Number of the argument to get the index.
* \param ioContext A reference to the execution context.
* \return The index of the Nth argument of the primitive.
* \throw SCHNAPS::Core::AssertException if the argument number is out of bounds.
*/
unsigned int Primitive::getArgumentIndex(unsigned int inIndex, unsigned int inN, ExecutionContext& ioContext) const {
schnaps_StackTraceBeginM();
schnaps_UpperBoundCheckAssertM(inN, mNumberArguments-1);
const PrimitiveTree& lActualTree = ioContext.getPrimitiveTree();
unsigned int lNodeIndex = inIndex + 1;
for (unsigned int i = 0; i < inN; i++) {
lNodeIndex += lActualTree[lNodeIndex].mSubTreeSize;
}
return lNodeIndex;
schnaps_StackTraceEndM("unsigned int SCHNAPS::Core::Primitive::getArgumentIndex(unsigned int, unsigned int, SCHNAPS::Core::ExecutionContext&) const");
}
示例3: isValid
/*!
* \brief Validate primitive and children recursively.
* \param inIndex Index of the current primitive.
* \param ioContext A reference to the execution context.
* \return True if valid, false if not.
*/
bool Primitive::isValid(unsigned int inIndex, ExecutionContext& ioContext) const {
schnaps_StackTraceBeginM();
std::string lArgReturn, lArgType;
unsigned int lArgIndex;
for (unsigned int i = 0; i < mNumberArguments; i++) {
lArgType = getArgType(inIndex, i, ioContext);
lArgIndex = getArgumentIndex(inIndex, i, ioContext);
lArgReturn = ioContext.getPrimitiveTree()[lArgIndex].mPrimitive->getReturnType(inIndex, ioContext);
if ((lArgType != lArgReturn) && (!ioContext.getSystem().getTypingManager().typeCast(lArgReturn, lArgType))) {
return false;
}
}
return true;
schnaps_StackTraceEndM("bool SCHNAPS::Core::Primitive::isValid(unsigned int, SCHNAPS::Core::ExecutionContext&) const");
}