refactor: replace raw object pointers with SmartPointer in ObjectsContext and update dependent codebases

This commit is contained in:
AndreaRigoni
2026-04-17 13:28:24 +00:00
parent c62ed483f1
commit 61888d36f5
2 changed files with 2 additions and 0 deletions

View File

@@ -425,6 +425,7 @@ void ReferencePropertyWidget::refreshCombo() {
Object* currentRef = m_RefProp->GetReferencedObject(); Object* currentRef = m_RefProp->GetReferencedObject();
if (m_Context) { if (m_Context) {
const auto& objects = m_Context->GetObjects();
for (const auto& obj : objects) { for (const auto& obj : objects) {
if (m_RefProp->IsCompatible(obj.get())) { if (m_RefProp->IsCompatible(obj.get())) {
QString label = QString::fromStdString(obj->GetInstanceName()); QString label = QString::fromStdString(obj->GetInstanceName());

View File

@@ -11,6 +11,7 @@ SmartPointer is a class that is used to hold a reference to another object. It i
The ObjectContext is responsible to keep track of all the objects that are added to it and to provide a way to access them, but also it holds the SmartPointer instances that point to the objects that are added to it. In this way Objects added to a Context are disposed only when the context is destroyed. The ObjectContext is responsible to keep track of all the objects that are added to it and to provide a way to access them, but also it holds the SmartPointer instances that point to the objects that are added to it. In this way Objects added to a Context are disposed only when the context is destroyed.
For this reason the access to a object context for a Object via Get/Set is done using the SmartPointer instances. For this reason the access to a object context for a Object via Get/Set is done using the SmartPointer instances.
## Geant Physical Volumes ## Geant Physical Volumes
The Geant library add a further layer of complexity. The physical volumes are created from a what is called LogicalVolume (which holds information about the shape, material and daughter volumes) and represent the actual instances of the volumes in the detector. So in this sense they represent what could be the Prop3D in the uLib Vtk library. The PhysicalVolume is created from the LogicalVolume and is the one that is actually placed in the scene, with its own relative TRS: position and rotation (rotation here is a rotation matrix comprising the scaling). The Geant library add a further layer of complexity. The physical volumes are created from a what is called LogicalVolume (which holds information about the shape, material and daughter volumes) and represent the actual instances of the volumes in the detector. So in this sense they represent what could be the Prop3D in the uLib Vtk library. The PhysicalVolume is created from the LogicalVolume and is the one that is actually placed in the scene, with its own relative TRS: position and rotation (rotation here is a rotation matrix comprising the scaling).