Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef MITKWEAKPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791
18 #define MITKWEAKPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791
19 
20 #include "itkWeakPointer.h"
21 #include "mitkBaseProperty.h"
22 #include <MitkCoreExports.h>
23 
24 namespace mitk
25 {
26 #ifdef _MSC_VER
27 #pragma warning(push)
28 #pragma warning(disable : 4522)
29 #endif
30 
31  //##Documentation
32  //## @brief Property containing a smart-pointer
33  //##
34  //## @ingroup DataManagement
36  {
37  public:
39 
40  itkFactorylessNewMacro(Self) itkCloneMacro(Self) mitkNewMacro1Param(WeakPointerProperty, itk::Object *);
41 
42  virtual ~WeakPointerProperty();
43 
44  typedef itk::WeakPointer<itk::Object> ValueType;
45 
46  ValueType GetWeakPointer() const;
47  ValueType GetValue() const;
48 
49  void SetWeakPointer(itk::Object *pointer);
50  void SetValue(const ValueType &value);
51 
52  virtual std::string GetValueAsString() const override;
53 
54  using BaseProperty::operator=;
55 
56  protected:
57  itk::WeakPointer<itk::Object> m_WeakPointer;
58 
59  WeakPointerProperty(const WeakPointerProperty &);
60 
61  WeakPointerProperty(itk::Object *pointer = nullptr);
62 
63  private:
64  // purposely not implemented
65  WeakPointerProperty &operator=(const WeakPointerProperty &);
66 
67  itk::LightObject::Pointer InternalClone() const override;
68 
69  virtual bool IsEqual(const BaseProperty &property) const override;
70  virtual bool Assign(const BaseProperty &property) override;
71  };
72 
73 #ifdef _MSC_VER
74 #pragma warning(pop)
75 #endif
76 
77 } // namespace mitk
78 
79 #endif /* MITKWEAKPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791 */
#define MITKCORE_EXPORT
#define mitkNewMacro1Param(classname, type)
Definition: mitkCommon.h:76
STL namespace.
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:44
Implements a weak reference to an object.
itk::WeakPointer< itk::Object > ValueType