Skip to content
Snippets Groups Projects
Commit c4f40fa9 authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

GeoTessellatedSolid: migrate to the usage of GeoIntrusivePtr

parent 75515fb6
No related branches found
No related tags found
1 merge request!241GeoTessellatedSolid: migrate to the usage of GeoIntrusivePtr
Pipeline #6651914 passed
......@@ -7,6 +7,7 @@
#include "GeoModelKernel/GeoShape.h"
#include "GeoModelKernel/GeoFacet.h"
#include "GeoModelKernel/GeoIntrusivePtr.h"
class GeoTessellatedSolid : public GeoShape {
public:
......@@ -42,14 +43,14 @@ class GeoTessellatedSolid : public GeoShape {
static ShapeType getClassTypeID();
// Executes a GeoShapeAction
virtual void exec(GeoShapeAction *action) const;
virtual void exec(GeoShapeAction* action) const;
// Add another facet to the tessellated solid. A minimum of four
// facets are required to create a valid tesselated solid.
void addFacet(GeoFacet*);
void addFacet(GeoFacet* facet);
// Returns specified facet
GeoFacet* getFacet(size_t) const;
GeoFacet* getFacet(size_t index) const;
// Returns the number of facets
size_t getNumberOfFacets() const;
......@@ -59,15 +60,13 @@ class GeoTessellatedSolid : public GeoShape {
bool isValid () const;
protected:
virtual ~GeoTessellatedSolid();
virtual ~GeoTessellatedSolid() = default;
private:
static const std::string s_classType;
static const ShapeType s_classTypeID;
std::vector<GeoFacet*> m_facets;
std::vector<GeoIntrusivePtr<GeoFacet>> m_facets;
};
inline const std::string& GeoTessellatedSolid::getClassType()
......
/*
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/GeoTessellatedSolid.h"
......@@ -13,12 +13,6 @@ GeoTessellatedSolid::GeoTessellatedSolid()
{
}
GeoTessellatedSolid::~GeoTessellatedSolid()
{
for(size_t i=0; i<m_facets.size(); ++i)
m_facets[i]->unref();
}
double GeoTessellatedSolid::volume() const
{
if (!isValid ())
......@@ -81,13 +75,12 @@ void GeoTessellatedSolid::exec(GeoShapeAction *action) const
void GeoTessellatedSolid::addFacet(GeoFacet* facet)
{
facet->ref();
m_facets.push_back(facet);
}
GeoFacet* GeoTessellatedSolid::getFacet(size_t index) const
{
return (index<m_facets.size() ? m_facets[index] : 0);
return (index<m_facets.size() ? m_facets.at(index) : nullptr);
}
size_t GeoTessellatedSolid::getNumberOfFacets() const
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment