本文整理汇总了C++中SoNode::unrefNoDelete方法的典型用法代码示例。如果您正苦于以下问题:C++ SoNode::unrefNoDelete方法的具体用法?C++ SoNode::unrefNoDelete怎么用?C++ SoNode::unrefNoDelete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoNode
的用法示例。
在下文中一共展示了SoNode::unrefNoDelete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printf
void
SoDebug::writeField(SoField *field)
//
////////////////////////////////////////////////////////////////////////
{
SoFieldContainer *fc = field->getContainer();
SbName fieldName;
fc->getFieldName(field, fieldName);
printf("Field name is: %s\n", fieldName.getString());
if (fc->isOfType(SoNode::getClassTypeId())) {
printf("Field is part of node:\n");
SoNode *node = (SoNode *)fc;
node->ref();
SoWriteAction wa;
wa.apply(node);
node->unrefNoDelete();
}
}
示例2: copyContents
/*!
Make a duplicate of this node and return a pointer to the duplicate.
If this node is a group node, children are also copied and we return
a pointer to the root of a full copy of the subgraph rooted here.
If \a copyconnections is \c TRUE, we also copy the connections to
fields within this node (and ditto for any children and children's
children etc).
Note that this function has been made virtual in Coin, which is not
the case in the original Open Inventor API. We may change this
method back into being non-virtual again for major Coin versions
after this, as it was made virtual more or less by mistake. So
please don't write application code that depends on SoNode::copy()
being virtual.
The reason this method should not be virtual is because this is \e
not the function the application programmer should override in
extension nodes if she needs some special behavior during a copy
operation (like copying the value of internal data not exposed as
fields).
For that purpose, override the copyContents() method. Your
overridden copyContents() method should then \e both copy internal
data aswell as calling the parent superclass' copyContents() method
for automatically handling of fields and other common data.
*/
SoNode *
SoNode::copy(SbBool copyconnections) const
{
// FIXME: "de-virtualize" this method for next major Coin release?
// See method documentation above. 20011220 mortene.
SoFieldContainer::initCopyDict();
SoNode * cp = this->addToCopyDict();
// ref() to make sure the copy is not destructed while copying
cp->ref();
// Call findCopy() to have copyContents() run only once.
#if COIN_DEBUG
SoNode * cp2 = (SoNode *)SoFieldContainer::findCopy(this, copyconnections);
assert(cp == cp2);
#else // COIN_DEBUG
(void) SoFieldContainer::findCopy(this, copyconnections);
#endif
SoFieldContainer::copyDone();
// unrefNoDelete() so that we return a copy with reference count 0
cp->unrefNoDelete();
return cp;
}
示例3: checkCopy
SoNode *
SoUnknownNode::addToCopyDict() const
//
////////////////////////////////////////////////////////////////////////
{
// If this node is already in the dictionary, nothing else to do
SoNode *copy = (SoNode *) checkCopy(this);
if (copy == NULL) {
// Create and add a new instance to the dictionary
copy = new SoUnknownNode;
copy->ref();
addCopy(this, copy); // Adds a ref()
copy->unrefNoDelete();
// Recurse on children, if any
for (int i = 0; i < hiddenChildren.getLength(); i++)
hiddenChildren[i]->addToCopyDict();
}
return copy;
}