本文整理汇总了C++中GetFieldHandlePtr::getContainer方法的典型用法代码示例。如果您正苦于以下问题:C++ GetFieldHandlePtr::getContainer方法的具体用法?C++ GetFieldHandlePtr::getContainer怎么用?C++ GetFieldHandlePtr::getContainer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GetFieldHandlePtr
的用法示例。
在下文中一共展示了GetFieldHandlePtr::getContainer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addConnection
OSG_BEGIN_NAMESPACE
/*---------------------------------------------------------------------*/
/*! \name Connection handling */
/*! \{ */
/*! \ingroup GrpBaseFieldContainerConnector
\relatesalso AttachmentContainer
*/
bool addConnection( OSG::AttachmentContainer *pSrcContainer,
const OSG::Char8 *szSrcName,
OSG::FieldContainer *pDstContainer,
const OSG::Char8 *szDstName )
{
if(pSrcContainer == NULL || szSrcName == NULL ||
pDstContainer == NULL || szDstName == NULL )
{
return false;
}
const FieldDescriptionBase *pSrcDesc = NULL;
const FieldDescriptionBase *pDstDesc = NULL;
GetFieldHandlePtr pSrcHnd = pSrcContainer->getField(szSrcName);
GetFieldHandlePtr pDstHnd = pDstContainer->getField(szDstName);
if(pSrcHnd != NULL && pSrcHnd->isValid() == true)
{
pSrcDesc = pSrcHnd->getDescription();
}
if(pDstHnd != NULL && pDstHnd->isValid() == true)
{
pDstDesc = pDstHnd->getDescription();
}
// check core for node
if(pSrcDesc == NULL)
{
Node *pNode = dynamic_cast<Node *>(pSrcContainer);
if(pNode != NULL && pNode->getCore() != NULL)
{
pSrcHnd = pNode->getCore()->getField(szSrcName);
if(pSrcHnd != NULL && pSrcHnd->isValid() == true)
{
pSrcDesc = pSrcHnd->getDescription();
}
}
}
// same here
if(pDstDesc == NULL)
{
Node *pNode = dynamic_cast<Node *>(pDstContainer);
if(pNode != NULL && pNode->getCore() != NULL)
{
pDstHnd = pNode->getCore()->getField(szDstName);
if(pDstHnd != NULL && pDstHnd->isValid() == true)
{
pDstDesc = pDstHnd->getDescription();
}
}
}
if(pSrcDesc == NULL || pDstDesc == NULL)
{
FWARNING(("addConnection: Failed to obtain field descriptions for "
"source container [%p] field [%s] desc [%p] - "
"destination container [%p] field [%s] desc [%p]\n",
static_cast<void *>(pSrcContainer),
szSrcName,
static_cast<const void *>(pSrcDesc),
static_cast<void *>(pDstContainer),
szDstName,
static_cast<const void *>(pDstDesc) ));
return false;
}
const Field *pSrcField = pSrcHnd->getField();
Field *pDstField = const_cast<Field *>(pDstHnd->getField());
pSrcContainer =
dynamic_cast<AttachmentContainer *>(pSrcHnd->getContainer());
pDstContainer =
dynamic_cast<FieldContainer *>(pDstHnd->getContainer());
if(pSrcContainer == NULL || pDstContainer == NULL)
{
FWARNING(("addConnection: Failed to obtain field handles for "
"source container [%p] - destination container [%p]\n",
static_cast<void *>(pSrcContainer),
static_cast<void *>(pDstContainer)));
//.........这里部分代码省略.........
示例2: subConnection
bool subConnection( OSG::AttachmentContainer *pSrcContainer,
const OSG::Char8 *szSrcName,
OSG::FieldContainer *pDstContainer,
const OSG::Char8 *szDstName )
{
if(pSrcContainer == NULL)
{
return false;
}
const FieldDescriptionBase *pSrcDesc = NULL;
GetFieldHandlePtr pSrcHnd;
if(szSrcName != NULL)
{
pSrcHnd = pSrcContainer->getField(szSrcName);
if(pSrcHnd != NULL && pSrcHnd->isValid() == true)
{
pSrcDesc = pSrcHnd->getDescription();
}
// check core for node
if(pSrcDesc == NULL)
{
Node *pNode = dynamic_cast<Node *>(pSrcContainer);
if(pNode != NULL && pNode->getCore() != NULL)
{
pSrcHnd = pNode->getCore()->getField(szSrcName);
if(pSrcHnd != NULL && pSrcHnd->isValid() == true)
{
pSrcDesc = pSrcHnd->getDescription();
}
}
}
}
const FieldDescriptionBase *pDstDesc = NULL;
GetFieldHandlePtr pDstHnd;
if(pDstContainer != NULL && szDstName != NULL)
{
pDstHnd = pDstContainer->getField(szDstName);
if(pDstHnd != NULL && pDstHnd->isValid() == true)
{
pDstDesc = pDstHnd->getDescription();
}
// same here
if(pDstDesc == NULL)
{
Node *pNode = dynamic_cast<Node *>(pDstContainer);
if(pNode != NULL && pNode->getCore() != NULL)
{
pDstHnd = pNode->getCore()->getField(szDstName);
if(pDstHnd != NULL && pDstHnd->isValid() == true)
{
pDstDesc = pDstHnd->getDescription();
}
}
}
}
#if 0
if(pSrcDesc == NULL)
{
FWARNING(("subConnection: Failed to obtain field description for: "
"source container [%p] field [%s]\n",
pSrcContainer, szSrcName));
return false;
}
#endif
BitVector bSrcMask = TypeTraits<BitVector>::BitsClear;
BitVector bDstMask = TypeTraits<BitVector>::BitsClear;
if(pSrcDesc != NULL)
{
bSrcMask = pSrcDesc->getFieldMask();
pSrcContainer =
dynamic_cast<AttachmentContainer *>(pSrcHnd->getContainer());
}
else if(szSrcName == NULL)
{
bSrcMask = TypeTraits<BitVector>::BitsSet;
}
if(pDstDesc != NULL)
//.........这里部分代码省略.........