X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmRefCounter.h;h=3ba30e23a00536c8bde2d166bb9e073782eea760;hb=35ee8ee8af32946514713d271177df8bb2298eb2;hp=70d1262f65f2af10d616dcc8fdcbeada65ce87da;hpb=409d1e0eb9cdfb64db19a110808f27cf054d68a6;p=gdcm.git diff --git a/src/gdcmRefCounter.h b/src/gdcmRefCounter.h index 70d1262f..3ba30e23 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 11:50:04 $ - Version: $Revision: 1.5 $ + Date: $Date: 2007/10/04 17:50:42 $ + Version: $Revision: 1.13 $ 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 { //----------------------------------------------------------------------------- /** @@ -31,44 +32,38 @@ namespace gdcm */ class GDCM_EXPORT RefCounter : public Base { - 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 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: /// Constructor - RefCounter() { RefCount = 1; } + RefCounter() : RefCount(1) { } /// Destructor virtual ~RefCounter() {}