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.cpp
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 
18 
19 bool mitk::WeakPointerProperty::IsEqual(const BaseProperty &property) const
20 {
21  return this->m_WeakPointer == static_cast<const Self &>(property).m_WeakPointer;
22 }
23 
24 bool mitk::WeakPointerProperty::Assign(const BaseProperty &property)
25 {
26  this->m_WeakPointer = static_cast<const Self &>(property).m_WeakPointer;
27  return true;
28 }
29 
30 mitk::WeakPointerProperty::WeakPointerProperty(itk::Object *pointer) : m_WeakPointer(pointer)
31 {
32 }
33 
35  : mitk::BaseProperty(other), m_WeakPointer(other.m_WeakPointer)
36 {
37 }
38 
40 {
41 }
42 
44 {
45  std::stringstream ss;
46  ss << m_WeakPointer.GetPointer();
47  return ss.str();
48 }
49 
51 {
52  return m_WeakPointer.GetPointer();
53 }
54 
56 {
57  return GetWeakPointer();
58 }
59 
61 {
62  if (m_WeakPointer.GetPointer() != pointer)
63  {
64  m_WeakPointer = pointer;
65  Modified();
66  }
67 }
68 
70 {
71  SetWeakPointer(value.GetPointer());
72 }
73 
74 itk::LightObject::Pointer mitk::WeakPointerProperty::InternalClone() const
75 {
76  itk::LightObject::Pointer result(new Self(*this));
77  result->UnRegister();
78  return result;
79 }
itk::SmartPointer< Self > Pointer
virtual std::string GetValueAsString() const override
void SetValue(const ValueType &value)
DataCollection - Class to facilitate loading/accessing structured data.
Property containing a smart-pointer.
Abstract base class for properties.
WeakPointerProperty(const WeakPointerProperty &)
itk::WeakPointer< itk::Object > ValueType
itk::WeakPointer< itk::Object > m_WeakPointer
void SetWeakPointer(itk::Object *pointer)