Medical Imaging Interaction Toolkit  2023.04.00
Medical Imaging Interaction Toolkit
mitkWeakPointerProperty.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkWeakPointerProperty_h
14 #define mitkWeakPointerProperty_h
15 
16 #include "itkWeakPointer.h"
17 #include "mitkBaseProperty.h"
18 #include <MitkCoreExports.h>
19 
20 namespace mitk
21 {
22 #ifdef _MSC_VER
23 #pragma warning(push)
24 #pragma warning(disable : 4522)
25 #endif
26 
27  //##Documentation
28  //## @brief Property containing a smart-pointer
29  //##
30  //## @ingroup DataManagement
32  {
33  public:
35 
36  itkFactorylessNewMacro(Self);
37 
38  itkCloneMacro(Self);
40 
41  ~WeakPointerProperty() override;
42 
43  typedef itk::WeakPointer<itk::Object> ValueType;
44 
45  ValueType GetWeakPointer() const;
46  ValueType GetValue() const;
47 
48  void SetWeakPointer(itk::Object *pointer);
49  void SetValue(const ValueType &value);
50 
51  std::string GetValueAsString() const override;
52 
53  using BaseProperty::operator=;
54 
55  protected:
56  itk::WeakPointer<itk::Object> m_WeakPointer;
57 
59 
60  WeakPointerProperty(itk::Object *pointer = nullptr);
61 
62  private:
63  // purposely not implemented
64  WeakPointerProperty &operator=(const WeakPointerProperty &);
65 
66  itk::LightObject::Pointer InternalClone() const override;
67 
68  bool IsEqual(const BaseProperty &property) const override;
69  bool Assign(const BaseProperty &property) override;
70  };
71 
72 #ifdef _MSC_VER
73 #pragma warning(pop)
74 #endif
75 
76 } // namespace mitk
77 
78 #endif
mitk::BaseProperty
Abstract base class for properties.
Definition: mitkBaseProperty.h:35
mitkNewMacro1Param
#define mitkNewMacro1Param(classname, type)
Definition: mitkCommon.h:68
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
MitkCoreExports.h
mitk::WeakPointerProperty::ValueType
itk::WeakPointer< itk::Object > ValueType
Definition: mitkWeakPointerProperty.h:43
mitk::WeakPointerProperty
Property containing a smart-pointer.
Definition: mitkWeakPointerProperty.h:31
mitk::WeakPointerProperty::m_WeakPointer
itk::WeakPointer< itk::Object > m_WeakPointer
Definition: mitkWeakPointerProperty.h:56
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
mitkBaseProperty.h
MITKCORE_EXPORT
#define MITKCORE_EXPORT
Definition: MitkCoreExports.h:15