Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkLightObject.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkLightObject.h,v $
00005   Language:  C++
00006   Date:      $Date: 2007/08/22 12:56:44 $
00007   Version:   $Revision: 1.35 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkLightObject_h
00018 #define __itkLightObject_h
00019 
00020 #include "itkSmartPointer.h"
00021 #include "itkTimeStamp.h"
00022 #include "itkIndent.h"
00023 #include "itkSimpleFastMutexLock.h"
00024 #include "itkMacro.h"
00025 
00026 #include <iostream>
00027 #include <typeinfo>
00028 
00029 namespace itk
00030 {
00031   
00046 class ITKCommon_EXPORT LightObject 
00047 {
00048 public:
00050   typedef LightObject         Self;
00051   typedef SmartPointer<Self>  Pointer;
00052   typedef SmartPointer<const Self>  ConstPointer;
00053 
00055   static Pointer New();
00056 
00062   virtual Pointer CreateAnother() const;
00063 
00067   virtual void Delete();
00068 
00072   virtual const char *GetNameOfClass() const 
00073     {return "LightObject";}
00074 
00075 #ifdef _WIN32
00076 
00077   void* operator new(size_t);
00078   void* operator new[](size_t);
00079   void operator delete(void*);
00080   void operator delete[](void*, size_t);
00081 #endif 
00082 
00083 
00085   void Print(std::ostream& os, Indent indent=0) const;
00086 
00089   static void BreakOnError();
00090 
00092   virtual void Register() const;
00093 
00095   virtual void UnRegister() const;
00096 
00098   virtual int GetReferenceCount() const 
00099     {return m_ReferenceCount;}
00100 
00103   virtual void SetReferenceCount(int);
00104 
00105 protected:
00106   LightObject():m_ReferenceCount(1) {}
00107   virtual ~LightObject(); 
00108 
00113   virtual void PrintSelf(std::ostream& os, Indent indent) const;
00114   virtual void PrintHeader(std::ostream& os, Indent indent) const;
00115   virtual void PrintTrailer(std::ostream& os, Indent indent) const;
00117 
00119   mutable volatile int m_ReferenceCount;
00120 
00122   mutable SimpleFastMutexLock m_ReferenceCountLock;
00123 
00124 private:
00125   LightObject(const Self&); //purposely not implemented
00126   void operator=(const Self&); //purposely not implemented
00127   
00128   
00129 };
00130 
00131 } // end namespace itk
00132   
00133 #endif
00134 

Generated at Sun Sep 23 13:24:09 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000