Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berryState.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 BlueBerry Platform
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 #include "berryState.h"
18 
19 namespace berry
20 {
21 
23 {
24  stateEvents.AddListener(listener);
25 }
26 
28 {
30 }
31 
33 {
34  stateEvents.RemoveListener(listener);
35 }
36 
38 {
40 }
41 
43 {
44  stateEvents.stateChanged(State::Pointer(this), oldValue);
45 }
46 
47 QString State::GetId() const
48 {
49  return id;
50 }
51 
53 {
54  return value;
55 }
56 
57 void State::SetId(const QString& id)
58 {
59  this->id = id;
60 }
61 
62 void State::SetValue(const Object::Pointer& value)
63 {
64  if (this->value != value)
65  {
66  const Object::Pointer oldValue(this->value);
67  this->value = value;
68  this->FireStateChanged(oldValue);
69  }
70 }
71 
72 }
void RemoveListener(IStateListener *listener)
IStateListener::Events stateEvents
Definition: berryState.h:117
virtual void RemoveListener(IStateListener *listener)
Definition: berryState.cpp:32
virtual void AddListener(IStateListener *listener)
Definition: berryState.cpp:22
virtual Object::Pointer GetValue() const
Definition: berryState.cpp:52
virtual void SetId(const QString &id)
Definition: berryState.cpp:57
void FireStateChanged(const Object::Pointer &oldValue)
Definition: berryState.cpp:42
QString GetId() const
Definition: berryState.cpp:47
virtual void SetValue(const Object::Pointer &value)
Definition: berryState.cpp:62
void AddListener(const AbstractDelegate &delegate) const
Definition: berryMessage.h:870
void RemoveListener(const AbstractDelegate &delegate) const
Definition: berryMessage.h:880
void AddListener(IStateListener *listener)