]> Creatis software - crea.git/blob - lib/creaDevManagerLib/modelCDMAppli.h
Feature #1711 CreaDevManager application implementation
[crea.git] / lib / creaDevManagerLib / modelCDMAppli.h
1 /*
2 # ---------------------------------------------------------------------
3 #
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 #                        pour la Sant�)
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 #
10 #  This software is governed by the CeCILL-B license under French law and
11 #  abiding by the rules of distribution of free software. You can  use,
12 #  modify and/ or redistribute the software under the terms of the CeCILL-B
13 #  license as circulated by CEA, CNRS and INRIA at the following URL
14 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 #  or in the file LICENSE.txt.
16 #
17 #  As a counterpart to the access to the source code and  rights to copy,
18 #  modify and redistribute granted by the license, users are provided only
19 #  with a limited warranty  and the software's author,  the holder of the
20 #  economic rights,  and the successive licensors  have only  limited
21 #  liability.
22 #
23 #  The fact that you are presently reading this means that you have had
24 #  knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------
26  */
27
28 /*
29  * modelCDMAppli.h
30  *
31  *  Created on: Nov 23, 2012
32  *      Author: Daniel Felipe Gonzalez Obando
33  */
34
35 #ifndef MODELCDMAPPLI_H_
36 #define MODELCDMAPPLI_H_
37
38 #include<iostream>
39 #include<vector>
40 #include<map>
41
42 #include"modelCDMFolder.h"
43 #include"modelCDMApplication.h"
44
45 /**
46  * Represents the appli folder of Crea project. The appli folder holds the applications of a project.
47  */
48 class modelCDMAppli : public modelCDMFolder
49 {
50 public:
51   /**
52    * Default constructor.
53    */
54   modelCDMAppli();
55   /**
56    * Constructor of the appli folder node.
57    * @param parent Parent node of the appli node.
58    * @param path Full path of the appli node.
59    * @param name Folder name of the appli node. By default "appli"
60    * @param level Folder Level in the project hierarchy. By default 1
61    */
62   modelCDMAppli(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name = "appli", const int& level = 1);
63   /**
64    * Destructor.
65    */
66   ~modelCDMAppli();
67
68   /**
69    * Retrieves the applications inside the appli folder node.
70    * @return Reference array of the applications in the appli node.
71    */
72   const std::vector<modelCDMApplication*>& GetApplications() const;
73
74   /**
75    * Creates a new application in the system and creates an application node. This node is stored in the applications attribute and returned. The created application is included in the appli's CMakeLists file.
76    * @param name Name of the new application.
77    * @param type 0=console application, 1=GUI Application (wxWidgets).
78    * @param result Result message of the operation.
79    * @return Reference to the created application or NULL.
80    */
81   modelCDMApplication* CreateApplication(
82       const std::string& name,
83       const int& type,
84       std::string*& result
85   );
86   /**
87    * Refreshes the file structure of the appli node. Deletes deleted folders and files and creates created files and folders since lasts refresh.
88    * @param result Result message of the operation.
89    * @return True if the operation was successful.
90    */
91   virtual const bool Refresh(std::string*& result);
92
93   /**
94    * Checks the CMakeLists structure and the applications in order to look for compilation errors before compiling.
95    * @param properties Properties found in the structure.
96    */
97   void CheckStructure(std::map<std::string, bool>& properties);
98
99   /**
100    * Checks if the given application is included in the CMakeLists file.
101    * @param application_name Name of the library to check.
102    * @return True if the library is included, otherwise returns False.
103    */
104   bool IsApplicationIncluded(const std::string& application_name);
105
106   /**
107    * Sets the inclusion of the application in the lib's CMakeLists file. If the application inclusion already exist in file, then the line is uncommented/commented depending on the requested action. If the application inclusion doesn't exist yet, then it is included if the request is an inclusion.
108    * @param application_name Name of the application to include/exclude.
109    * @param toInclude True if the request is an inclusion, False otherwise.
110    * @return True if the request was processed successfully.
111    */
112   bool SetApplicationInclude(const std::string& application_name, const bool& toInclude);
113
114 private:
115   /**
116    * application in the appli folder node.
117    */
118   std::vector<modelCDMApplication*> applications;
119 };
120
121 #endif /* MODELCDMAPPLI_H_ */