Computer Assited Medical Intervention Tool Kit  version 5.0
CepGenerator.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2021 Univ. Grenoble Alpes, CNRS, Grenoble INP, TIMC, 38000 Grenoble, France
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 
26 #ifndef CEPGENERATOR_H
27 #define CEPGENERATOR_H
28 
29 // includes from STL (for Linux) for std::auto_ptr
30 #include <memory>
31 
32 // includes from Qt
33 #include <QDir>
34 #include <QString>
35 #include <QFileInfo>
36 #include <QVector>
37 
38 // Hide warning for Exception + declspec(nothrow)
39 #if defined(_WIN32) && !defined(__MINGW32__) // MSVC only
40 #pragma warning( disable : 4290 )
41 #endif // MSVC only
42 
43 // Dependency from cepcoreschema
44 // Declaration here to avoid declaration in dependant projects.
45 namespace cepcoreschema {
46 class Cep;
47 }
48 
49 class ExtensionGenerator;
50 
62 class CepGenerator {
63 public :
64 
72  CepGenerator(QString xmlFilename, QString devDirectoryName);
73 
83  CepGenerator(std::unique_ptr<cepcoreschema::Cep> domCep, QString devDirectoryName);
84 
88  CepGenerator();
89 
90  virtual ~CepGenerator();
91 
93  void process();
94 
96  void setXmlFileName(QString xmlFileName);
97 
99  void createDomTree();
100 
103 
105  void serializeManifest(QString fileName = "");
106 
107 protected:
108 
136  virtual void generateDirectoryTree();
137 
140  virtual void generateGlobalCMakeLists();
142 
144  virtual void generateCopyright();
145 
147  virtual void generateReadme();
148 
150  virtual void copyFindCamiTK();
151 
153  virtual void generateActionsDirectory();
154 
156  virtual void generateApplicationsDirectory();
157 
159  virtual void generateComponentsDirectory();
160 
162  virtual void generateLibrariesDirectory();
163 
165  virtual void generateViewersDirectory();
166 
168  virtual void setLicence();
174  virtual void createActionExtensionDoms();
175 
179  virtual void createComponentExtensionDoms();
180 
184  virtual void createLibrarieDoms();
185 
189  virtual void createViewersExtensionDoms();
190 
191  virtual void generateExtensions();
192 
193 private:
197  std::unique_ptr<cepcoreschema::Cep> domCep;
198 
200  QFileInfo xmlFileName;
201 
204 
207 
209  QVector<ExtensionGenerator*> extensions;
210 
212  QString licence;
213 
214 };
215 
216 #endif // CEPGENERATOR_H
ClassNameHandler::getDirectoryName
static QString getDirectoryName(QString genericName)
Definition: ClassNameHandler.cpp:57
CepGenerator::generateViewersDirectory
virtual void generateViewersDirectory()
Generate the Libraries directory.
Definition: CepGenerator.cpp:401
CepGenerator::createDomTree
void createDomTree()
Create the DOM attribute domCep from the XML CEP manifest.
Definition: CepGenerator.cpp:105
initMyResource
void initMyResource()
Definition: CepGenerator.cpp:55
cepActionsDirectoryName
static const QString cepActionsDirectoryName
Definition: CepGenerator.cpp:46
CepGenerator::domCep
std::unique_ptr< cepcoreschema::Cep > domCep
XML DOM Element create by CodeSynthesis This cep instance contains all of the informations of the xml...
Definition: CepGenerator.h:197
CepGenerator::setXmlFileName
void setXmlFileName(QString xmlFileName)
Set the input XML CEP manifest (ant check its xml validity)
Definition: CepGenerator.cpp:84
CepGenerator::licence
QString licence
overall licence of the CEP
Definition: CepGenerator.h:212
CepGenerator::createViewersExtensionDoms
virtual void createViewersExtensionDoms()
Create the ViewersDom if needed and call the appropriate methods to generate the viewer extensions.
Definition: CepGenerator.cpp:469
CepGenerator::generateComponentsDirectory
virtual void generateComponentsDirectory()
Generate the Components directory.
Definition: CepGenerator.cpp:376
LibraryGenerator
Generate the library.
Definition: LibraryGenerator.h:50
ActionExtensionGenerator.h
ViewerExtensionGenerator
Generate an viewer extension.
Definition: ViewerExtensionGenerator.h:51
CepGenerator::copyFindCamiTK
virtual void copyFindCamiTK()
Generate the FindCamiTK file.
Definition: CepGenerator.cpp:342
CepGenerator::devDirectoryName
QDir devDirectoryName
Where to store the produced files.
Definition: CepGenerator.h:203
cepSchemaNamespace
static const QString cepSchemaNamespace
Definition: CepGenerator.cpp:53
ExtensionGenerator
Common abstract class to generate extensions.
Definition: ExtensionGenerator.h:49
cepComponentsDirectoryName
static const QString cepComponentsDirectoryName
Definition: CepGenerator.cpp:48
ComponentExtensionGenerator.h
CepGenerator.h
LibraryGenerator.h
cepLibrariesDirectoryName
static const QString cepLibrariesDirectoryName
Definition: CepGenerator.cpp:49
CepGenerator::CepGenerator
CepGenerator()
Create an empty CepGenerator.
Definition: CepGenerator.cpp:61
CepGenerator::generateGlobalCMakeLists
virtual void generateGlobalCMakeLists()
Generate CMakeLists file.
Definition: CepGenerator.cpp:207
CepGenerator::setDevDirectoryName
void setDevDirectoryName(QString devDirectoryName)
Where to generate the CEP directories and files.
Definition: CepGenerator.cpp:94
CepGenerator::generateCopyright
virtual void generateCopyright()
Generate copyright file.
Definition: CepGenerator.cpp:280
CepGenerator::process
void process()
call all methods to generate the CEP from the DomTree.
Definition: CepGenerator.cpp:494
cepManifestName
static const QString cepManifestName
Definition: CepGenerator.cpp:51
CepGenerator::createLibrarieDoms
virtual void createLibrarieDoms()
Create the LibrariesDom if needed and call the appropriate methods to generate the libraries.
Definition: CepGenerator.cpp:450
CepGenerator::extensions
QVector< ExtensionGenerator * > extensions
Action or Component Extensions.
Definition: CepGenerator.h:209
CepGenerator::generateReadme
virtual void generateReadme()
Generate Readme File.
Definition: CepGenerator.cpp:307
CepGenerator::generateDirectoryTree
virtual void generateDirectoryTree()
Create the general directory tree (the same for every CEP).
Definition: CepGenerator.cpp:119
ClassNameHandler.h
ComponentExtensionGenerator
Generate a component extension.
Definition: ComponentExtensionGenerator.h:53
CepGenerator::cepDirectoryName
QString cepDirectoryName
Subdirectory where the CEP sources will be stored (updated when generating the directory tree)
Definition: CepGenerator.h:206
CepGenerator::generateActionsDirectory
virtual void generateActionsDirectory()
Generate the Actions directory.
Definition: CepGenerator.cpp:351
CepGenerator::~CepGenerator
virtual ~CepGenerator()
Definition: CepGenerator.cpp:78
ViewerExtensionGenerator.h
CepGenerator::generateExtensions
virtual void generateExtensions()
Definition: CepGenerator.cpp:487
CepGenerator::setLicence
virtual void setLicence()
Set the licence ine the licence variable to be included later in the generated files.
Definition: CepGenerator.cpp:258
cepApplicationsDirectoryName
static const QString cepApplicationsDirectoryName
Definition: CepGenerator.cpp:47
CepGenerator::serializeManifest
void serializeManifest(QString fileName="")
Serialize the manifest ie serialize the domCep to a std::string.
Definition: CepGenerator.cpp:160
CepGenerator::generateApplicationsDirectory
virtual void generateApplicationsDirectory()
Generate the Applications directory.
Definition: CepGenerator.cpp:364
cepViewersDirectoryName
static const QString cepViewersDirectoryName
Definition: CepGenerator.cpp:50
ActionExtensionGenerator
Generate an action extension.
Definition: ActionExtensionGenerator.h:49
CepGenerator::generateLibrariesDirectory
virtual void generateLibrariesDirectory()
Generate the Libraries directory.
Definition: CepGenerator.cpp:388
CepGenerator::createActionExtensionDoms
virtual void createActionExtensionDoms()
Create the ActionExtensionDom if needed and call the appropriate methods to generate the action exten...
Definition: CepGenerator.cpp:414
CepGenerator::createComponentExtensionDoms
virtual void createComponentExtensionDoms()
Create the ComponentExtensionDom if needed and call the appropriate methods to generate the component...
Definition: CepGenerator.cpp:432
CepGenerator::xmlFileName
QFileInfo xmlFileName
Where to find the original XML description of the CEP.
Definition: CepGenerator.h:200
ExtensionGenerator.h
cepcoreschema
Definition: ActionExtensionGenerator.h:36
cepManifestExtension
static const QString cepManifestExtension
Definition: CepGenerator.cpp:52
CepGenerator
This class contains the entry points to generate CEP.
Definition: CepGenerator.h:62