]> Creatis software - crea.git/blob - lib/creaDevManagerLib/modelCDMPackage.h
05e24739014b69c8752d840ec9e57bb4a9b8b63d
[crea.git] / lib / creaDevManagerLib / modelCDMPackage.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  * modelCDMPackage.h
30  *
31  *  Created on: Nov 23, 2012
32  *      Author: Daniel Felipe Gonzalez
33  */
34
35 #ifndef MODELCDMPACKAGE_H_
36 #define MODELCDMPACKAGE_H_
37
38 #include<iostream>
39 #include<vector>
40 #include<map>
41
42 #include"modelCDMFolder.h"
43 #include"modelCDMPackageSrc.h"
44
45 /**
46  * Class representing a package of a Crea project.
47  */
48 class modelCDMPackage : public modelCDMFolder
49 {
50 public:
51   /**
52    * Default constructor.
53    */
54   modelCDMPackage();
55   /**
56    * Package node constructor.
57    * @param parent Parent node of the package folder node.
58    * @param path Full path to the package.
59    * @param name Name of the package folder.
60    * @param level Project hierarchy level of the package node.
61    */
62   modelCDMPackage(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level = 1);
63   /**
64    * Destructor.
65    */
66   ~modelCDMPackage();
67
68   /**
69    * Retrieves the name of the package. the name of the package can be different from the package folder name.
70    * @return Package name.
71    */
72   const std::string& GetNamePackage() const;
73   /**
74    * Retrieves the authors of the package.
75    * @return Package authors.
76    */
77   const std::string& GetAuthors() const;
78   /**
79    * Retrieves the Author e-mails of the package.
80    * @return Author e-mails.
81    */
82   const std::string& GetAuthorsEmail() const;
83   /**
84    * Retrieves the version of the package.
85    * @return Package version.
86    */
87   const std::string& GetVersion() const;
88   /**
89    * Retrieves the description of the package.
90    * @return Package description
91    */
92   const std::string& GetDescription() const;
93   /**
94    * Retrieves the src folder node of the package node.
95    * @return Reference to the package src file node.
96    */
97   modelCDMPackageSrc* GetSrc() const;
98
99   /**
100    * Sets the name of the package authors. This operation affects the project model as well as the system files.
101    * @param authors Name of the package authors.
102    * @param result Result message
103    * @return True if the operation was successful.
104    */
105   bool SetAuthors(const std::string& authors, std::string*& result);
106   /**
107    * Sets the email of the package authors. This operation affects the project model as well as the system files.
108    * @param email
109    * @param result Result message
110    * @return True if the operation was successful.
111    */
112   bool SetAuthorsEmail(const std::string& email, std::string*& result);
113   /**
114    * Sets the version of the package. This operation affects the project model as well as the system files.
115    * @param version
116    * @param result Result message
117    * @return True if the operation was successful.
118    */
119   bool SetVersion(const std::string& version, std::string*& result);
120   /**
121    * Sets the description of the package. This operation affects the project model as well as the system files.
122    * @param description
123    * @param result Result message
124    * @return True if the operation was successful.
125    */
126   bool SetDescription(const std::string& description, std::string*& result);
127
128
129   /**
130    * Creates a new black box and returns a reference to it if the creation is successful. This operation affects the project model as well as the system files.
131    * @param result Result message
132    * @param name New black box name.
133    * @param type Black box type.
134    * @param format Black box format.
135    * @param categories Categories associated to this black box.
136    * @param authors Black box authors' name.
137    * @param authorsEmail Black box authors' email.
138    * @param description Black box description.
139    * @return True if the operation was successful.
140    */
141   modelCDMBlackBox* CreateBlackBox(
142       std::string*& result,
143       const std::string& name,
144       const std::string& type = "std",
145       const std::string& format = "C++",
146       const std::string& categories = "empty",
147       const std::string& authors = "unknown",
148       const std::string& authorsEmail = "",
149       const std::string& description = "no description"
150   );
151   /**
152    * Refreshes the structure of the package folder node. This method updates the properties of the package as well as it refreshes its children.
153    * @param result Result message
154    * @return True if the operation was successful.
155    */
156   virtual const bool Refresh(std::string*& result);
157
158   /**
159    * Checks the package structure with the CMakeLists file to look for project structure definition problems before compiling the project.
160    * @param properties Project properties.
161    */
162   void CheckStructure(std::map<std::string, bool>& properties);
163
164 private:
165   /**
166    * Package name.
167    */
168   std::string namePackage;
169   /**
170    * Package authors' name.
171    */
172   std::string authors;
173   /**
174    * Package authors' e-mails.
175    */
176   std::string authorsEmail;
177   /**
178    * Package version.
179    */
180   std::string version;
181   /**
182    * Package description.
183    */
184   std::string description;
185   /**
186    * Reference to the package source folder.
187    */
188   modelCDMPackageSrc* src;
189
190 };
191
192 #endif /* MODELCDMPACKAGE_H_ */