util/ReferenceCounterBase.cpp

Go to the documentation of this file.
00001 /*------------------------------------------------------------------------------
00002 Name:      ReferenceCounterBase.cpp
00003 Project:   xmlBlaster.org
00004 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
00005 Comment:   Helper class to be used as a base for classes to be reference counted
00006 Version:   $Id: ReferenceCounterBase.cpp 16474 2007-09-06 22:34:23Z laghi $
00007 ------------------------------------------------------------------------------*/
00008 
00009 #include <util/ReferenceCounterBase.h>
00010 
00011 namespace org { namespace xmlBlaster { namespace util {
00012 
00017 ReferenceCounterBase::ReferenceCounterBase()
00018    : refCount_(0)
00019 {
00020 }
00021 
00022 ReferenceCounterBase::ReferenceCounterBase(const ReferenceCounterBase& /*ref*/)
00023    :   refCount_(0)
00024 {
00025 }
00026 
00027 
00028 ReferenceCounterBase& ReferenceCounterBase::operator =(const ReferenceCounterBase& /*ref*/)
00029 {
00030    return *this;
00031 }
00032 
00033 
00034 ReferenceCounterBase::~ReferenceCounterBase()
00035 {
00036 }
00037 
00038 
00039 void ReferenceCounterBase::addReference() const
00040 {
00041    ++refCount_;
00042 }
00043 
00044 void ReferenceCounterBase::removeReference()
00045 {
00046    if (--refCount_ == 0) delete this;
00047 }
00048 
00049 /*
00050 void ReferenceCounterBase::markUnshareable()
00051 {
00052    shareable_ = false;
00053 }
00054 
00055 bool ReferenceCounterBase::isShareable() const
00056 {
00057    return shareable_;
00058 }
00059 
00060 bool ReferenceCounterBase::isShared() const
00061 {
00062    return refCount_ > 1;
00063 }
00064 
00065 */
00066 
00067 }}} // namespace
00068