mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Use concept of parentObjectsOfType to avoid dynamic cast in application code.
p4#: 20887
This commit is contained in:
@@ -647,18 +647,18 @@ void RimUiTreeView::slotWriteInputProperty()
|
||||
// Find input reservoir for this property
|
||||
RimInputReservoir* inputReservoir = NULL;
|
||||
{
|
||||
std::vector<caf::PdmObject*> parentObjects;
|
||||
inputProperty->parentObjects(parentObjects);
|
||||
std::vector<RimInputPropertyCollection*> parentObjects;
|
||||
inputProperty->parentObjectsOfType(parentObjects);
|
||||
CVF_ASSERT(parentObjects.size() == 1);
|
||||
|
||||
RimInputPropertyCollection* inputPropertyCollection = dynamic_cast<RimInputPropertyCollection*>(parentObjects[0]);
|
||||
RimInputPropertyCollection* inputPropertyCollection = parentObjects[0];
|
||||
if (!inputPropertyCollection) return;
|
||||
|
||||
std::vector<caf::PdmObject*> parentObjects2;
|
||||
inputPropertyCollection->parentObjects(parentObjects2);
|
||||
std::vector<RimInputReservoir*> parentObjects2;
|
||||
inputPropertyCollection->parentObjectsOfType(parentObjects2);
|
||||
CVF_ASSERT(parentObjects2.size() == 1);
|
||||
|
||||
inputReservoir = dynamic_cast<RimInputReservoir*>(parentObjects2[0]);
|
||||
inputReservoir = parentObjects2[0];
|
||||
}
|
||||
|
||||
if (!inputReservoir) return;
|
||||
|
||||
Reference in New Issue
Block a user