CustusX  18.04
An IGT application
cxDataFactory.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 #ifndef CXDATAFACTORY_H
12 #define CXDATAFACTORY_H
13 
14 #include "cxResourceExport.h"
15 #include "cxPrecompiledHeader.h"
16 
17 #include "cxForwardDeclarations.h"
18 
19 namespace cx
20 {
21 typedef boost::shared_ptr<class SpaceProvider> SpaceProviderPtr;
22 
23 
31 class cxResource_EXPORT DataFactory
32 {
33 public:
34  explicit DataFactory(PatientModelServicePtr dataManager, SpaceProviderPtr spaceProvider);
35 
36  DataPtr create(QString type, QString uid, QString name="");
37 
38  template<class T>
39  boost::shared_ptr<T> createSpecific(QString uid, QString name="")
40  {
41  DataPtr retval = this->create(T::getTypeName(), uid, name);
42  return boost::dynamic_pointer_cast<T>(retval);
43  }
44 private:
45  PatientModelServicePtr mDataManager;
46  SpaceProviderPtr mSpaceProvider;
47  DataPtr createRaw(QString type, QString uid);
48 
49 };
50 typedef boost::shared_ptr<DataFactory> DataFactoryPtr;
51 
52 
53 } // namespace cx
54 
55 
56 #endif // CXDATAFACTORY_H
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
boost::shared_ptr< class Data > DataPtr
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
boost::shared_ptr< T > createSpecific(QString uid, QString name="")
Definition: cxDataFactory.h:39
boost::shared_ptr< class DataFactory > DataFactoryPtr
Definition: cxDataManager.h:39
Namespace for all CustusX production code.