Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
berryIServiceFactory.h
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 
14 #ifndef BERRYISERVICEFACTORY_H_
15 #define BERRYISERVICEFACTORY_H_
16 
18 
19 #include <QObject>
20 
21 namespace berry {
22 
23 struct IServiceLocator;
24 
25 class Object;
26 
34 
35  virtual ~IServiceFactory();
36 
59  template<class S>
60  S* Create(IServiceLocator* parentLocator, IServiceLocator* locator) const
61  {
62  return dynamic_cast<S*>(this->Create(qobject_interface_iid<S*>(), parentLocator, locator));
63  }
64 
65  virtual Object* Create(const QString& serviceInterface,
66  IServiceLocator* parentLocator, IServiceLocator* locator) const = 0;
67 };
68 
69 }
70 
71 Q_DECLARE_INTERFACE(berry::IServiceFactory, "org.blueberry.ui.IServiceFactory")
72 
73 #endif /* BERRYISERVICEFACTORY_H_ */
Light weight base class for most BlueBerry classes.
Definition: berryObject.h:72
S * Create(IServiceLocator *parentLocator, IServiceLocator *locator) const
#define BERRY_UI_QT