Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  
igtlLightObject.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Open IGT Link Library
00004   Module:    $HeadURL: http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink/Source/igtlLightObject.h $
00005   Language:  C++
00006   Date:      $Date: 2008-12-22 19:05:42 -0500 (Mon, 22 Dec 2008) $
00007   Version:   $Revision: 3460 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010 
00011   This software is distributed WITHOUT ANY WARRANTY; without even
00012   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00013   PURPOSE.  See the above copyright notices for more information.
00014 
00015 =========================================================================*/
00016 /*=========================================================================
00017 
00018   Program:   Insight Segmentation & Registration Toolkit
00019   Module:    $RCSfile: itkLightObject.h,v $
00020   Language:  C++
00021   Date:      $Date: 2008-12-22 19:05:42 -0500 (Mon, 22 Dec 2008) $
00022   Version:   $Revision: 3460 $
00023 
00024   Copyright (c) Insight Software Consortium. All rights reserved.
00025   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00026 
00027      This software is distributed WITHOUT ANY WARRANTY; without even 
00028      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00029      PURPOSE.  See the above copyright notices for more information.
00030 
00031 =========================================================================*/
00032 #ifndef __igtlLightObject_h
00033 #define __igtlLightObject_h
00034 
00035 #include "igtlSmartPointer.h"
00036 #include "igtlSimpleFastMutexLock.h"
00037 #include "igtlMacro.h"
00038 
00039 #include <iostream>
00040 #include <typeinfo>
00041 
00042 
00043 namespace igtl
00044 {
00045   
00060 class IGTLCommon_EXPORT LightObject 
00061 {
00062 public:
00064   typedef LightObject         Self;
00065   typedef SmartPointer<Self>  Pointer;
00066   typedef SmartPointer<const Self>  ConstPointer;
00067 
00069   static Pointer New();
00070 
00076   virtual Pointer CreateAnother() const;
00077 
00081   virtual void Delete();
00082 
00086   virtual const char *GetNameOfClass() const 
00087     {return "LightObject";}
00088 
00089 #ifdef _WIN32
00090 
00091   void* operator new(size_t);
00092   void* operator new[](size_t);
00093   void operator delete(void*);
00094   void operator delete[](void*, size_t);
00095 #endif 
00096 
00097 
00099   void Print(std::ostream& os) const;
00100 
00103   static void BreakOnError();
00104 
00106   virtual void Register() const;
00107 
00109   virtual void UnRegister() const;
00110 
00112   virtual int GetReferenceCount() const 
00113     {return m_ReferenceCount;}
00114 
00117   virtual void SetReferenceCount(int);
00118 
00119 protected:
00120   LightObject():m_ReferenceCount(1) {}
00121   virtual ~LightObject(); 
00122 
00127   virtual void PrintSelf(std::ostream& os) const;
00128   virtual void PrintHeader(std::ostream& os) const;
00129   virtual void PrintTrailer(std::ostream& os) const;
00131 
00133   mutable volatile int m_ReferenceCount;
00134 
00136   mutable SimpleFastMutexLock m_ReferenceCountLock;
00137 
00138 private:
00139   LightObject(const Self&); //purposely not implemented
00140   void operator=(const Self&); //purposely not implemented
00141   
00142   
00143 };
00144 
00145 } // end namespace igtl
00146   
00147 #endif
00148 

Generated at Sat Dec 3 2011 08:54:20 for OpenIGTLink by doxygen 1.7.4 written by Dimitri van Heesch, © 1997-2000