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  \brief Header of ...
35 
36  \author Aline LIBRES <aline.libres@gmail.com>
37  */
38 
39 #ifndef FLUIDXDESCRIPTOR_HPP_
40 #define FLUIDXDESCRIPTOR_HPP_
41 
42 #include <openfluid/dllexport.hpp>
49 #include <openfluid/dllexport.hpp>
50 
51 #include <QDomElement>
52 
53 
54 namespace openfluid {
55 
56 namespace base {
57 class IOListener;
58 }
59 
60 namespace fluidx {
61 
63 {
64  private:
65 
67 
68  openfluid::fluidx::DomainDescriptor m_DomainDescriptor;
69 
70  openfluid::fluidx::RunDescriptor m_RunDescriptor;
71 
72  openfluid::fluidx::DatastoreDescriptor m_DatastoreDescriptor;
73 
74  openfluid::fluidx::MonitoringDescriptor m_MonitoringDescriptor;
75 
76  std::string m_CurrentFile;
77 
78  std::string m_CurrentDir;
79 
80  bool m_RunConfigDefined;
81 
82  bool m_ModelDefined;
83 
84  openfluid::base::IOListener* mp_Listener;
85 
86  std::string m_IndentStr;
87 
88  bool extractWareEnabledFromNode(QDomElement& Node);
89 
90  void extractMonitoringFromNode(QDomElement& Node);
91 
92  openfluid::ware::WareParams_t extractParamsFromNode(QDomElement& Node);
93 
95  const openfluid::ware::WareParams_t& Params,
96  const openfluid::ware::WareParams_t& OverloadParams);
97 
98  void extractModelFromNode(QDomElement& Node);
99 
100  void extractRunFromNode(QDomElement& Node);
101 
102  void extractDomainFomNode(QDomElement& Node);
103 
104  openfluid::core::UnitClassID_t extractUnitClassIDFromNode(
105  QDomElement& Node);
106 
107  void extractDomainDefinitionFromNode(QDomElement& Node);
108 
109  void extractDomainAttributesFromNode(QDomElement& Node);
110 
111  void extractDomainCalendarFromNode(QDomElement& Node);
112 
113  void extractDatastoreFromNode(QDomElement& Node);
114 
115  void parseFile(std::string Filename);
116 
117  // =====================================================================
118  // =====================================================================
119 
120  void prepareFluidXDir(std::string DirPath);
121 
122  std::string getGeneratorMethodAsStr(
124 
125  std::string getParamsAsStr(
126  const openfluid::ware::WareParams_t& Params) const;
127 
128  void writeModelToStream(std::ostream& Contents);
129 
130  void writeDomainToStream(std::ostream& Contents);
131 
132  void writeDomainDefinitionToStream(std::ostream& Contents);
133 
134  void writeDomainAttributesToStream(std::ostream& Contents);
135 
136  void writeDomainCalendarToStream(std::ostream& Contents);
137 
138  void writeRunConfigurationToStream(std::ostream& Contents);
139 
140  void writeDatastoreToStream(std::ostream& Contents);
141 
142  void writeMonitoringToStream(std::ostream& Contents);
143 
144  public:
145 
146 
148 
149  ~FluidXDescriptor();
150 
151  void loadFromDirectory(std::string DirPath);
152 
154  { return m_ModelDescriptor; }
155 
157  { return m_DomainDescriptor; }
158 
160  { return m_RunDescriptor; }
161 
163  { return m_DatastoreDescriptor; }
164 
166  { return m_MonitoringDescriptor; }
167 
169  { return m_ModelDescriptor; }
170 
172  { return m_DomainDescriptor; }
173 
175  { return m_RunDescriptor; }
176 
178  { return m_DatastoreDescriptor; }
179 
181  { return m_MonitoringDescriptor; }
182 
183  // =====================================================================
184  // =====================================================================
185 
186  void writeToManyFiles(std::string DirPath);
187 
188  void writeToSingleFile(std::string FilePath);
189 };
190 
191 }
192 } // namespaces
193 #endif /* FLUIDXDESCRIPTOR_HPP_ */
std::map< WareParamKey_t, WareParamValue_t > WareParams_t
Definition: PluggableWare.hpp:82
const openfluid::fluidx::MonitoringDescriptor & getMonitoringDescriptor() const
Definition: FluidXDescriptor.hpp:180
Definition: DatastoreDescriptor.hpp:51
DLLEXPORT WareSetDescriptor< ObserverDescriptor > MonitoringDescriptor
Definition: MonitoringDescriptor.hpp:50
const openfluid::fluidx::RunDescriptor & getRunDescriptor() const
Definition: FluidXDescriptor.hpp:174
Definition: FluidXDescriptor.hpp:62
const openfluid::fluidx::DatastoreDescriptor & getDatastoreDescriptor() const
Definition: FluidXDescriptor.hpp:177
std::pair< UnitClass_t, UnitID_t > UnitClassID_t
Definition: TypeDefs.hpp:82
openfluid::fluidx::DomainDescriptor & getDomainDescriptor()
Definition: FluidXDescriptor.hpp:156
DLLEXPORT WareSetDescriptor< ModelItemDescriptor > CoupledModelDescriptor
Definition: CoupledModelDescriptor.hpp:51
Definition: DomainDescriptor.hpp:53
Definition: IOListener.hpp:55
openfluid::fluidx::RunDescriptor & getRunDescriptor()
Definition: FluidXDescriptor.hpp:159
const openfluid::fluidx::CoupledModelDescriptor & getModelDescriptor() const
Definition: FluidXDescriptor.hpp:168
const openfluid::fluidx::DomainDescriptor & getDomainDescriptor() const
Definition: FluidXDescriptor.hpp:171
openfluid::fluidx::DatastoreDescriptor & getDatastoreDescriptor()
Definition: FluidXDescriptor.hpp:162
Definition: RunDescriptor.hpp:51
GeneratorMethod
Definition: GeneratorDescriptor.hpp:53
openfluid::fluidx::CoupledModelDescriptor & getModelDescriptor()
Definition: FluidXDescriptor.hpp:153
openfluid::fluidx::MonitoringDescriptor & getMonitoringDescriptor()
Definition: FluidXDescriptor.hpp:165
#define DLLEXPORT
Definition: dllexport.hpp:51