Slicer  5.1
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qSlicerCLIExecutableModuleFactory.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Copyright (c) Kitware Inc.
6 
7  See COPYRIGHT.txt
8  or http://www.slicer.org/copyright/copyright.txt for details.
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16  This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc.
17  and was partially funded by NIH grant 3P41RR013218-12S1
18 
19 ==============================================================================*/
20 
21 #ifndef __qSlicerCLIExecutableModuleFactory_h
22 #define __qSlicerCLIExecutableModuleFactory_h
23 
24 // Slicer includes
26 #include "qSlicerBaseQTCLIExport.h"
27 class qSlicerCLIModule;
28 
29 // CTK includes
30 #include <ctkPimpl.h>
31 #include <ctkAbstractPluginFactory.h>
32 
33 //-----------------------------------------------------------------------------
35  : public ctkAbstractFactoryFileBasedItem<qSlicerAbstractCoreModule>
36 {
37 public:
38  qSlicerCLIExecutableModuleFactoryItem(const QString& newTempDirectory);
39  bool load() override;
40  void uninstantiate() override;
41 protected:
44 
46  QString runCLIWithXmlArgument();
47 private:
48  QString TempDirectory;
49  qSlicerCLIModule* CLIModule;
50 };
51 
52 class qSlicerCLIExecutableModuleFactoryPrivate;
53 
54 //-----------------------------------------------------------------------------
55 class Q_SLICER_BASE_QTCLI_EXPORT qSlicerCLIExecutableModuleFactory :
56  public ctkAbstractFileBasedFactory<qSlicerAbstractCoreModule>
57 {
58 public:
59  typedef ctkAbstractFileBasedFactory<qSlicerAbstractCoreModule> Superclass;
61  qSlicerCLIExecutableModuleFactory(const QString& tempDir);
63 
64  void registerItems() override;
65 
70  QString fileNameToKey(const QString& fileName)const override;
71 
72  void setTempDirectory(const QString& newTempDirectory);
73 
74 protected:
75  bool isValidFile(const QFileInfo& file)const override;
76 
77  ctkAbstractFactoryItem<qSlicerAbstractCoreModule>*
78  createFactoryFileBasedItem() override;
79 
80 protected:
81 
82  QScopedPointer<qSlicerCLIExecutableModuleFactoryPrivate> d_ptr;
83 
84 private:
85  Q_DECLARE_PRIVATE(qSlicerCLIExecutableModuleFactory);
86  Q_DISABLE_COPY(qSlicerCLIExecutableModuleFactory);
87 };
88 
89 #endif
QScopedPointer< qSlicerCLIExecutableModuleFactoryPrivate > d_ptr
qSlicerAbstractCoreModule * instanciator() override
qSlicerCLIExecutableModuleFactoryItem(const QString &newTempDirectory)
qSlicerAbstractCoreModule is the base class of any module in Slicer.
QString xmlModuleDescriptionFilePath()
Return path of the expected XML file.
ctkAbstractFileBasedFactory< qSlicerAbstractCoreModule > Superclass