SimpleITK  
sitkObjectOwnedBase.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 * http://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 sitkObjectOwnedBase_h
19#define sitkObjectOwnedBase_h
20
21
22#include "sitkCommon.h"
23#include "sitkNonCopyable.h"
24
25#include <map>
26#include <functional>
27
28
29namespace itk
30{
31
32class Object;
33
34namespace simple
35{
36
48{
49public:
51#ifndef SWIGR
52 = 0
53#endif
54 ;
55
56 ObjectOwnedBase() = default;
57
59 virtual std::string
60 GetName() const;
61
63 virtual void
64 SetName(const std::string & name);
65
66protected:
75
76
77#ifndef SWIG
84 virtual size_t
85 AddObjectCallback(itk::Object * o, std::function<void()> onDelete);
86
87 virtual size_t
89
90
99 virtual void
101 virtual bool
103 virtual void
105 virtual void
108#endif
109
110
111private:
112 void
114
115 bool m_OwnedByObjects{ false };
116 std::multimap<itk::Object *, std::function<void()>> m_ReferencedObjectsCallbacks;
117 std::string m_Name;
118};
119
120} // namespace simple
121} // namespace itk
122#endif
virtual void OwnedByObjectsOn()
virtual std::string GetName() const
virtual size_t AddObjectCallback(itk::Object *o, std::function< void()> onDelete)
Register an Object and a method to call on this object's destructor.
virtual size_t RemoveObject(const itk::Object *)
virtual bool GetOwnedByObjects() const
virtual void OwnedByObjectsOff()
virtual void SetName(const std::string &name)
virtual void SetOwnedByObjects(bool o)
std::multimap< itk::Object *, std::function< void()> > m_ReferencedObjectsCallbacks
ObjectOwnedBase(const ObjectOwnedBase &o)
Copy Constructor.
#define SITKCommon_EXPORT
Definition sitkCommon.h:41