All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FluidXDescriptor.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  @file FluidXDescriptor.hpp
34 
35  @author Aline LIBRES <aline.libres@gmail.com>
36  @author Jean-Christophe Fabre <jean-christophe.fabre@supagro.inra.fr>
37  */
38 
39 #ifndef __OPENFLUID_FLUIDX_FLUIDXDESCRIPTOR_HPP__
40 #define __OPENFLUID_FLUIDX_FLUIDXDESCRIPTOR_HPP__
41 
42 #include <openfluid/dllexport.hpp>
48 #include <openfluid/dllexport.hpp>
50 #include <QDomElement>
51 
52 
53 namespace openfluid {
54 
55 namespace base {
56 class IOListener;
57 }
58 
59 namespace fluidx {
60 
62 {
63  private:
64 
66 
68 
69  openfluid::fluidx::RunDescriptor m_RunDescriptor;
70 
71  openfluid::fluidx::DatastoreDescriptor m_DatastoreDescriptor;
72 
73  openfluid::fluidx::MonitoringDescriptor m_MonitoringDescriptor;
74 
75  std::string m_CurrentFile;
76 
77  std::string m_CurrentDir;
78 
79  bool m_RunConfigDefined;
80 
81  bool m_ModelDefined;
82 
83  std::string m_IndentStr;
84 
85  openfluid::base::IOListener* mp_Listener;
86 
87  bool extractWareEnabledFromNode(QDomElement& Node);
88 
89  void extractMonitoringFromNode(QDomElement& Node);
90 
91  openfluid::ware::WareParams_t extractParamsFromNode(QDomElement& Node);
92 
94  const openfluid::ware::WareParams_t& OverloadParams);
95 
96  void extractModelFromNode(QDomElement& Node);
97 
98  void extractRunFromNode(QDomElement& Node);
99 
100  void extractDomainFomNode(QDomElement& Node);
101 
102  openfluid::core::UnitClassID_t extractUnitClassIDFromNode(QDomElement& Node);
103 
104  void extractDomainDefinitionFromNode(QDomElement& Node);
105 
106  void extractDomainAttributesFromNode(QDomElement& Node);
107 
108  void extractDomainCalendarFromNode(QDomElement& Node);
109 
110  void extractDatastoreFromNode(QDomElement& Node);
111 
112  void parseFile(std::string Filename);
113 
114  // =====================================================================
115  // =====================================================================
116 
117  void prepareFluidXDir(const std::string& DirPath);
118 
119  std::string getGeneratorMethodAsStr(openfluid::fluidx::GeneratorDescriptor::GeneratorMethod Method) const;
120 
121  std::string getParamsAsStr(const openfluid::ware::WareParams_t& Params) const;
122 
123  void writeModelToStream(std::ostream& Contents);
124 
125  void writeDomainToStream(std::ostream& Contents);
126 
127  void writeDomainDefinitionToStream(std::ostream& Contents);
128 
129  void writeDomainAttributesToStream(std::ostream& Contents);
130 
131  void writeDomainCalendarToStream(std::ostream& Contents);
132 
133  void writeRunConfigurationToStream(std::ostream& Contents);
134 
135  void writeDatastoreToStream(std::ostream& Contents);
136 
137  void writeMonitoringToStream(std::ostream& Contents);
138 
139  public:
140 
141 
143 
144  ~FluidXDescriptor();
145 
146  void loadFromDirectory(const std::string& DirPath);
147 
149  { return m_ModelDescriptor; }
150 
152  { return m_DomainDescriptor; }
153 
155  { return m_RunDescriptor; }
156 
158  { return m_DatastoreDescriptor; }
159 
161  { return m_MonitoringDescriptor; }
162 
164  { return m_ModelDescriptor; }
165 
167  { return m_DomainDescriptor; }
168 
170  { return m_RunDescriptor; }
171 
173  { return m_DatastoreDescriptor; }
174 
176  { return m_MonitoringDescriptor; }
177 
178  // =====================================================================
179  // =====================================================================
180 
181  void writeToManyFiles(const std::string& DirPath);
182 
183  void writeToSingleFile(const std::string& FilePath);
184 };
185 
186 } } // namespaces
187 
188 #endif /* __OPENFLUID_FLUIDX_FLUIDXDESCRIPTOR_HPP__ */
openfluid::fluidx::RunDescriptor & runDescriptor()
Definition: FluidXDescriptor.hpp:154
openfluid::fluidx::SpatialDomainDescriptor & spatialDomainDescriptor()
Definition: FluidXDescriptor.hpp:151
const openfluid::fluidx::RunDescriptor & runDescriptor() const
Definition: FluidXDescriptor.hpp:169
Definition: IOListener.hpp:55
const openfluid::fluidx::CoupledModelDescriptor & modelDescriptor() const
Definition: FluidXDescriptor.hpp:163
Definition: FluidXDescriptor.hpp:61
const openfluid::fluidx::SpatialDomainDescriptor & spatialDomainDescriptor() const
Definition: FluidXDescriptor.hpp:166
const openfluid::fluidx::DatastoreDescriptor & datastoreDescriptor() const
Definition: FluidXDescriptor.hpp:172
std::pair< UnitsClass_t, UnitID_t > UnitClassID_t
Definition: TypeDefs.hpp:91
const openfluid::fluidx::MonitoringDescriptor & monitoringDescriptor() const
Definition: FluidXDescriptor.hpp:175
Definition: RunDescriptor.hpp:51
openfluid::fluidx::DatastoreDescriptor & datastoreDescriptor()
Definition: FluidXDescriptor.hpp:157
GeneratorMethod
Definition: GeneratorDescriptor.hpp:53
Definition: DatastoreDescriptor.hpp:50
openfluid::fluidx::CoupledModelDescriptor & modelDescriptor()
Definition: FluidXDescriptor.hpp:148
#define OPENFLUID_API
Definition: dllexport.hpp:87
openfluid::fluidx::MonitoringDescriptor & monitoringDescriptor()
Definition: FluidXDescriptor.hpp:160
std::map< WareParamKey_t, WareParamValue_t > WareParams_t
Definition: TypeDefs.hpp:93
Definition: SpatialDomainDescriptor.hpp:53