本文整理汇总了C++中NodeElement::getTypedObject方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeElement::getTypedObject方法的具体用法?C++ NodeElement::getTypedObject怎么用?C++ NodeElement::getTypedObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeElement
的用法示例。
在下文中一共展示了NodeElement::getTypedObject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initNode
bool BaseMultiMappingElement::initNode()
{
using namespace core::objectmodel;
using namespace core;
bool result = ObjectElement::initNode();
if( result )
{
BaseMapping* multimapping = this->getTypedObject()->toBaseMapping();
NodeElement* currentNodeElement = dynamic_cast<NodeElement *>(getParent());
simulation::Node* currentNode = dynamic_cast<simulation::Node* >( currentNodeElement->getTypedObject() );
helper::vector<core::BaseState*> inputStates = multimapping->getFrom();
helper::vector<core::BaseState*> outputStates = multimapping->getTo();
helper::vector<core::BaseState*>::iterator iterState;
helper::vector<simulation::Node*> inputNodes, outputNodes;
/* get the Nodes corresponding to each input BaseState context */
for( iterState = inputStates.begin(); iterState != inputStates.end(); ++iterState)
{
simulation::Node* node = dynamic_cast< simulation::Node* >((*iterState)->getContext());
inputNodes.push_back(node);
}
/* */
/* get the Nodes corresponding to each output BaseState context */
for( iterState = outputStates.begin(); iterState != outputStates.end(); ++iterState)
{
simulation::Node* node = dynamic_cast< simulation::Node* >((*iterState)->getContext());
outputNodes.push_back(node);
}
helper::vector<simulation::Node*>::iterator iterNode;
BaseNode* currentBaseNode;
/* filter out inputNodes which already belong to the currentNode ancestors */
helper::vector<simulation::Node*> otherInputNodes;
helper::vector<simulation::Node*> ancestorInputNodes;
iterNode = inputNodes.begin();
currentBaseNode = currentNode;
for( iterNode = inputNodes.begin(); iterNode != inputNodes.end(); ++iterNode)
{
if( !currentBaseNode->hasAncestor(*iterNode) )
{
otherInputNodes.push_back(*iterNode);
}
else
{
ancestorInputNodes.push_back(*iterNode);
}
}
updateSceneGraph(multimapping, ancestorInputNodes, otherInputNodes, outputNodes );
}
return result;
}