Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef ADVANCEDDOMAINDESCRIPTOR_HPP_
00040 #define ADVANCEDDOMAINDESCRIPTOR_HPP_
00041
00042 #include <openfluid/core/TypeDefs.hpp>
00043 #include <openfluid/dllexport.hpp>
00044 #include <openfluid/fluidx/EventDescriptor.hpp>
00045
00046 #include <map>
00047 #include <set>
00048
00049 namespace openfluid {
00050
00051 namespace core {
00052 class Event;
00053 }
00054
00055 namespace fluidx {
00056
00057 class DomainDescriptor;
00058 class UnitDescriptor;
00059 class AttributesDescriptor;
00060
00061
00062
00063
00064
00065
00066 class DLLEXPORT AdvancedUnitDescriptor
00067 {
00068
00069 public:
00070
00071 openfluid::fluidx::UnitDescriptor* UnitDescriptor;
00072
00073 std::map<openfluid::core::AttributeName_t, std::string*> Attributes;
00074
00075 std::list<openfluid::fluidx::EventDescriptor*> EventsDescriptors;
00076
00077 AdvancedUnitDescriptor(openfluid::fluidx::UnitDescriptor& UnitDesc) :
00078 UnitDescriptor(&UnitDesc)
00079 {
00080 }
00081
00082 };
00083
00084
00085
00086
00087
00088
00089 class DLLEXPORT AdvancedDomainDescriptor
00090 {
00091 public:
00092
00093 typedef std::map<std::string, std::map<int, AdvancedUnitDescriptor> > UnitsByIdByClass_t;
00094
00095 private:
00096
00097 openfluid::fluidx::DomainDescriptor* mp_DomainDesc;
00098
00099
00100
00101
00102 std::map<std::string, std::map<int, AdvancedUnitDescriptor> > m_Units;
00103
00104 std::map<std::string, std::set<openfluid::core::AttributeName_t> > m_AttrsNames;
00105
00106 void dispatchUnits();
00107
00108 void dispatchAttributes();
00109
00110 void checkUnitRelations() const;
00111
00112 void checkUnitRelations(openfluid::fluidx::UnitDescriptor& Unit) const;
00113
00114 void checkAttributesConsistency() const;
00115
00116 void dispatchEvents();
00117
00118
00119 public:
00120
00121 AdvancedDomainDescriptor(openfluid::fluidx::DomainDescriptor& DomainDesc);
00122
00123 ~AdvancedDomainDescriptor();
00124
00125 bool isUnitExist(const std::string& ClassName, int ID) const;
00126
00127
00128
00129
00130
00131 const std::map<std::string, std::map<int, AdvancedUnitDescriptor> >& getUnitsByIdByClass() const;
00132
00133
00134
00135
00136
00137
00138
00139 const AdvancedUnitDescriptor& getUnit(const std::string& ClassName, int ID) const;
00140
00141
00142
00143
00144
00145
00146
00147 const openfluid::fluidx::UnitDescriptor& getUnitDescriptor(
00148 const std::string& ClassName, int ID) const;
00149
00150
00151
00152
00153
00154
00155 std::set<int> getIDsOfClass(const std::string& ClassName) const;
00156
00157 bool isClassNameExists(const std::string& ClassName) const;
00158
00159
00160
00161
00162
00163 std::set<std::string> getClassNames() const;
00164
00165 unsigned int getUnitsCount() const;
00166
00167
00168
00169
00170
00171
00172
00173
00174 void addUnit(openfluid::fluidx::UnitDescriptor* UnitDesc);
00175
00176
00177
00178
00179
00180
00181
00182 void deleteUnit(const std::string& ClassName, int ID);
00183
00184
00185
00186
00187
00188
00189
00190
00191 std::string& getAttribute(const std::string& ClassName, int ID,
00192 const std::string& AttrName);
00193
00194
00195
00196
00197
00198
00199 std::set<std::string> getAttributesNames(const std::string& ClassName) const;
00200
00201
00202
00203
00204
00205
00206
00207
00208 void addAttribute(const std::string& ClassName, const std::string& AttrName,
00209 const std::string& DefaultValue);
00210
00211
00212
00213
00214
00215
00216
00217 void deleteAttribute(const std::string& ClassName, const std::string& AttrName);
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227 void renameAttribute(const std::string& ClassName, const std::string& OldAttrName,
00228 const std::string& NewAttrName);
00229
00230
00231
00232
00233
00234
00235
00236 void addEvent(const openfluid::core::UnitClass_t& UnitsClass, const openfluid::core::UnitID_t& UnitID,
00237 const openfluid::core::Event& Event);
00238
00239
00240
00241
00242
00243
00244
00245 void deleteEvent(const openfluid::core::UnitClass_t& UnitsClass, const openfluid::core::UnitID_t& UnitID,
00246 const openfluid::fluidx::EventID_t& EventID);
00247
00248
00249
00250
00251
00252
00253 void modifyEvent(const openfluid::fluidx::EventID_t& EventID,
00254 const openfluid::core::Event& Event);
00255
00256
00257
00258
00259
00260 openfluid::fluidx::EventDescriptor* getEventDescriptor(const openfluid::fluidx::EventID_t& ID);
00261
00262
00263 const std::list<openfluid::core::UnitClassID_t>& getUnitsToOf(const openfluid::core::UnitClassID_t Unit) const;
00264
00265 const std::list<openfluid::core::UnitClassID_t>& getUnitsParentsOf(const openfluid::core::UnitClassID_t Unit) const;
00266
00267 std::list<openfluid::core::UnitClassID_t> getUnitsFromOf(const openfluid::core::UnitClassID_t Unit) const;
00268
00269 std::list<openfluid::core::UnitClassID_t> getUnitsChildrenOf(const openfluid::core::UnitClassID_t Unit) const;
00270
00271
00272
00273
00274
00275
00276 void addFromToRelation(const openfluid::core::UnitClassID_t FromUnit,
00277 const openfluid::core::UnitClassID_t ToUnit);
00278
00279
00280
00281
00282
00283 void removeFromToRelation(const openfluid::core::UnitClassID_t FromUnit,
00284 const openfluid::core::UnitClassID_t ToUnit);
00285
00286
00287
00288
00289
00290
00291 void addParentChildRelation(const openfluid::core::UnitClassID_t ParentUnit,
00292 const openfluid::core::UnitClassID_t ChildUnit);
00293
00294
00295
00296
00297
00298 void removeParentChildRelation(
00299 const openfluid::core::UnitClassID_t ParentUnit,
00300 const openfluid::core::UnitClassID_t ChildUnit);
00301
00302
00303
00304
00305
00306
00307 void clearRelations(const openfluid::core::UnitClassID_t Unit);
00308
00309 void clearDomain();
00310 };
00311
00312
00313
00314
00315
00316
00317 } }
00318
00319 #endif
00320