mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-04 12:40:58 -06:00
Do not use smart pointer in this class
p4#: 20875
This commit is contained in:
parent
99917c60ad
commit
231004c709
@ -126,6 +126,10 @@ public:
|
||||
///
|
||||
void parentObjects(std::vector<PdmObject*>& objects) const;
|
||||
|
||||
///
|
||||
template <typename T>
|
||||
void parentObjectsOfType(std::vector<T*>& objects) const;
|
||||
|
||||
/// Method to be called from the Ui classes creating Auto Gui to get the group information
|
||||
/// supplied by the \sa defineUiOrdering method that can be reimplemented
|
||||
void uiOrdering(QString uiConfigName, PdmUiOrdering& uiOrdering) const;
|
||||
@ -210,4 +214,24 @@ private:
|
||||
std::set<PdmObject**> m_pointersReferencingMe;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
void PdmObject::parentObjectsOfType(std::vector<T*>& objects) const
|
||||
{
|
||||
std::vector<caf::PdmFieldHandle*> parentFields;
|
||||
this->parentFields(parentFields);
|
||||
|
||||
for (size_t i = 0; i < parentFields.size(); i++)
|
||||
{
|
||||
T* objectOfType = dynamic_cast<T*>(parentFields[i]->ownerObject());
|
||||
if (objectOfType)
|
||||
{
|
||||
objects.push_back(objectOfType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // End of namespace caf
|
||||
|
Loading…
Reference in New Issue
Block a user