Skip to content
Snippets Groups Projects
Commit 14647610 authored by Johannes Junggeburth's avatar Johannes Junggeburth :dog2:
Browse files

GeoLogVol - Use GeoIntusivePtr instead of manual refernce counting

parent 818df80e
No related branches found
No related tags found
1 merge request!227GeoLogVol - Use GeoIntusivePtr instead of manual refernce counting
Pipeline #6588461 passed
/* /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
*/ */
#ifndef GEOMODELKERNEL_GEOLOGVOL_H #ifndef GEOMODELKERNEL_GEOLOGVOL_H
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "GeoModelKernel/GeoShape.h" #include "GeoModelKernel/GeoShape.h"
#include "GeoModelKernel/RCBase.h" #include "GeoModelKernel/RCBase.h"
#include "GeoModelKernel/GeoIntrusivePtr.h"
#include "GeoModelKernel/GeoMaterial.h" #include "GeoModelKernel/GeoMaterial.h"
#include <vector> #include <vector>
...@@ -23,44 +24,34 @@ class GeoLogVol : public RCBase ...@@ -23,44 +24,34 @@ class GeoLogVol : public RCBase
GeoLogVol (const std::string &Name, const GeoShape *Shape, const GeoMaterial *Material); GeoLogVol (const std::string &Name, const GeoShape *Shape, const GeoMaterial *Material);
// Returns the name of the logical volume. // Returns the name of the logical volume.
const std::string & getName () const; const std::string & getName () const {
return m_name;
}
// Returns the shape of the logical volume. // Returns the shape of the logical volume.
const GeoShape * getShape () const; const GeoShape* getShape () const {
return m_shape;
}
// Returns the material of the logical volume. // Returns the material of the logical volume.
const GeoMaterial * getMaterial () const; const GeoMaterial* getMaterial () const {
return m_material;
}
protected: protected:
virtual ~GeoLogVol(); virtual ~GeoLogVol() = default;
private: private:
GeoLogVol(const GeoLogVol &right);
GeoLogVol & operator=(const GeoLogVol &right);
// The name of the logical volume. // The name of the logical volume.
std::string m_name; std::string m_name{};
// Material composition of this volume. // Material composition of this volume.
const GeoMaterial *m_material; GeoIntrusivePtr<const GeoMaterial> m_material{};
// Shape of this volume. // Shape of this volume.
const GeoShape *m_shape; GeoIntrusivePtr<const GeoShape> m_shape{};
}; };
inline const std::string & GeoLogVol::getName () const
{
return m_name;
}
inline const GeoShape * GeoLogVol::getShape () const
{
return m_shape;
}
inline const GeoMaterial * GeoLogVol::getMaterial () const
{
return m_material;
}
#endif #endif
/* /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
*/ */
#include "GeoModelKernel/GeoLogVol.h" #include "GeoModelKernel/GeoLogVol.h"
...@@ -7,15 +7,5 @@ ...@@ -7,15 +7,5 @@
GeoLogVol::GeoLogVol (const std::string &Name, const GeoShape *Shape, const GeoMaterial *Material) GeoLogVol::GeoLogVol (const std::string &Name, const GeoShape *Shape, const GeoMaterial *Material)
: m_name (Name) : m_name (Name)
, m_material (Material) , m_material (Material)
, m_shape (Shape) , m_shape (Shape){}
{
m_material->ref ();
m_shape->ref ();
}
GeoLogVol::~GeoLogVol()
{
m_material->unref ();
m_shape->unref ();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment