ITK  6.0.0
Insight Toolkit
itkLightObject.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef itkLightObject_h
19#define itkLightObject_h
20
21#include "itkMacro.h"
22#include "itkSmartPointer.h"
23#include "itkTimeStamp.h"
24#include "itkIndent.h"
25#include <atomic>
26
27#include <iostream>
28#include <typeinfo>
29
30#if defined(_WIN32)
31# include "itkWindows.h"
32#endif
33
34namespace itk
35{
55class ITKCommon_EXPORT LightObject
56{
57public:
58 ITK_DISALLOW_COPY_AND_MOVE(LightObject);
59
64
66 static Pointer
67 New();
68
74 virtual Pointer
76
79 Clone() const
80 {
81 return this->InternalClone();
82 }
83
87 virtual void
89
93 itkVirtualGetNameOfClassMacro(LightObject);
94
95#ifdef _WIN32
97 void * operator new(size_t);
98
99 void * operator new[](size_t);
100
101 void
102 operator delete(void *);
103
104 void
105 operator delete[](void *, size_t);
106
107#endif
108
110 void
111 Print(std::ostream & os, Indent indent = 0) const;
112
115 static void
117
119 virtual void
120 Register() const;
121
123 virtual void
124 UnRegister() const noexcept;
125
127 virtual int
128 GetReferenceCount() const
129 {
130 return m_ReferenceCount;
131 }
132
135 virtual void
137
138protected:
140 virtual ~LightObject();
141
146 virtual void
147 PrintSelf(std::ostream & os, Indent indent) const;
148
149 virtual void
150 PrintHeader(std::ostream & os, Indent indent) const;
151
152 virtual void
153 PrintTrailer(std::ostream & os, Indent indent) const;
154
161
163 mutable std::atomic<int> m_ReferenceCount{};
164};
165
172ITKCommon_EXPORT std::ostream &
173 operator<<(std::ostream & os, const LightObject & o);
174
175} // end namespace itk
176
177#endif
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
virtual void Delete()
virtual LightObject::Pointer InternalClone() const
Pointer Clone() const
virtual ~LightObject()
virtual Pointer CreateAnother() const
virtual void PrintTrailer(std::ostream &os, Indent indent) const
static Pointer New()
virtual void PrintSelf(std::ostream &os, Indent indent) const
virtual void UnRegister() const noexcept
virtual void SetReferenceCount(int)
static void BreakOnError()
virtual void Register() const
void Print(std::ostream &os, Indent indent=0) const
virtual void PrintHeader(std::ostream &os, Indent indent) const
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
ITKCommon_EXPORT std::ostream & operator<<(std::ostream &out, typename AnatomicalOrientation::CoordinateEnum value)