X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmRefCounter.h;h=cafb784997905b96918f948b6a49ba5f778abc1e;hb=17daf7e7caceddf44e73864ee8d366613a1f0c82;hp=23c96c0fa3c521632f0544fc5a0b6f31de1c8a6c;hpb=12a274bc7f2ed75439e0451bb5e9ff2b612e8aa2;p=gdcm.git diff --git a/src/gdcmRefCounter.h b/src/gdcmRefCounter.h index 23c96c0f..cafb7849 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 07:38:00 $ - Version: $Revision: 1.2 $ + Date: $Date: 2005/11/28 15:20:34 $ + Version: $Revision: 1.9 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -20,7 +20,6 @@ #define GDCMREFCOUNTER_H #include "gdcmBase.h" -#include "gdcmDebug.h" namespace gdcm { @@ -31,40 +30,32 @@ namespace gdcm */ class GDCM_EXPORT RefCounter : public Base { -public: - gdcmTypeMacro(RefCounter) + gdcmTypeMacro(RefCounter); public: // Allocator / Unallocator - /// Delete the object + /// \brief Delete the object /// \remarks The object is deleted only if its reference counting is to zero - inline virtual 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() { RefCount--; - if(RefCount==0) - { + 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: