test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
BasicReferenceCounted Class Reference

#include <ReferenceCounted.h>

Inheritance diagram for BasicReferenceCounted:
NavSurface reco::BasicGhostTrackState reco::BasicTransientTrack Surface NavCone NavCylinder NavPlane reco::TrackGhostTrackState reco::VertexGhostTrackState reco::GsfTransientTrack reco::TrackTransientTrack reco::TransientTrackFromFTS Cone Cylinder Plane

Public Member Functions

void addReference () const
 
 BasicReferenceCounted ()
 
 BasicReferenceCounted (const BasicReferenceCounted &iRHS)
 
const BasicReferenceCountedoperator= (const BasicReferenceCounted &)
 
unsigned int references () const
 
void removeReference () const
 
virtual ~BasicReferenceCounted ()
 

Private Attributes

std::atomic< unsigned int > referenceCount_
 

Detailed Description

Definition at line 31 of file ReferenceCounted.h.

Constructor & Destructor Documentation

BasicReferenceCounted::BasicReferenceCounted ( )
inline

Definition at line 35 of file ReferenceCounted.h.

35 : referenceCount_(0) {}
std::atomic< unsigned int > referenceCount_
BasicReferenceCounted::BasicReferenceCounted ( const BasicReferenceCounted iRHS)
inline

Definition at line 36 of file ReferenceCounted.h.

36 : referenceCount_(0) {}
std::atomic< unsigned int > referenceCount_
virtual BasicReferenceCounted::~BasicReferenceCounted ( )
inlinevirtual

Definition at line 41 of file ReferenceCounted.h.

41 {}

Member Function Documentation

void BasicReferenceCounted::addReference ( ) const
inline

Definition at line 46 of file ReferenceCounted.h.

References referenceCount_.

Referenced by PixelTrackBuilder::build(), and intrusive_ptr_add_ref().

46 { referenceCount_.fetch_add(1,std::memory_order_acq_rel) ; }
std::atomic< unsigned int > referenceCount_
const BasicReferenceCounted& BasicReferenceCounted::operator= ( const BasicReferenceCounted )
inline

Definition at line 38 of file ReferenceCounted.h.

38  {
39  return *this;
40  }
unsigned int BasicReferenceCounted::references ( ) const
inline

Definition at line 52 of file ReferenceCounted.h.

References referenceCount_.

52 {return referenceCount_.load(std::memory_order_acquire);}
std::atomic< unsigned int > referenceCount_
void BasicReferenceCounted::removeReference ( ) const
inline

Definition at line 47 of file ReferenceCounted.h.

References referenceCount_.

Referenced by intrusive_ptr_release().

47  { if( 1 == referenceCount_.fetch_sub(1,std::memory_order_acq_rel ) ) {
48  delete const_cast<BasicReferenceCounted*>(this);
49  }
50  }
std::atomic< unsigned int > referenceCount_

Member Data Documentation

std::atomic<unsigned int> BasicReferenceCounted::referenceCount_
mutableprivate

Definition at line 67 of file ReferenceCounted.h.

Referenced by addReference(), references(), and removeReference().