本文整理汇总了C++中CFunction::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ CFunction::getType方法的具体用法?C++ CFunction::getType怎么用?C++ CFunction::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFunction
的用法示例。
在下文中一共展示了CFunction::getType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
C_INT32 CFunctionDB::load(CReadConfig &configbuffer)
{
CFunction Function;
CFunction * pFunction = NULL;
C_INT32 Size = 0;
C_INT32 Fail = 0;
configbuffer.getVariable("TotalUDKinetics", "C_INT32", &Size,
CReadConfig::LOOP);
for (C_INT32 i = 0; i < Size; i++)
{
Function.load(configbuffer);
switch (Function.getType())
{
case CEvaluationTree::Function:
pFunction = new CFunction(Function);
break;
case CEvaluationTree::MassAction:
pFunction = new CMassAction(Function);
break;
case CEvaluationTree::PreDefined:
case CEvaluationTree::UserDefined:
pFunction = new CKinFunction(Function,
&configbuffer);
break;
default:
fatalError();
break;
}
pFunction->compile();
if (!mLoadedFunctions.add(pFunction, true))
{
pdelete(pFunction);
// We ignore:
// CCopasiVector (2): Object '%s' allready exists.
if ((MCCopasiVector + 2) != CCopasiMessage::peekLastMessage().getNumber())
return Fail = 1;
// Remove the ignored meesage.
CCopasiMessage::getLastMessage();
}
}
return Fail;
}
示例2: CEvaluationTree
CMathExpression::CMathExpression(const CFunction & src,
const CCallParameters< C_FLOAT64 > & callParameters,
CMathContainer & container,
const bool & replaceDiscontinuousNodes):
CEvaluationTree(src.getObjectName(), &container, CEvaluationTree::MathExpression),
mPrerequisites()
{
clearNodes();
// Deal with the different function types
switch (src.getType())
{
case CEvaluationTree::Function:
case CEvaluationTree::PreDefined:
case CEvaluationTree::UserDefined:
{
// Create a vector of CEvaluationNodeObject for each variable
CMath::Variables< CEvaluationNode * > Variables;
CCallParameters< C_FLOAT64 >::const_iterator it = callParameters.begin();
CCallParameters< C_FLOAT64 >::const_iterator end = callParameters.end();
for (; it != end; ++it)
{
Variables.push_back(createNodeFromValue(it->value));
}
// Create a converted copy of the existing expression tree.
mpRootNode = container.copyBranch(src.getRoot(), Variables, replaceDiscontinuousNodes);
// Deleted the created variables
CMath::Variables< CEvaluationNode * >::iterator itVar = Variables.begin();
CMath::Variables< CEvaluationNode * >::iterator endVar = Variables.end();
for (; itVar != endVar; ++itVar)
{
pdelete(*itVar);
}
}
break;
case CEvaluationTree::MassAction:
{
// We build a mass action expression based on the call parameters.
CCallParameters< C_FLOAT64 >::const_iterator it = callParameters.begin();
// Handle the case we were have an invalid number of call parameters.
if (callParameters.size() < 2)
{
mpRootNode = NULL;
}
else
{
// We always have reactants
const C_FLOAT64 * pK = it->value;
++it;
const CCallParameters< C_FLOAT64 > * pSpecies = it->vector;
++it;
CEvaluationNode * pPart = createMassActionPart(pK, pSpecies);
if (callParameters.size() < 4)
{
mpRootNode = pPart;
}
else
{
mpRootNode = new CEvaluationNodeOperator(CEvaluationNode::S_MINUS, "-");
mpRootNode->addChild(pPart);
pK = it->value;
++it;
pSpecies = it->vector;
++it;
pPart = createMassActionPart(pK, pSpecies);
mpRootNode->addChild(pPart);
}
}
}
break;
case CEvaluationTree::MathExpression:
case CEvaluationTree::Expression:
// This cannot happen and is only here to satisfy the compiler.
break;
}
compile();
}