Manual for OpenFLUID 2.1.10

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 
36  @author Jean-Christophe FABRE <jean-christophe.fabre@inra.fr>
37  */
38 
39 
40 #ifndef __OPENFLUID_MARKET_MARKETPACKAGE_HPP__
41 #define __OPENFLUID_MARKET_MARKETPACKAGE_HPP__
42 
43 
44 #include <openfluid/dllexport.hpp>
47 
48 
49 namespace openfluid { namespace market {
50 
51 
53 {
54  protected:
55 
56  static const std::string BUILDS_SUBDIR;
57 
58  static const std::string DLOADS_SUBDIR;
59 
60  static const std::string LOG_FILENAME;
61 
62 
63  /*
64  * Temporary dir for openfluid-market
65  */
66  static std::string m_TempDir;
67 
68  /**
69  * Temporary dir for building packages
70  */
71  static std::string m_TempBuildsDir;
72 
73  /**
74  * Temporary dir for downloaded packages
75  */
76  static std::string m_TempDownloadsDir;
77 
78  /**
79  * Market-bag dir for simulators
80  */
81  static std::string m_MarketBagSimulatorDir;
82 
83  /**
84  * Market-bag dir for observers
85  */
86  static std::string m_MarketBagObserverDir;
87 
88  /**
89  * Market-bag dir for builder extensions
90  */
91  static std::string m_MarketBagBuilderextDir;
92 
93  /**
94  * Market-bag dir for datasets
95  */
96  static std::string m_MarketBagDatasetDir;
97 
98  /**
99  * Market-bag subdir for binary packages of current type
100  */
101  static std::string m_MarketBagBinSubDir;
102 
103  /**
104  * Market-bag subdir for source packages of current type
105  */
106  static std::string m_MarketBagSrcSubDir;
107 
108  /**
109  * Common build options for simulators
110  */
111  static std::string m_SimulatorBuildConfigOptions;
112 
113  /**
114  * Common build options for observers
115  */
116  static std::string m_ObserverBuildConfigOptions;
117 
118  /**
119  * Common build options for builder extensions
120  */
121  static std::string m_BuilderextBuildConfigOptions;
122 
123  static std::string m_LogFile;
124 
125  static bool m_IsLogEnabled;
126 
127  static bool m_Initialized;
128 
129 
131 
132  std::string m_PackageURL;
133 
134  std::string m_PackageFilename;
135 
136  std::string m_PackageDest;
137 
139 
140  static void resetLogFile();
141 
142  static void appendToLogFile(const std::string& PackageName,
143  const PackageInfo::PackageType& Type,
144  const std::string& Action,
145  const std::string& Str);
146 
147  static void appendToLogFile(const std::string& Str);
148 
149 
150  public:
151 
152  MarketPackage(const openfluid::ware::WareID_t& ID, const std::string& PackageURL);
153 
154  virtual ~MarketPackage();
155 
156  static void initialize(bool EnableLog);
157 
158  /**
159  Set directory paths attributes with paths passed as parameter
160  */
161  static void setWorksDirs(const std::string& TempDir, const std::string& MarketBagSimulatorDir,
162  const std::string& MarketBagObserverDir, const std::string& MarketBagBuilderextDir,
163  const std::string& MarketBagDatasetDir, const std::string& MarketBagBinSubDir,
164  const std::string& MarketBagSrcSubDir);
165 
166  static std::string getMarketBagSimulatorDir() { return m_MarketBagSimulatorDir; };
167 
168  static std::string getMarketBagObserverDir() { return m_MarketBagObserverDir; };
169 
170  static std::string getMarketBagBuilderextDir() { return m_MarketBagBuilderextDir; };
171 
172  static std::string getMarketBagDatasetDir() { return m_MarketBagDatasetDir; };
173 
174  static std::string getMarketBagBinSubDir() { return m_MarketBagBinSubDir; };
175 
176  static std::string getMarketBagSrcSubDir() { return m_MarketBagSrcSubDir; };
177 
178  static std::string getTempDir() { return m_TempDir; };
179 
180  static std::string getTempBuildsDir() { return m_TempBuildsDir; };
181 
182  static std::string getTempDownloadsDir() { return m_TempDownloadsDir; };
183 
184  static std::string getLogFile() { return m_LogFile; };
185 
186  /**
187  @return build options of package type passed as parameter
188  @param Type of options
189  */
190  static std::string getCommonBuildOptions(const PackageInfo::PackageType& Type);
191 
192  /**
193  Sets build options of package type passed as parameter with BuildOptions
194  @param Type of options
195  @param BuildOptions options to store
196  */
197  static void setCommonBuildOptions(const PackageInfo::PackageType& Type, const std::string& BuildOptions);
198 
199  /**
200  Adds BuildOptions to options of package type
201  @return Common build options of package type with BuildOptions
202  @param Type of package
203  @param BuildOptions to add
204  */
205  static std::string composeFullBuildOptions(const PackageInfo::PackageType& Type, const std::string& BuildOptions);
206 
207  openfluid::ware::WareID_t getID() const { return m_ID; };
208 
209  virtual MetaPackageInfo::SelectionType getFormat() const = 0;
210 
211 
212  /**
213  @return the market-bag path directory for the package type class
214  */
215  virtual std::string getInstallPath() const = 0;
216 
217  /**
218  @return type of current package
219  */
220  virtual PackageInfo::PackageType getPackageType() const = 0;
221 
222  virtual void process() = 0;
223 
224  void download();
225 
226 
227 };
228 
229 
230 } } // namespaces
231 
232 
233 #endif /* __OPENFLUID_MARKET_MARKETPACKAGE_HPP__ */
std::string m_PackageDest
Definition: MarketPackage.hpp:136
static std::string m_SimulatorBuildConfigOptions
Definition: MarketPackage.hpp:111
static std::string getTempDir()
Definition: MarketPackage.hpp:178
static std::string m_BuilderextBuildConfigOptions
Definition: MarketPackage.hpp:121
Definition: ApplicationException.hpp:47
static std::string m_TempBuildsDir
Definition: MarketPackage.hpp:71
static std::string m_TempDownloadsDir
Definition: MarketPackage.hpp:76
static std::string getMarketBagSimulatorDir()
Definition: MarketPackage.hpp:166
static const std::string BUILDS_SUBDIR
Definition: MarketPackage.hpp:56
Definition: MarketPackage.hpp:52
openfluid::ware::WareID_t m_ID
Definition: MarketPackage.hpp:130
static std::string m_MarketBagSrcSubDir
Definition: MarketPackage.hpp:106
bool m_Downloaded
Definition: MarketPackage.hpp:138
PackageType
Definition: MarketInfos.hpp:91
SelectionType
Definition: MarketInfos.hpp:126
static std::string getMarketBagSrcSubDir()
Definition: MarketPackage.hpp:176
openfluid::ware::WareID_t getID() const
Definition: MarketPackage.hpp:207
static std::string m_MarketBagDatasetDir
Definition: MarketPackage.hpp:96
static std::string getTempDownloadsDir()
Definition: MarketPackage.hpp:182
static std::string getMarketBagObserverDir()
Definition: MarketPackage.hpp:168
static bool m_IsLogEnabled
Definition: MarketPackage.hpp:125
static std::string m_MarketBagBinSubDir
Definition: MarketPackage.hpp:101
static std::string m_MarketBagSimulatorDir
Definition: MarketPackage.hpp:81
static std::string m_TempDir
Definition: MarketPackage.hpp:66
static std::string getTempBuildsDir()
Definition: MarketPackage.hpp:180
static std::string m_ObserverBuildConfigOptions
Definition: MarketPackage.hpp:116
static std::string m_LogFile
Definition: MarketPackage.hpp:123
static std::string m_MarketBagObserverDir
Definition: MarketPackage.hpp:86
static std::string getLogFile()
Definition: MarketPackage.hpp:184
static const std::string LOG_FILENAME
Definition: MarketPackage.hpp:60
static std::string m_MarketBagBuilderextDir
Definition: MarketPackage.hpp:91
static std::string getMarketBagDatasetDir()
Definition: MarketPackage.hpp:172
static bool m_Initialized
Definition: MarketPackage.hpp:127
static const std::string DLOADS_SUBDIR
Definition: MarketPackage.hpp:58
#define OPENFLUID_API
Definition: dllexport.hpp:86
static std::string getMarketBagBinSubDir()
Definition: MarketPackage.hpp:174
std::string m_PackageFilename
Definition: MarketPackage.hpp:134
std::string m_PackageURL
Definition: MarketPackage.hpp:132
static std::string getMarketBagBuilderextDir()
Definition: MarketPackage.hpp:170
std::string WareID_t
Definition: TypeDefs.hpp:49