Skip to content
Snippets Groups Projects
Commit 7eb98da8 authored by Edward Moyse's avatar Edward Moyse
Browse files

Merge branch 'noexcept' into 'master'

Class adjustments: ElementLinkVector Identifier32 SpacePoint

See merge request atlas/athena!35622
parents afe21e23 6e293ac3
No related branches found
No related tags found
No related merge requests found
Showing
with 33 additions and 92 deletions
...@@ -187,7 +187,7 @@ public: ...@@ -187,7 +187,7 @@ public:
/// \name vector constructors (no Allocators) /// \name vector constructors (no Allocators)
//@{ //@{
ElementLinkVector() : ElementLinkVectorBase() { } ElementLinkVector();
ElementLinkVector(size_type n, const ElemLink& link) : ElementLinkVector(size_type n, const ElemLink& link) :
ElementLinkVectorBase(), m_shortRefs(n, ElemLinkRef(link)) ElementLinkVectorBase(), m_shortRefs(n, ElemLinkRef(link))
...@@ -217,7 +217,7 @@ public: ...@@ -217,7 +217,7 @@ public:
ElementLinkVectorBase( vec ), ElementLinkVectorBase( vec ),
m_shortRefs(vec.m_shortRefs), m_hostDObjs(vec.m_hostDObjs) { } m_shortRefs(vec.m_shortRefs), m_hostDObjs(vec.m_hostDObjs) { }
ElementLinkVector(ElemLinkVec&& vec) : ElementLinkVector(ElemLinkVec&& vec) noexcept :
ElementLinkVectorBase( std::move(vec) ), ElementLinkVectorBase( std::move(vec) ),
m_shortRefs(std::move(vec.m_shortRefs)), m_shortRefs(std::move(vec.m_shortRefs)),
m_hostDObjs(std::move(vec.m_hostDObjs)) { } m_hostDObjs(std::move(vec.m_hostDObjs)) { }
...@@ -233,7 +233,7 @@ public: ...@@ -233,7 +233,7 @@ public:
return *this; return *this;
} }
ElementLinkVector& operator= (ElemLinkVec&& vec) ElementLinkVector& operator= (ElemLinkVec&& vec) noexcept
{ {
if (this != &vec) { if (this != &vec) {
m_persKeys = std::move(vec.m_persKeys); m_persKeys = std::move(vec.m_persKeys);
...@@ -416,6 +416,10 @@ private: ...@@ -416,6 +416,10 @@ private:
}; // class ElementLinkVector }; // class ElementLinkVector
template <typename DOBJ>
ElementLinkVector<DOBJ>::ElementLinkVector() : ElementLinkVectorBase() {
}
/* /*
* The following piece of code makes the Reflex dictionary think of * The following piece of code makes the Reflex dictionary think of
* "ElementLinkVector< T, DataProxyStorage< T >, * "ElementLinkVector< T, DataProxyStorage< T >,
......
...@@ -44,10 +44,10 @@ public: ...@@ -44,10 +44,10 @@ public:
explicit Identifier32 (value_type value); explicit Identifier32 (value_type value);
/// Copy constructor /// Copy constructor
Identifier32 (const Identifier32& other); Identifier32 (const Identifier32& other) = default;
/// Assignment. /// Assignment.
Identifier32& operator= (const Identifier32& other); Identifier32& operator= (const Identifier32& other) = default;
///---------------------------------------------------------------- ///----------------------------------------------------------------
/// Modifications /// Modifications
...@@ -130,18 +130,6 @@ inline Identifier32::Identifier32 () ...@@ -130,18 +130,6 @@ inline Identifier32::Identifier32 ()
: m_id(max_value) : m_id(max_value)
{} {}
//-----------------------------------------------
inline Identifier32::Identifier32 (const Identifier32& other)
: m_id(other.m_id)
{}
//-----------------------------------------------
inline Identifier32& Identifier32::operator= (const Identifier32& other)
{
if (this != &other)
m_id = other.m_id;
return *this;
}
//----------------------------------------------- //-----------------------------------------------
inline Identifier32::Identifier32 (value_type value) inline Identifier32::Identifier32 (value_type value)
......
...@@ -56,7 +56,7 @@ namespace InDet ...@@ -56,7 +56,7 @@ namespace InDet
PixelSpacePoint( const PixelSpacePoint & PSP); PixelSpacePoint( const PixelSpacePoint & PSP);
/** Destructor */ /** Destructor */
~PixelSpacePoint(); ~PixelSpacePoint() = default;
/** Overloading assignment operator */ /** Overloading assignment operator */
PixelSpacePoint &operator=(const PixelSpacePoint &); PixelSpacePoint &operator=(const PixelSpacePoint &);
......
...@@ -52,11 +52,11 @@ namespace InDet ...@@ -52,11 +52,11 @@ namespace InDet
//@{ //@{
SCT_SpacePoint(const std::pair<IdentifierHash, IdentifierHash>& elementIdList, SCT_SpacePoint(const std::pair<IdentifierHash, IdentifierHash>& elementIdList,
const Amg::Vector3D& position, const Amg::Vector3D& position,
const std::pair<const Trk::PrepRawData*, const Trk::PrepRawData*>* clusList) ; const std::pair<const Trk::PrepRawData*, const Trk::PrepRawData*>& clusList) ;
//@} //@}
/** Copy Constructor */ /** Copy Constructor */
SCT_SpacePoint(const SCT_SpacePoint &) ; SCT_SpacePoint(const SCT_SpacePoint &);
/** Destructor */ /** Destructor */
virtual ~SCT_SpacePoint() = default; virtual ~SCT_SpacePoint() = default;
...@@ -81,7 +81,7 @@ namespace InDet ...@@ -81,7 +81,7 @@ namespace InDet
/** common method used in constructors. */ /** common method used in constructors. */
void setup(const std::pair<IdentifierHash, IdentifierHash>& elementIdList, void setup(const std::pair<IdentifierHash, IdentifierHash>& elementIdList,
const Amg::Vector3D& position, const Amg::Vector3D& position,
const std::pair<const Trk::PrepRawData*, const Trk::PrepRawData*>* clusList); const std::pair<const Trk::PrepRawData*, const Trk::PrepRawData*>& clusList);
}; };
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
......
...@@ -36,7 +36,7 @@ namespace InDet ...@@ -36,7 +36,7 @@ namespace InDet
assert (tmpPos) ; assert (tmpPos) ;
m_position = *tmpPos; m_position = *tmpPos;
m_clusList = new std::pair<const Trk::PrepRawData*, const Trk::PrepRawData*>(clus,nullptr); m_clusList = {clus,nullptr};
m_elemIdList.first = elementId ; m_elemIdList.first = elementId ;
m_elemIdList.second = 0 ; m_elemIdList.second = 0 ;
setupGlobalFromLocalCovariance(); setupGlobalFromLocalCovariance();
...@@ -55,7 +55,7 @@ namespace InDet ...@@ -55,7 +55,7 @@ namespace InDet
assert (clus!=nullptr); assert (clus!=nullptr);
m_position = globpos; m_position = globpos;
m_globalCovariance = globcov; m_globalCovariance = globcov;
m_clusList = new std::pair<const Trk::PrepRawData*, const Trk::PrepRawData*>(clus,nullptr); m_clusList = {clus,nullptr};
m_elemIdList.first = elementId ; m_elemIdList.first = elementId ;
m_elemIdList.second = 0 ; m_elemIdList.second = 0 ;
} }
...@@ -68,11 +68,6 @@ namespace InDet ...@@ -68,11 +68,6 @@ namespace InDet
SpacePoint(PSP) SpacePoint(PSP)
{} {}
//-------------------------------------------------------------
/** Destructor */
PixelSpacePoint::~PixelSpacePoint()
{}
//------------------------------------------------------------- //-------------------------------------------------------------
......
...@@ -18,13 +18,14 @@ namespace InDet ...@@ -18,13 +18,14 @@ namespace InDet
SCT_SpacePoint::SCT_SpacePoint() SCT_SpacePoint::SCT_SpacePoint()
: :
Trk::SpacePoint() Trk::SpacePoint()
{} {
}
//------------------------------------------------------------- //-------------------------------------------------------------
SCT_SpacePoint::SCT_SpacePoint(const std::pair<IdentifierHash, IdentifierHash>& elementIdList, SCT_SpacePoint::SCT_SpacePoint(const std::pair<IdentifierHash, IdentifierHash>& elementIdList,
const Amg::Vector3D& position, const Amg::Vector3D& position,
const std::pair<const Trk::PrepRawData*, const Trk::PrepRawData*>* clusList) const std::pair<const Trk::PrepRawData*, const Trk::PrepRawData*> &clusList)
: :
Trk::SpacePoint() Trk::SpacePoint()
{ {
...@@ -37,15 +38,15 @@ namespace InDet ...@@ -37,15 +38,15 @@ namespace InDet
void SCT_SpacePoint::setup(const std::pair<IdentifierHash, IdentifierHash>& elementIdList, void SCT_SpacePoint::setup(const std::pair<IdentifierHash, IdentifierHash>& elementIdList,
const Amg::Vector3D& position, const Amg::Vector3D& position,
const std::pair<const Trk::PrepRawData*, const Trk::PrepRawData*>* clusList) const std::pair<const Trk::PrepRawData*, const Trk::PrepRawData*>& clusList)
{ {
m_clusList = clusList ; m_clusList = clusList ;
m_position = position ; m_position = position ;
m_elemIdList.first = elementIdList.first ; m_elemIdList.first = elementIdList.first ;
m_elemIdList.second = elementIdList.second ; m_elemIdList.second = elementIdList.second ;
assert( (clusList->first!=0) && (clusList->second!=0) ); assert( (clusList.first!=0) && (clusList.second!=0) );
assert(clusList->first->detectorElement()) ; assert(clusList.first->detectorElement()) ;
std::unique_ptr<const Amg::Vector2D> locpos{clusList->first->detectorElement()->surface().globalToLocal(position)}; std::unique_ptr<const Amg::Vector2D> locpos{clusList.first->detectorElement()->surface().globalToLocal(position)};
assert(locpos); assert(locpos);
Trk::MeasurementBase::m_localParams = Trk::LocalParameters(*locpos ) ; Trk::MeasurementBase::m_localParams = Trk::LocalParameters(*locpos ) ;
......
...@@ -167,9 +167,7 @@ namespace InDet { ...@@ -167,9 +167,7 @@ namespace InDet {
if (ok) { if (ok) {
ATH_MSG_VERBOSE( "SpacePoint generated at: ( " << point.x() << " , " << point.y() << " , " << point.z() << " ) " ); ATH_MSG_VERBOSE( "SpacePoint generated at: ( " << point.x() << " , " << point.y() << " , " << point.z() << " ) " );
const std::pair<IdentifierHash,IdentifierHash> elementIdList( element1->identifyHash() , element2->identifyHash() ); const std::pair<IdentifierHash,IdentifierHash> elementIdList( element1->identifyHash() , element2->identifyHash() );
const std::pair<const Trk::PrepRawData*, const Trk::PrepRawData*>* return new InDet::SCT_SpacePoint(elementIdList, point, {&cluster1, &cluster2});
clusList = new std::pair<const Trk::PrepRawData*, const Trk::PrepRawData*>(&cluster1, &cluster2);
return new InDet::SCT_SpacePoint(elementIdList, point, clusList);
} }
return nullptr; return nullptr;
...@@ -287,7 +285,6 @@ namespace InDet { ...@@ -287,7 +285,6 @@ namespace InDet {
} }
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
void SiSpacePointMakerTool::fillSCT_SpacePointEtaOverlapCollection(const InDet::SCT_ClusterCollection* clusters1, void SiSpacePointMakerTool::fillSCT_SpacePointEtaOverlapCollection(const InDet::SCT_ClusterCollection* clusters1,
const InDet::SCT_ClusterCollection* clusters2, const InDet::SCT_ClusterCollection* clusters2,
...@@ -732,9 +729,7 @@ namespace InDet { ...@@ -732,9 +729,7 @@ namespace InDet {
Amg::Vector3D point(In0.position(m)); Amg::Vector3D point(In0.position(m));
const std::pair<IdentifierHash,IdentifierHash> elementIdList(ID0,ID1); const std::pair<IdentifierHash,IdentifierHash> elementIdList(ID0,ID1);
const std::pair<const Trk::PrepRawData*,const Trk::PrepRawData*>* return new InDet::SCT_SpacePoint(elementIdList, point, {In0.cluster(),In1.cluster()});
clusList = new std::pair<const Trk::PrepRawData*,const Trk::PrepRawData*>(In0.cluster(),In1.cluster());
return new InDet::SCT_SpacePoint(elementIdList, point, clusList);
} }
} }
...@@ -23,7 +23,7 @@ class Identifier ...@@ -23,7 +23,7 @@ class Identifier
} max_value_type; } max_value_type;
Identifier():m_id(max_value) {}; Identifier():m_id(max_value) {};
Identifier(const Identifier& value):m_id(value.m_id) {}; Identifier(const Identifier& value):m_id(value.m_id) = default;
Identifier(value_type value):m_id(value) {}; Identifier(value_type value):m_id(value) {};
operator value_type() const { return m_id; } operator value_type() const { return m_id; }
......
...@@ -38,10 +38,10 @@ namespace Trk{ ...@@ -38,10 +38,10 @@ namespace Trk{
public: public:
// public because of DataPool // public because of DataPool
SpacePoint(); SpacePoint();
SpacePoint(const SpacePoint &); SpacePoint(const SpacePoint &) = default;
SpacePoint &operator=(const SpacePoint &); SpacePoint &operator=(const SpacePoint &) = default;
// Destructor: // Destructor:
virtual ~SpacePoint(); virtual ~SpacePoint() = default;
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
// Const methods: // Const methods:
...@@ -89,7 +89,7 @@ namespace Trk{ ...@@ -89,7 +89,7 @@ namespace Trk{
virtual std::ostream& dump( std::ostream& out ) const override=0 ; virtual std::ostream& dump( std::ostream& out ) const override=0 ;
protected: protected:
const std::pair<const PrepRawData*, const PrepRawData*> *m_clusList; std::pair<const PrepRawData*, const PrepRawData*> m_clusList;
std::pair<IdentifierHash, IdentifierHash> m_elemIdList; std::pair<IdentifierHash, IdentifierHash> m_elemIdList;
Amg::Vector3D m_position; Amg::Vector3D m_position;
Amg::MatrixX m_globalCovariance; Amg::MatrixX m_globalCovariance;
...@@ -117,8 +117,7 @@ namespace Trk{ ...@@ -117,8 +117,7 @@ namespace Trk{
inline const std::pair<const PrepRawData*, const PrepRawData*>& SpacePoint::clusterList() const inline const std::pair<const PrepRawData*, const PrepRawData*>& SpacePoint::clusterList() const
{ {
assert(m_clusList!=0); return m_clusList;
return *m_clusList;
} }
inline double SpacePoint::eta(double z0) const inline double SpacePoint::eta(double z0) const
......
...@@ -23,18 +23,13 @@ ...@@ -23,18 +23,13 @@
namespace Trk namespace Trk
{ {
// Destructor:
SpacePoint::~SpacePoint()
{
delete m_clusList;
}
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Default constructor // Default constructor
SpacePoint::SpacePoint() SpacePoint::SpacePoint()
: :
m_clusList(nullptr), m_clusList(nullptr, nullptr),
m_elemIdList(0,0), m_elemIdList(0,0),
m_position(), m_position(),
m_globalCovariance() m_globalCovariance()
...@@ -43,42 +38,6 @@ namespace Trk ...@@ -43,42 +38,6 @@ namespace Trk
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// copy constructor
SpacePoint::SpacePoint(const SpacePoint & SP) :
Trk::MeasurementBase(SP)
{
m_elemIdList = SP.m_elemIdList;
m_position = SP.m_position;
if (SP.m_clusList){
m_clusList = new std::pair<const PrepRawData*, const PrepRawData*>(*SP.m_clusList);
} else {
m_clusList=nullptr;
}
m_globalCovariance = SP.m_globalCovariance;
}
// ------------------------------------------------------------------
//assignment operator
SpacePoint& SpacePoint::operator=(const SpacePoint& SP)
{
if (&SP !=this)
{
Trk::MeasurementBase::operator=(SP);
delete m_clusList;
m_elemIdList = SP.m_elemIdList;
m_position = SP.m_position;
if (SP.m_clusList){
m_clusList = new std::pair<const PrepRawData*, const PrepRawData*>(*SP.m_clusList);
} else {
m_clusList=nullptr;
}
m_globalCovariance = SP.m_globalCovariance;
}
return *this;
}
// ------------------------------------------------------------------
/**Overload of << operator for both, MsgStream and std::ostream for debug output*/ /**Overload of << operator for both, MsgStream and std::ostream for debug output*/
MsgStream& operator << ( MsgStream& sl, const Trk::SpacePoint& spacePoint) MsgStream& operator << ( MsgStream& sl, const Trk::SpacePoint& spacePoint)
...@@ -113,8 +72,8 @@ namespace Trk ...@@ -113,8 +72,8 @@ namespace Trk
const Surface& SpacePoint::associatedSurface() const const Surface& SpacePoint::associatedSurface() const
{ {
assert(m_clusList->first->detectorElement()); assert(m_clusList.first->detectorElement());
return m_clusList->first->detectorElement()->surface(); return m_clusList.first->detectorElement()->surface();
} }
} // end of namespace } // end of namespace
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment