Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
Medical Imaging Interaction Toolkit
berryState.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 (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 #include "berryState.h"
14 
15 namespace berry
16 {
17 
19 {
20  stateEvents.AddListener(listener);
21 }
22 
24 {
26 }
27 
29 {
30  stateEvents.RemoveListener(listener);
31 }
32 
34 {
36 }
37 
39 {
40  stateEvents.stateChanged(State::Pointer(this), oldValue);
41 }
42 
43 QString State::GetId() const
44 {
45  return id;
46 }
47 
49 {
50  return value;
51 }
52 
53 void State::SetId(const QString& id)
54 {
55  this->id = id;
56 }
57 
58 void State::SetValue(const Object::Pointer& value)
59 {
60  if (this->value != value)
61  {
62  const Object::Pointer oldValue(this->value);
63  this->value = value;
64  this->FireStateChanged(oldValue);
65  }
66 }
67 
68 }
void RemoveListener(IStateListener *listener)
IStateListener::Events stateEvents
Definition: berryState.h:113
virtual void RemoveListener(IStateListener *listener)
Definition: berryState.cpp:28
virtual void AddListener(IStateListener *listener)
Definition: berryState.cpp:18
void RemoveListener(const AbstractDelegate &delegate) const
Definition: berryMessage.h:876
virtual void SetId(const QString &id)
Definition: berryState.cpp:53
QString GetId() const
Definition: berryState.cpp:43
virtual Object::Pointer GetValue() const
Definition: berryState.cpp:48
void FireStateChanged(const Object::Pointer &oldValue)
Definition: berryState.cpp:38
virtual void SetValue(const Object::Pointer &value)
Definition: berryState.cpp:58
void AddListener(const AbstractDelegate &delegate) const
Definition: berryMessage.h:866
void AddListener(IStateListener *listener)