Manual for OpenFLUID 2.1.11

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()
167  {
168  return m_MarketBagSimulatorDir;
169  }
170 
171  static std::string getMarketBagObserverDir()
172  {
173  return m_MarketBagObserverDir;
174  }
175 
176  static std::string getMarketBagBuilderextDir()
177  {
178  return m_MarketBagBuilderextDir;
179  }
180 
181  static std::string getMarketBagDatasetDir()
182  {
183  return m_MarketBagDatasetDir;
184  }
185 
186  static std::string getMarketBagBinSubDir()
187  {
188  return m_MarketBagBinSubDir;
189  }
190 
191  static std::string getMarketBagSrcSubDir()
192  {
193  return m_MarketBagSrcSubDir;
194  }
195 
196  static std::string getTempDir()
197  {
198  return m_TempDir;
199  }
200 
201  static std::string getTempBuildsDir()
202  {
203  return m_TempBuildsDir;
204  }
205 
206  static std::string getTempDownloadsDir()
207  {
208  return m_TempDownloadsDir;
209  }
210 
211  static std::string getLogFile()
212  {
213  return m_LogFile;
214  }
215 
216  /**
217  @return build options of package type passed as parameter
218  @param Type of options
219  */
220  static std::string getCommonBuildOptions(const PackageInfo::PackageType& Type);
221 
222  /**
223  Sets build options of package type passed as parameter with BuildOptions
224  @param Type of options
225  @param BuildOptions options to store
226  */
227  static void setCommonBuildOptions(const PackageInfo::PackageType& Type, const std::string& BuildOptions);
228 
229  /**
230  Adds BuildOptions to options of package type
231  @return Common build options of package type with BuildOptions
232  @param Type of package
233  @param BuildOptions to add
234  */
235  static std::string composeFullBuildOptions(const PackageInfo::PackageType& Type, const std::string& BuildOptions);
236 
237  openfluid::ware::WareID_t getID() const { return m_ID; };
238 
239  virtual MetaPackageInfo::SelectionType getFormat() const = 0;
240 
241 
242  /**
243  @return the market-bag path directory for the package type class
244  */
245  virtual std::string getInstallPath() const = 0;
246 
247  /**
248  @return type of current package
249  */
250  virtual PackageInfo::PackageType getPackageType() const = 0;
251 
252  virtual void process() = 0;
253 
254  void download();
255 
256 
257 };
258 
259 
260 } } // namespaces
261 
262 
263 #endif /* __OPENFLUID_MARKET_MARKETPACKAGE_HPP__ */
openfluid::market::MarketPackage::m_MarketBagSrcSubDir
static std::string m_MarketBagSrcSubDir
Definition: MarketPackage.hpp:106
openfluid::market::MarketPackage::getID
openfluid::ware::WareID_t getID() const
Definition: MarketPackage.hpp:237
openfluid::market::MarketPackage::getTempDownloadsDir
static std::string getTempDownloadsDir()
Definition: MarketPackage.hpp:206
openfluid::ware::WareID_t
std::string WareID_t
Definition: TypeDefs.hpp:49
OPENFLUID_API
#define OPENFLUID_API
Definition: dllexport.hpp:86
openfluid::market::MarketPackage::m_BuilderextBuildConfigOptions
static std::string m_BuilderextBuildConfigOptions
Definition: MarketPackage.hpp:121
openfluid::market::MarketPackage::m_MarketBagSimulatorDir
static std::string m_MarketBagSimulatorDir
Definition: MarketPackage.hpp:81
openfluid::market::MarketPackage::getMarketBagSimulatorDir
static std::string getMarketBagSimulatorDir()
Definition: MarketPackage.hpp:166
openfluid::market::MarketPackage::m_PackageFilename
std::string m_PackageFilename
Definition: MarketPackage.hpp:134
openfluid::market::MarketPackage::BUILDS_SUBDIR
static const std::string BUILDS_SUBDIR
Definition: MarketPackage.hpp:56
openfluid::market::MarketPackage::m_TempDownloadsDir
static std::string m_TempDownloadsDir
Definition: MarketPackage.hpp:76
openfluid::market::MarketPackage::getLogFile
static std::string getLogFile()
Definition: MarketPackage.hpp:211
openfluid::market::MarketPackage::m_ID
openfluid::ware::WareID_t m_ID
Definition: MarketPackage.hpp:130
MarketInfos.hpp
openfluid::market::MarketPackage::m_MarketBagBuilderextDir
static std::string m_MarketBagBuilderextDir
Definition: MarketPackage.hpp:91
openfluid::market::MarketPackage::getTempDir
static std::string getTempDir()
Definition: MarketPackage.hpp:196
openfluid::market::MarketPackage::m_TempDir
static std::string m_TempDir
Definition: MarketPackage.hpp:66
openfluid::market::PackageInfo::PackageType
PackageType
Definition: MarketInfos.hpp:91
openfluid::market::MarketPackage::getTempBuildsDir
static std::string getTempBuildsDir()
Definition: MarketPackage.hpp:201
openfluid::market::MarketPackage::m_MarketBagObserverDir
static std::string m_MarketBagObserverDir
Definition: MarketPackage.hpp:86
openfluid::market::MarketPackage::LOG_FILENAME
static const std::string LOG_FILENAME
Definition: MarketPackage.hpp:60
openfluid::market::MarketPackage::m_IsLogEnabled
static bool m_IsLogEnabled
Definition: MarketPackage.hpp:125
openfluid
Definition: ApplicationException.hpp:47
openfluid::market::MarketPackage::getMarketBagObserverDir
static std::string getMarketBagObserverDir()
Definition: MarketPackage.hpp:171
openfluid::market::MarketPackage::m_MarketBagBinSubDir
static std::string m_MarketBagBinSubDir
Definition: MarketPackage.hpp:101
openfluid::market::MarketPackage::m_ObserverBuildConfigOptions
static std::string m_ObserverBuildConfigOptions
Definition: MarketPackage.hpp:116
openfluid::market::MarketPackage::getMarketBagSrcSubDir
static std::string getMarketBagSrcSubDir()
Definition: MarketPackage.hpp:191
openfluid::market::MarketPackage::m_Initialized
static bool m_Initialized
Definition: MarketPackage.hpp:127
openfluid::market::MetaPackageInfo::SelectionType
SelectionType
Definition: MarketInfos.hpp:126
openfluid::market::MarketPackage
Definition: MarketPackage.hpp:52
openfluid::market::MarketPackage::m_MarketBagDatasetDir
static std::string m_MarketBagDatasetDir
Definition: MarketPackage.hpp:96
openfluid::market::MarketPackage::getMarketBagDatasetDir
static std::string getMarketBagDatasetDir()
Definition: MarketPackage.hpp:181
openfluid::market::MarketPackage::m_TempBuildsDir
static std::string m_TempBuildsDir
Definition: MarketPackage.hpp:71
openfluid::market::MarketPackage::getMarketBagBinSubDir
static std::string getMarketBagBinSubDir()
Definition: MarketPackage.hpp:186
openfluid::market::MarketPackage::m_Downloaded
bool m_Downloaded
Definition: MarketPackage.hpp:138
openfluid::market::MarketPackage::getMarketBagBuilderextDir
static std::string getMarketBagBuilderextDir()
Definition: MarketPackage.hpp:176
dllexport.hpp
openfluid::market::MarketPackage::m_PackageDest
std::string m_PackageDest
Definition: MarketPackage.hpp:136
openfluid::market::MarketPackage::m_PackageURL
std::string m_PackageURL
Definition: MarketPackage.hpp:132
openfluid::market::MarketPackage::DLOADS_SUBDIR
static const std::string DLOADS_SUBDIR
Definition: MarketPackage.hpp:58
openfluid::market::MarketPackage::m_LogFile
static std::string m_LogFile
Definition: MarketPackage.hpp:123
Environment.hpp
openfluid::market::MarketPackage::m_SimulatorBuildConfigOptions
static std::string m_SimulatorBuildConfigOptions
Definition: MarketPackage.hpp:111