All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MarketPackage.hpp
Go to the documentation of this file.
1 /*
2 
3  This file is part of OpenFLUID software
4  Copyright(c) 2007, INRA - Montpellier SupAgro
5 
6 
7  == GNU General Public License Usage ==
8 
9  OpenFLUID is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  OpenFLUID is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21 
22 
23  == Other Usage ==
24 
25  Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26  license, and requires a written agreement between You and INRA.
27  Licensees for Other Usage of OpenFLUID may use this file in accordance
28  with the terms contained in the written agreement between You and INRA.
29 
30 */
31 
32 
33 /**
34  \file MarketPackage.hpp
35  \brief Header of ...
36 
37  \author Jean-Christophe FABRE <fabrejc@supagro.inra.fr>
38  */
39 
40 
41 #ifndef __MARKETPACKAGE_HPP__
42 #define __MARKETPACKAGE_HPP__
43 
44 
45 #include <openfluid/dllexport.hpp>
49 
50 
51 namespace openfluid { namespace market {
52 
53 
55 {
56  protected:
57 
58  static const std::string BUILDS_SUBDIR;
59 
60  static const std::string DLOADS_SUBDIR;
61 
62  static const std::string LOG_FILENAME;
63 
64 
65  /*
66  * Temporary dir for openfluid-market
67  */
68  static std::string m_TempDir;
69 
70  /**
71  * Temporary dir for building packages
72  */
73  static std::string m_TempBuildsDir;
74 
75  /**
76  * Temporary dir for downloaded packages
77  */
78  static std::string m_TempDownloadsDir;
79 
80  /**
81  * Market-bag dir for simulators
82  */
83  static std::string m_MarketBagSimulatorDir;
84 
85  /**
86  * Market-bag dir for observers
87  */
88  static std::string m_MarketBagObserverDir;
89 
90  /**
91  * Market-bag dir for builder extensions
92  */
93  static std::string m_MarketBagBuilderextDir;
94 
95  /**
96  * Market-bag dir for datasets
97  */
98  static std::string m_MarketBagDatasetDir;
99 
100  /**
101  * Market-bag subdir for binary packages of current type
102  */
103  static std::string m_MarketBagBinSubDir;
104 
105  /**
106  * Market-bag subdir for source packages of current type
107  */
108  static std::string m_MarketBagSrcSubDir;
109 
111 
112  /**
113  * Common build options for simulators
114  */
115  static std::string m_SimulatorBuildConfigOptions;
116 
117  /**
118  * Common build options for observers
119  */
120  static std::string m_ObserverBuildConfigOptions;
121 
122  /**
123  * Common build options for builder extensions
124  */
125  static std::string m_BuilderextBuildConfigOptions;
126 
127  static std::string m_LogFile;
128 
129  static bool m_IsLogEnabled;
130 
131  static bool m_Initialized;
132 
133 
134 
136 
137  std::string m_PackageURL;
138 
139  std::string m_PackageFilename;
140 
141  std::string m_PackageDest;
142 
144 
145  static void resetLogFile();
146 
147  static void appendToLogFile(const std::string& PackageName,
148  const PackageInfo::PackageType& Type,
149  const std::string& Action,
150  const std::string& Str);
151 
152  static void appendToLogFile(const std::string& Str);
153 
154 
155  public:
156 
157  MarketPackage(const openfluid::ware::WareID_t& ID, const std::string& PackageURL);
158 
159  virtual ~MarketPackage();
160 
161  static void initialize(bool EnableLog);
162 
163  /**
164  Set directory paths attributes with paths passed as parameter
165  */
166  static void setWorksDirs(const std::string& TempDir, const std::string& MarketBagSimulatorDir,
167  const std::string& MarketBagObserverDir, const std::string& MarketBagBuilderextDir,
168  const std::string& MarketBagDatasetDir, const std::string& MarketBagBinSubDir,
169  const std::string& MarketBagSrcSubDir);
170 
171  static std::string getMarketBagSimulatorDir() { return m_MarketBagSimulatorDir; };
172 
173  static std::string getMarketBagObserverDir() { return m_MarketBagObserverDir; };
174 
175  static std::string getMarketBagBuilderextDir() { return m_MarketBagBuilderextDir; };
176 
177  static std::string getMarketBagDatasetDir() { return m_MarketBagDatasetDir; };
178 
179  static std::string getMarketBagBinSubDir() { return m_MarketBagBinSubDir; };
180 
181  static std::string getMarketBagSrcSubDir() { return m_MarketBagSrcSubDir; };
182 
183  static std::string getTempDir() { return m_TempDir; };
184 
185  static std::string getTempBuildsDir() { return m_TempBuildsDir; };
186 
187  static std::string getTempDownloadsDir() { return m_TempDownloadsDir; };
188 
189  static std::string getLogFile() { return m_LogFile; };
190 
191  /**
192  @return build options of package type passed as parameter
193  @param Type of options
194  */
195  static std::string getCommonBuildOptions(const PackageInfo::PackageType& Type);
196 
197  /**
198  Sets build options of package type passed as parameter with BuildOptions
199  @param Type of options
200  @param BuildOptions options to store
201  */
202  static void setCommonBuildOptions(const PackageInfo::PackageType& Type, const std::string& BuildOptions);
203 
204  /**
205  Adds BuildOptions to options of package type
206  @return Common build options of package type with BuildOptions
207  @param Type of package
208  @param BuildOptions to add
209  */
210  static std::string composeFullBuildOptions(const PackageInfo::PackageType& Type, const std::string& BuildOptions);
211 
212  openfluid::ware::WareID_t getID() const { return m_ID; };
213 
214  virtual MetaPackageInfo::SelectionType getFormat() const = 0;
215 
216 
217  /**
218  @return the market-bag path directory for the package type class
219  */
220  virtual std::string getInstallPath() const = 0;
221 
222  /**
223  @return type of current package
224  */
225  virtual PackageInfo::PackageType getPackageType() const = 0;
226 
227  virtual void process() = 0;
228 
229  void download();
230 
231 
232 };
233 
234 
235 
236 
237 } } // namespaces
238 
239 
240 #endif /* __MARKETPACKAGE_HPP__ */
static std::string m_SimulatorBuildConfigOptions
Definition: MarketPackage.hpp:115
openfluid::ware::WareID_t m_ID
Definition: MarketPackage.hpp:135
SelectionType
Definition: MarketInfos.hpp:129
static std::string m_TempBuildsDir
Definition: MarketPackage.hpp:73
static std::string getTempDownloadsDir()
Definition: MarketPackage.hpp:187
static openfluid::tools::ExternalProgram m_CMakeProgram
Definition: MarketPackage.hpp:110
static std::string m_BuilderextBuildConfigOptions
Definition: MarketPackage.hpp:125
bool m_Downloaded
Definition: MarketPackage.hpp:143
Header of ...
static std::string m_MarketBagSrcSubDir
Definition: MarketPackage.hpp:108
static std::string m_LogFile
Definition: MarketPackage.hpp:127
std::string m_PackageURL
Definition: MarketPackage.hpp:137
static std::string m_MarketBagObserverDir
Definition: MarketPackage.hpp:88
static std::string m_MarketBagBuilderextDir
Definition: MarketPackage.hpp:93
static std::string getMarketBagObserverDir()
Definition: MarketPackage.hpp:173
PackageType
Definition: MarketInfos.hpp:94
static std::string m_ObserverBuildConfigOptions
Definition: MarketPackage.hpp:120
openfluid::ware::WareID_t getID() const
Definition: MarketPackage.hpp:212
static std::string getMarketBagSimulatorDir()
Definition: MarketPackage.hpp:171
static std::string getMarketBagBuilderextDir()
Definition: MarketPackage.hpp:175
std::string m_PackageDest
Definition: MarketPackage.hpp:141
std::string WareID_t
Definition: WareSignature.hpp:86
static std::string getLogFile()
Definition: MarketPackage.hpp:189
Definition: ExternalProgram.hpp:54
static std::string getMarketBagSrcSubDir()
Definition: MarketPackage.hpp:181
static std::string getTempBuildsDir()
Definition: MarketPackage.hpp:185
static const std::string BUILDS_SUBDIR
Definition: MarketPackage.hpp:58
static std::string m_TempDownloadsDir
Definition: MarketPackage.hpp:78
static const std::string LOG_FILENAME
Definition: MarketPackage.hpp:62
static std::string m_MarketBagSimulatorDir
Definition: MarketPackage.hpp:83
static std::string m_MarketBagDatasetDir
Definition: MarketPackage.hpp:98
static std::string getTempDir()
Definition: MarketPackage.hpp:183
std::string m_PackageFilename
Definition: MarketPackage.hpp:139
Header of ...
static std::string getMarketBagBinSubDir()
Definition: MarketPackage.hpp:179
static std::string m_MarketBagBinSubDir
Definition: MarketPackage.hpp:103
static std::string m_TempDir
Definition: MarketPackage.hpp:68
Definition: MarketPackage.hpp:54
static bool m_IsLogEnabled
Definition: MarketPackage.hpp:129
static std::string getMarketBagDatasetDir()
Definition: MarketPackage.hpp:177
static const std::string DLOADS_SUBDIR
Definition: MarketPackage.hpp:60
static bool m_Initialized
Definition: MarketPackage.hpp:131
#define DLLEXPORT
Definition: dllexport.hpp:51