Orfeo Toolbox  3.16
itkLightObject.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkLightObject.h,v $
5  Language: C++
6  Date: $Date: 2009-02-05 19:05:00 $
7  Version: $Revision: 1.42 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 #ifndef __itkLightObject_h
18 #define __itkLightObject_h
19 
20 #include "itkSmartPointer.h"
21 #include "itkTimeStamp.h"
22 #include "itkIndent.h"
23 #include "itkSimpleFastMutexLock.h"
24 #include "itkMacro.h"
25 
26 #include <iostream>
27 #include <typeinfo>
28 
29 #if defined(_WIN32)
30 // To get LONG defined
31  #include "itkWindows.h"
32 #elif defined(__APPLE__)
33 // To get MAC_OS_X_VERSION_MIN_REQUIRED defined
34  #include <AvailabilityMacros.h>
35 #endif
36 
37 namespace itk
38 {
39 
55 {
56 public:
58  typedef LightObject Self;
61 
63  static Pointer New();
64 
70  virtual Pointer CreateAnother() const;
71 
75  virtual void Delete();
76 
80  virtual const char *GetNameOfClass() const
81  {return "LightObject";}
82 
83 #ifdef _WIN32
84 
85  void* operator new(size_t);
86  void* operator new[](size_t);
87  void operator delete(void*);
88  void operator delete[](void*, size_t);
89 #endif
90 
92  void Print(std::ostream& os, Indent indent=0) const;
93 
96  static void BreakOnError();
97 
99  virtual void Register() const;
100 
102  virtual void UnRegister() const;
103 
105  virtual int GetReferenceCount() const
106  {return static_cast<int>(m_ReferenceCount);}
107 
110  virtual void SetReferenceCount(int);
111 
112 protected:
113  LightObject():m_ReferenceCount(1) {}
114  virtual ~LightObject();
115 
120  virtual void PrintSelf(std::ostream& os, Indent indent) const;
121  virtual void PrintHeader(std::ostream& os, Indent indent) const;
122  virtual void PrintTrailer(std::ostream& os, Indent indent) const;
123 
126 #if (defined(WIN32) || defined(_WIN32))
127  typedef LONG InternalReferenceCountType;
128 #elif defined(__APPLE__) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050)
129  #if defined (__LP64__) && __LP64__
130  typedef volatile int64_t InternalReferenceCountType;
131  #else
132  typedef volatile int32_t InternalReferenceCountType;
133  #endif
134 #elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
135  typedef _Atomic_word InternalReferenceCountType;
136 #else
138 #endif
139 
142 
145 
146 private:
147  LightObject(const Self&); //purposely not implemented
148  void operator=(const Self&); //purposely not implemented
149 
150 
151 };
152 
153 } // end namespace itk
154 
155 #endif

Generated at Sat Feb 2 2013 23:51:03 for Orfeo Toolbox with doxygen 1.8.1.1