mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fwk : Add function to get all referenced PdmObjects
This commit is contained in:
@@ -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