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 #ifndef __SYSTEM_HPP
00032 #define __SYSTEM_HPP
00033
00034 #include "libecs.hpp"
00035
00036 #include "Entity.hpp"
00037
00038 namespace libecs
00039 {
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 DECLARE_MAP( const String, VariablePtr,
00050 std::less<const String>, VariableMap );
00051 DECLARE_MAP( const String, ProcessPtr,
00052 std::less<const String>, ProcessMap );
00053 DECLARE_MAP( const String, SystemPtr,
00054 std::less<const String>, SystemMap );
00055
00056
00057 LIBECS_DM_CLASS( System, Entity )
00058 {
00059
00060 public:
00061
00062 LIBECS_DM_BASECLASS( System );
00063
00064 LIBECS_DM_OBJECT( System, System )
00065 {
00066 INHERIT_PROPERTIES( Entity );
00067
00068
00069 PROPERTYSLOT_SET_GET( String, StepperID );
00070
00071 PROPERTYSLOT_GET_NO_LOAD_SAVE( Real, Size );
00072
00073 }
00074
00075 System();
00076 virtual ~System();
00077
00078 virtual const EntityType getEntityType() const
00079 {
00080 return EntityType( EntityType::SYSTEM );
00081 }
00082
00083 virtual void initialize();
00084
00085
00086
00087
00088
00089
00090
00091
00092 StepperPtr getStepper() const
00093 {
00094 return theStepper;
00095 }
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105 SET_METHOD( String, StepperID );
00106
00107
00108
00109
00110
00111
00112
00113
00114 GET_METHOD( String, StepperID );
00115
00116
00117
00118
00119
00120
00121
00122 ECELL_API GET_METHOD( Real, Size );
00123
00124 GET_METHOD( Real, SizeN_A )
00125 {
00126 return getSize() * N_A;
00127 }
00128
00129 template <class C>
00130 const std::map<const String,C*,std::less<const String> >& getMap() const;
00131
00132
00133
00134
00135 VariableMapCref getVariableMap() const
00136 {
00137 return theVariableMap;
00138 }
00139
00140 ProcessMapCref getProcessMap() const
00141 {
00142 return theProcessMap;
00143 }
00144
00145 SystemMapCref getSystemMap() const
00146 {
00147 return theSystemMap;
00148 }
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159 ProcessPtr getProcess( StringCref anID ) const;
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170 VariablePtr getVariable( StringCref anID ) const;
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187 SystemPtr getSystem( SystemPathCref anID ) const;
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205 SystemPtr getSystem( StringCref id ) const;
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215 void registerProcess( ProcessPtr aProcess );
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225 void registerVariable( VariablePtr aVariable );
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235 void registerSystem( SystemPtr aSystem );
00236
00237
00238
00239
00240
00241
00242
00243
00244 bool isRootSystem() const
00245 {
00246 return ( getSuperSystem() == this );
00247 }
00248
00249
00250
00251
00252
00253 virtual const SystemPath getSystemPath() const;
00254
00255
00256
00257
00258
00259
00260
00261
00262 ModelPtr getModel() const
00263 {
00264 return theModel;
00265 }
00266
00267 void setModel( ModelPtr const aModel )
00268 {
00269 theModel = aModel;
00270 }
00271
00272 VariableCptr const getSizeVariable() const
00273 {
00274 return theSizeVariable;
00275 }
00276
00277 void notifyChangeOfEntityList();
00278
00279 VariableCptr const findSizeVariable() const;
00280
00281 void configureSizeVariable();
00282
00283 public:
00284
00285 ECELL_API GET_METHOD( Polymorph, SystemList );
00286 ECELL_API GET_METHOD( Polymorph, VariableList );
00287 ECELL_API GET_METHOD( Polymorph, ProcessList );
00288
00289 protected:
00290
00291 StepperPtr theStepper;
00292
00293 private:
00294
00295 ModelPtr theModel;
00296
00297 VariableMap theVariableMap;
00298 ProcessMap theProcessMap;
00299 SystemMap theSystemMap;
00300
00301 VariableCptr theSizeVariable;
00302
00303 bool theEntityListChanged;
00304
00305 };
00306
00307
00308
00309 template <>
00310 inline VariableMapCref System::getMap() const
00311 {
00312 return getVariableMap();
00313 }
00314
00315 template <>
00316 inline ProcessMapCref System::getMap() const
00317 {
00318 return getProcessMap();
00319 }
00320
00321 template <>
00322 inline SystemMapCref System::getMap() const
00323 {
00324 return getSystemMap();
00325 }
00326
00327
00328
00329
00330
00331 }
00332
00333
00334 #endif
00335
00336
00337
00338
00339
00340
00341
00342
00343