Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berryIServiceFactory.h
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 
18 #ifndef BERRYISERVICEFACTORY_H_
19 #define BERRYISERVICEFACTORY_H_
20 
22 
23 #include <QObject>
24 
25 namespace berry {
26 
27 struct IServiceLocator;
28 
29 class Object;
30 
38 
39  virtual ~IServiceFactory();
40 
63  template<class S>
64  S* Create(IServiceLocator* parentLocator, IServiceLocator* locator) const
65  {
66  return dynamic_cast<S*>(this->Create(qobject_interface_iid<S*>(), parentLocator, locator));
67  }
68 
69  virtual Object* Create(const QString& serviceInterface,
70  IServiceLocator* parentLocator, IServiceLocator* locator) const = 0;
71 };
72 
73 }
74 
75 Q_DECLARE_INTERFACE(berry::IServiceFactory, "org.blueberry.ui.IServiceFactory")
76 
77 #endif /* BERRYISERVICEFACTORY_H_ */
Light weight base class for most BlueBerry classes.
Definition: berryObject.h:78
S * Create(IServiceLocator *parentLocator, IServiceLocator *locator) const
#define BERRY_UI_QT