本文整理汇总了C++中DagNode::removeMove方法的典型用法代码示例。如果您正苦于以下问题:C++ DagNode::removeMove方法的具体用法?C++ DagNode::removeMove怎么用?C++ DagNode::removeMove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DagNode
的用法示例。
在下文中一共展示了DagNode::removeMove方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/**
* Overloaded assignment operator.
* We need a deep copy of the operator.
*/
MetropolisHastingsMove& MetropolisHastingsMove::operator=(const RevBayesCore::MetropolisHastingsMove &m)
{
if ( this != &m )
{
// free memory
delete proposal;
for (std::set<DagNode*>::iterator it = nodes.begin(); it != nodes.end(); ++it)
{
// get the pointer to the current node
DagNode* theNode = *it;
// add myself to the set of moves
theNode->removeMove( this );
// decrease the DAG node reference count because we also have a pointer to it
if ( theNode->decrementReferenceCount() == 0 )
{
delete theNode;
}
}
affectedNodes = m.affectedNodes;
nodes = m.nodes;
numAccepted = m.numAccepted;
proposal = m.proposal->clone();
for (std::set<DagNode*>::iterator it = nodes.begin(); it != nodes.end(); ++it)
{
// get the pointer to the current node
DagNode* theNode = *it;
// add myself to the set of moves
theNode->addMove( this );
// increase the DAG node reference count because we also have a pointer to it
theNode->incrementReferenceCount();
}
}
return *this;
}
示例2:
/**
* Overloaded assignment operator.
* We need a deep copy of the operator.
*/
AbstractMove& AbstractMove::operator=(const RevBayesCore::AbstractMove &m)
{
if ( this != &m )
{
// delegate
Move::operator=(m);
for (size_t i = 0; i < nodes.size(); ++i)
{
// get the pointer to the current node
DagNode* theNode = nodes[i];
// add myself to the set of moves
theNode->removeMove( this );
// decrease the DAG node reference count because we also have a pointer to it
if ( theNode->decrementReferenceCount() == 0 )
{
delete theNode;
}
}
affectedNodes = m.affectedNodes;
nodes = m.nodes;
for (size_t i = 0; i < nodes.size(); ++i)
{
// get the pointer to the current node
DagNode* theNode = nodes[i];
// add myself to the set of moves
theNode->addMove( this );
// increase the DAG node reference count because we also have a pointer to it
theNode->incrementReferenceCount();
}
}
return *this;
}