1 /*------------------------------------------------------------------------------
2 Name: ReferenceCounterBase.cpp
3 Project: xmlBlaster.org
4 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
5 Comment: Helper class to be used as a base for classes to be reference counted
6 Version: $Id: ReferenceCounterBase.cpp 16474 2007-09-06 22:34:23Z laghi $
7 ------------------------------------------------------------------------------*/
8
9 #include <util/ReferenceCounterBase.h>
10
11 namespace org { namespace xmlBlaster { namespace util {
12
13 /**
14 * @author <a href="mailto:michele@laghi.eu">Michele Laghi</a>
15 */
16
17 ReferenceCounterBase::ReferenceCounterBase()
18 : refCount_(0)
19 {
20 }
21
22 ReferenceCounterBase::ReferenceCounterBase(const ReferenceCounterBase& /*ref*/)
23 : refCount_(0)
24 {
25 }
26
27
28 ReferenceCounterBase& ReferenceCounterBase::operator =(const ReferenceCounterBase& /*ref*/)
29 {
30 return *this;
31 }
32
33
34 ReferenceCounterBase::~ReferenceCounterBase()
35 {
36 }
37
38
39 void ReferenceCounterBase::addReference() const
40 {
41 ++refCount_;
42 }
43
44 void ReferenceCounterBase::removeReference()
45 {
46 if (--refCount_ == 0) delete this;
47 }
48
49 /*
50 void ReferenceCounterBase::markUnshareable()
51 {
52 shareable_ = false;
53 }
54
55 bool ReferenceCounterBase::isShareable() const
56 {
57 return shareable_;
58 }
59
60 bool ReferenceCounterBase::isShared() const
61 {
62 return refCount_ > 1;
63 }
64
65 */
66
67 }}} // namespace
syntax highlighted by Code2HTML, v. 0.9.1