X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmRefCounter.h;h=25ecce970a16e4be7459acea78ed082eb4c54042;hb=0bcc188c6d5185375f809253e8b9b97c856d2eac;hp=a5e39fe34eaed7c9d028de939fce8c36c914cfff;hpb=023b58f866bf1911e7ede7e162b5d966d3e019f3;p=gdcm.git diff --git a/src/gdcmRefCounter.h b/src/gdcmRefCounter.h index a5e39fe3..25ecce97 100644 --- a/src/gdcmRefCounter.h +++ b/src/gdcmRefCounter.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmRefCounter.h,v $ Language: C++ - Date: $Date: 2005/10/21 15:34:56 $ - Version: $Revision: 1.6 $ + Date: $Date: 2007/08/22 16:14:04 $ + Version: $Revision: 1.12 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -16,13 +16,14 @@ =========================================================================*/ -#ifndef GDCMREFCOUNTER_H -#define GDCMREFCOUNTER_H +#ifndef _GDCMREFCOUNTER_H_ +#define _GDCMREFCOUNTER_H_ #include "gdcmBase.h" -#include "gdcmDebug.h" +//#include "gdcmDebug.h" +#include -namespace gdcm +namespace GDCM_NAME_SPACE { //----------------------------------------------------------------------------- /** @@ -35,35 +36,29 @@ class GDCM_EXPORT RefCounter : public Base public: // Allocator / Unallocator - /// Delete the object + /// \brief Delete the object /// \remarks The object is deleted only if its reference counting is to zero - inline void Delete(void) - { - Unregister(); - } + void Delete() { Unregister(); } // Reference count - /// Register the object + /// \brief Register the object /// \remarks It increments the reference counting - inline void Register(void) - { - RefCount++; - } - /// Unregister the object + void Register() { RefCount++; } + + /// \brief Unregister the object /// \remarks It decrements the reference counting - inline void Unregister(void) + void Unregister() { +//std::cout <<"================Unreg " << typeid(*this).name() << std::endl; RefCount--; - if(RefCount==0) - { - delete this; - } + if(RefCount<=0) + delete this; } - /// Get the reference counting + /// \brief Get the reference counting /// \return Reference count - inline const unsigned long &GetRefCount(void) const + const unsigned long &GetRefCount() const { - return(RefCount); + return RefCount; } protected: