00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef TORC_GENERIC_OM_SIMULATE_HPP
00017 #define TORC_GENERIC_OM_SIMULATE_HPP
00018
00019 #include "torc/generic/om/PointerTypes.hpp"
00020 #include "torc/generic/om/Nameable.hpp"
00021 #include "torc/generic/om/Renamable.hpp"
00022 #include "torc/generic/om/Commentable.hpp"
00023 #include "torc/generic/om/Visitable.hpp"
00024 #include "torc/generic/om/VisitorType.hpp"
00025 #include "torc/generic/om/SelfReferencing.hpp"
00026 #include "torc/generic/om/SymTab.hpp"
00027 #include "torc/generic/om/UserDataContainer.hpp"
00028 #include "torc/generic/om/PortListAlias.hpp"
00029 #include "torc/generic/om/FactoryType.hpp"
00030 #include "torc/generic/util/Error.hpp"
00031
00032 #include <vector>
00033
00034 namespace torc { namespace generic { class BaseVisitor; } }
00035 namespace torc { namespace generic { class Apply; } }
00036 namespace torc { namespace generic { class WaveValue; } }
00037
00038 namespace torc {
00039
00040 namespace generic {
00041
00042
00043
00044
00045
00046
00047 class Simulate
00048 : public Nameable,
00049 public Renamable,
00050 public Commentable,
00051 public Visitable,
00052 public SelfReferencing<Simulate>,
00053 public UserDataContainer
00054 {
00055 friend class FactoryType<Simulate>;
00056
00057 public:
00058
00059
00060
00061 typedef VisitorType<Simulate> Visitor;
00062
00063
00064
00065
00066 class Factory: public FactoryType<Simulate>
00067 {
00068 public:
00069 using FactoryType<Simulate>::create;
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085 SimulateSharedPtr
00086 virtual newSimulatePtr( const std::string & inName,
00087 const std::vector< PortListAliasSharedPtr > & inPortListAliases,
00088 const std::vector< ApplySharedPtr > & inAllApply,
00089 const std::vector< WaveValueSharedPtr > & inWaveValues,
00090 const ViewSharedPtr & inView,
00091 const std::string &inOriginalName = std::string(),
00092 const InterfaceAttributesSharedPtr & inInterfaceAttributes
00093 = InterfaceAttributesSharedPtr() ) throw(Error);
00094 };
00095
00096 virtual void
00097 accept(BaseVisitor & inoutVisitor) throw(Error);
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108 void
00109 addPortListAlias(const PortListAliasSharedPtr & inPortListAlias) throw(Error);
00110
00111
00112
00113
00114
00115
00116
00117
00118 PortListAliasSharedPtr
00119 findPortListAlias(const std::string & inName) throw();
00120
00121
00122
00123
00124
00125
00126 inline void
00127 getPortListAliases(
00128 std::vector< PortListAliasSharedPtr > & outPortListAliases ) const throw();
00129
00130
00131
00132
00133
00134
00135 void
00136 setPortListAliases(
00137 const std::vector< PortListAliasSharedPtr > & inPortListAliases ) throw(Error);
00138
00139
00140
00141
00142
00143
00144 inline void
00145 getAllApply( std::vector< ApplySharedPtr > & outAllApply ) const throw();
00146
00147
00148
00149
00150
00151
00152 void
00153 setAllApply( const std::vector< ApplySharedPtr > & inAllApply ) throw(Error);
00154
00155
00156
00157
00158
00159
00160 void
00161 addApply( const ApplySharedPtr & inSource ) throw(Error);
00162
00163
00164
00165
00166
00167
00168 inline void
00169 getWaveValues( std::vector< WaveValueSharedPtr > & outWaveValues ) const throw();
00170
00171
00172
00173
00174
00175
00176 void
00177 setWaveValues( const std::vector< WaveValueSharedPtr > & inWaveValues ) throw(Error);
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187 void
00188 addWaveValue( const WaveValueSharedPtr & inSource ) throw(Error);
00189
00190
00191
00192
00193
00194
00195
00196
00197 WaveValueSharedPtr
00198 findWaveValue(const std::string & inName) throw();
00199
00200
00201
00202
00203
00204
00205 template<typename _Action>
00206 inline void
00207 applyOnAllPortListAlias( const _Action &action ) throw(Error);
00208
00209
00210
00211
00212
00213
00214 template<typename _Action>
00215 inline void
00216 applyOnAllWaveValues( const _Action &action ) throw(Error);
00217
00218 ~Simulate() throw();
00219
00220 protected:
00221 Simulate();
00222
00223 private:
00224 Simulate(const Simulate & source) throw();
00225
00226 Simulate &
00227 operator=(const Simulate & source) throw();
00228
00229 SymTab< std::string, PortListAliasSharedPtr > mPortListAliasSymTab;
00230 SymTab< std::string, WaveValueSharedPtr > mWaveValueSymTab;
00231 std::vector< ApplySharedPtr > mAllApply;
00232
00233 };
00234
00235
00236
00237
00238
00239
00240 inline void
00241 Simulate::getPortListAliases(
00242 std::vector< PortListAliasSharedPtr > & outPortListAliases ) const throw() {
00243 mPortListAliasSymTab.getValues( outPortListAliases );
00244 }
00245
00246
00247
00248
00249
00250
00251 inline void
00252 Simulate::getAllApply( std::vector< ApplySharedPtr > & outAllApply ) const throw() {
00253 outAllApply.insert( outAllApply.end(),
00254 mAllApply.begin(), mAllApply.end() );
00255 }
00256
00257
00258
00259
00260
00261
00262 inline void
00263 Simulate::getWaveValues( std::vector< WaveValueSharedPtr > & outWaveValues ) const throw() {
00264 mWaveValueSymTab.getValues( outWaveValues );
00265 }
00266
00267
00268
00269
00270
00271
00272 template<typename _Action>
00273 inline void
00274 Simulate::applyOnAllPortListAlias( const _Action &action ) throw(Error) {
00275 try
00276 {
00277 mPortListAliasSymTab.applyOnAll( action );
00278 }
00279 catch(Error &e)
00280 {
00281 e.setCurrentLocation( __FUNCTION__, __FILE__, __LINE__ );
00282 throw;
00283 }
00284 }
00285
00286
00287
00288
00289
00290
00291 template<typename _Action>
00292 inline void
00293 Simulate::applyOnAllWaveValues( const _Action &action ) throw(Error) {
00294 try
00295 {
00296 mWaveValueSymTab.applyOnAll( action );
00297 }
00298 catch(Error &e)
00299 {
00300 e.setCurrentLocation( __FUNCTION__, __FILE__, __LINE__ );
00301 throw;
00302 }
00303 }
00304
00305 }
00306
00307 }
00308 #endif // TORC_GENERIC_OM_SIMULATE_HPP