Do not use smart pointer in this class

p4#: 20875
This commit is contained in:
Magne Sjaastad 2013-03-13 11:38:46 +01:00
parent 99917c60ad
commit 231004c709

View File

@ -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