]> Creatis software - crea.git/blob - lib/creaDevManagerLib/modelCDMLib.h
Feature #1711 CreaDevManager application implementation
[crea.git] / lib / creaDevManagerLib / modelCDMLib.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  * modelCDMLib.h
30  *
31  *  Created on: Nov 23, 2012
32  *      Author: Daniel Felipe Gonzalez Obando
33  */
34
35 #ifndef MODELCDMLIB_H_
36 #define MODELCDMLIB_H_
37
38 #include<iostream>
39 #include<vector>
40 #include<map>
41
42 #include "modelCDMFolder.h"
43 #include "modelCDMLibrary.h"
44
45 /**
46  * Class representing the lib folder of a Crea project.
47  */
48 class modelCDMLib : public modelCDMFolder
49 {
50 public:
51   /**
52    * Default Constructor.
53    */
54   modelCDMLib();
55   /**
56    * Lib folder node constructor.
57    * @param parent Parent node of the lib folder node.
58    * @param path Full path to the lib folder node.
59    * @param name Name of the lib folder node. By default "lib".
60    * @param level Project hierarchy level of the lib folder node.
61    */
62   modelCDMLib(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name = "lib", const int& level = 1);
63   /**
64    * Destructor.
65    */
66   ~modelCDMLib();
67
68   /**
69    * Returns the libraries registered in the lib folder.
70    * @return Array of library references.
71    */
72   const std::vector<modelCDMLibrary*>& GetLibraries() const;
73
74   /**
75    * Creates a new library node for the actual project and registers it. It modifies the project model as well as the system. The created library is included in the lib's CMakeLists file.
76    * @param name Name of the new library.
77    * @param result Result message.
78    * @return New library reference.
79    */
80   modelCDMLibrary* CreateLibrary(
81       const std::string& name,
82       std::string*& result
83   );
84
85   /**
86    * Refreshes the structure of the lib folder. Deletes folders and files deleted since the las refresh and Adds folders and files created since the las refresh.
87    * @param result Result message.
88    * @return True if the operation was successful.
89    */
90   virtual const bool Refresh(std::string*& result);
91
92   /**
93    * Checks the file structure and the CMakeLists file to find structure definition errors before compiling the project.
94    * @param properties Properties of the project.
95    */
96   void CheckStructure(std::map<std::string, bool>& properties);
97
98   /**
99    * Checks if the given library is included in the CMakeLists file.
100    * @param library_name Name of the library to check.
101    * @return True if the library is included, otherwise returns False.
102    */
103   bool IsLibraryIncluded(const std::string& library_name);
104
105   /**
106    * Sets the inclusion of the library in the lib's CMakeLists file. If the library inclusion already exist in file, then the line is uncommented/commented depending on the requested action. If the library inclusion doesn't exist yet, then it is included if the request is an inclusion.
107    * @param library_name Name of the library to include/exclude.
108    * @param toInclude True if the request is an inclusion, False otherwise.
109    * @return True if the request was processed successfully.
110    */
111   bool SetLibraryInclude(const std::string& library_name, const bool& toInclude);
112
113 private:
114   /**
115    * Libraries references.
116    */
117   std::vector<modelCDMLibrary*> libraries;
118 };
119
120 #endif /* MODELCDMLIB_H_ */