mirror of
https://github.com/OPM/ResInsight.git
synced 2026-11-13 01:26:19 -06:00
Fwk : Add function to get all referenced PdmObjects
This commit is contained in:
1 parent
86bdf5722a
commit
a4a6c30370
2 files changed
+35
No files matched your search
@@ -56,6 +56,36 @@ caf::PdmObject* cafTreeNode::referencedObject() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<caf::PdmObject*> cafTreeNode::allReferencedObjects() const
|
||||
{
|
||||
std::vector<caf::PdmObject*> objects;
|
||||
|
||||
allReferencedObjectsRecursively( this, objects );
|
||||
|
||||
return objects;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void cafTreeNode::allReferencedObjectsRecursively( const cafTreeNode* node, std::vector<caf::PdmObject*>& objects )
|
||||
{
|
||||
if ( auto obj = node->referencedObject() )
|
||||
{
|
||||
objects.push_back( obj );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
for ( auto c : node->childNodes() )
|
||||
{
|
||||
allReferencedObjectsRecursively( c, objects );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
|
||||
Reference in new issue
Block a user