Medical Imaging Interaction Toolkit  2018.4.99-4c24e3cb
Medical Imaging Interaction Toolkit
berryAbstractSourceProvider.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 <berryLog.h>
14 
17 
18 #include <Poco/Exception.h>
19 
20 namespace berry
21 {
22 
23 bool AbstractSourceProvider::DEBUG = false; //Policy.DEBUG_SOURCES;
24 
26  const QString &sourceName, Object::ConstPointer sourceValue)
27 {
28  sourceEvents.singleSourceChanged(sourcePriority, sourceName, sourceValue);
29 }
30 
32  const QHash<QString, Object::ConstPointer> &sourceValuesByName)
33 {
34  sourceEvents.multipleSourcesChanged(sourcePriority, sourceValuesByName);
35 }
36 
37 void AbstractSourceProvider::LogDebuggingInfo(const QString& message)
38 {
39  if (DEBUG && (message != ""))
40  {
41  BERRY_INFO << "SOURCES >>> " << message;
42  }
43 }
44 
46  ISourceProviderListener* listener)
47 {
48  if (listener == nullptr)
49  {
50  throw Poco::NullPointerException("The listener cannot be null");
51  }
52 
53  sourceEvents.AddListener(listener);
54 }
55 
57  ISourceProviderListener* listener)
58 {
59  if (listener == nullptr)
60  {
61  throw Poco::NullPointerException("The listener cannot be null");
62  }
63 
64  sourceEvents.RemoveListener(listener);
65 }
66 
68 {
69 }
70 
71 }
Message2< int, const QHash< QString, Object::ConstPointer > &> multipleSourcesChanged
void LogDebuggingInfo(const QString &message)
virtual void Initialize(IServiceLocator *locator)
Message3< int, const QString &, Object::ConstPointer > singleSourceChanged
#define BERRY_INFO
Definition: berryLog.h:20
void RemoveSourceProviderListener(ISourceProviderListener *listener) override
void FireSourceChanged(int sourcePriority, const QString &sourceName, Object::ConstPointer sourceValue)
virtual void AddSourceProviderListener(ISourceProviderListener *listener)=0