GeoModel - GeoModelCore
RCBase.cxx
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "GeoModelKernel/RCBase.h"
6 #include <exception>
7 
8 RCBase::RCBase()
9  : m_count(0)
10 {
11 }
12 
13 RCBase::~RCBase()
14 {
15 }
16 
17 void RCBase::ref () const
18 {
19  m_count++;
20 }
21 
22 void RCBase::unref () const
23 {
24  if (m_count.load()>0) {
25  m_count--;
26  if (m_count.load()==0) delete this;
27  }
28 }
29 
30 unsigned int RCBase::refCount () const
31 {
32  return m_count.load();
33 }