Medical Imaging Interaction Toolkit  2018.04.99-aba3194f
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_HEADER_INCLUDED_C126B791
14 #define MITKWEAKPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791
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 /* MITKWEAKPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791 */
#define MITKCORE_EXPORT
#define mitkNewMacro1Param(classname, type)
Definition: mitkCommon.h:72
DataCollection - Class to facilitate loading/accessing structured data.
Property containing a smart-pointer.
Abstract base class for properties.
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
itk::WeakPointer< itk::Object > ValueType
itk::WeakPointer< itk::Object > m_WeakPointer