00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef TORC_GENERIC_OM_INSTANCE_HPP
00017 #define TORC_GENERIC_OM_INSTANCE_HPP
00018
00019 #include "torc/generic/om/PointerTypes.hpp"
00020 #include "torc/generic/om/DumpRestoreConfig.hpp"
00021
00022
00023 #ifdef GENOM_SERIALIZATION
00024 #include <boost/serialization/access.hpp>
00025 #include <boost/serialization/split_member.hpp>
00026 #include <boost/serialization/string.hpp>
00027 #include <boost/serialization/map.hpp>
00028 #endif //GENOM_SERIALIZATION
00029
00030 #include "torc/generic/om/Commentable.hpp"
00031 #include "torc/generic/om/Composite.hpp"
00032 #include "torc/generic/util/Error.hpp"
00033 #include "torc/generic/om/Nameable.hpp"
00034 #include "torc/generic/om/ParameterMap.hpp"
00035 #include "torc/generic/om/ParentedObject.hpp"
00036 #include "torc/generic/om/PropertyContainer.hpp"
00037 #include "torc/generic/om/Renamable.hpp"
00038 #include "torc/generic/om/SymTab.hpp"
00039 #include "torc/generic/om/Visitable.hpp"
00040 #include "torc/generic/om/View.hpp"
00041 #include "torc/generic/om/UserDataContainer.hpp"
00042
00043 namespace torc { namespace generic { class ObjectFactory; } }
00044 namespace torc { namespace generic { class PortReference; } }
00045 namespace torc { namespace generic { class RestoredInstanceUpdater; } }
00046
00047 namespace torc {
00048
00049 namespace generic {
00050
00051
00052
00053
00054
00055
00056 class Instance :
00057 virtual public Composite<Instance>,
00058 public Commentable,
00059 public Nameable,
00060 public PropertyContainer,
00061 public Renamable,
00062 public Visitable,
00063 public ParentedObject<View>,
00064 public UserDataContainer {
00065 #ifdef GENOM_SERIALIZATION
00066 friend class boost::serialization::access;
00067 friend class RestoredInstanceUpdater;
00068 #endif //GENOM_SERIALIZATION
00069
00070 public:
00071 struct MasterData {
00072 std::string mLibrary;
00073 std::string mCell;
00074 std::string mView;
00075 std::map< std::string,ParameterSharedPtr > mParams;
00076
00077 template<class Archive> void
00078 serialize( Archive &ar, unsigned int ) {
00079 ar & mLibrary;
00080 ar & mCell;
00081 ar & mView;
00082 ar & mParams;
00083 }
00084 };
00085
00086
00087
00088
00089
00090
00091 virtual ParameterContext
00092 getParameterContext() const throw();
00093
00094
00095
00096
00097
00098
00099 virtual ParameterMapSharedPtr
00100 getParameters() const throw(Error);
00101
00102
00103
00104
00105
00106
00107 inline ViewSharedPtr
00108 getMaster() const throw();
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121 virtual void
00122 bindToMasterView(
00123 const ViewSharedPtr &inMaster,
00124 bool inMapPortReferences = true ) throw(Error);
00125
00126 protected:
00127 void
00128 setMaster( const ViewSharedPtr &inMaster ) throw();
00129
00130 public:
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160 virtual void
00161 addPortReference(
00162 const PortReferenceSharedPtr &inPortRef) throw(Error);
00163
00164
00165
00166
00167
00168
00169 virtual PortReferenceSharedPtr
00170 findPortReference(const std::string &inPortRef) throw(Error);
00171
00172
00173
00174
00175
00176
00177 virtual NetReferenceSharedPtr
00178 findNetReference(const std::string &inNetRef) throw(Error);
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210 virtual void
00211 removePortReference(const std::string &inName) throw(Error);
00212
00213
00214
00215
00216
00217
00218 virtual void
00219 getPortReferences(std::vector< PortReferenceSharedPtr > &) const throw();
00220
00221
00222
00223
00224
00225
00226 virtual void
00227 setPortReferences(const std::vector< PortReferenceSharedPtr > & inSource) throw(Error);
00228
00229
00230
00231
00232
00233
00234 template<typename _Action>
00235 inline void
00236 applyOnAllPortReferences( const _Action &action ) throw(Error);
00237
00238
00239
00240
00241
00242
00243 inline const std::string
00244 getDesignator() const throw();
00245
00246
00247
00248
00249
00250
00251 void
00252 setDesignator(const std::string & inSource) throw();
00253
00254
00255
00256
00257
00258
00259 inline const TimingSharedPtr
00260 getTiming() const throw();
00261
00262
00263
00264
00265
00266
00267 void
00268 setTiming(const TimingSharedPtr & inSource ) throw();
00269
00270
00271
00272
00273 virtual void
00274 flatten() throw(Error);
00275
00276 Instance();
00277
00278 virtual
00279 ~Instance() throw();
00280
00281 private:
00282 Instance(const Instance & source) throw();
00283 Instance &
00284 operator=(const Instance & source) throw();
00285
00286 private:
00287 #ifdef GENOM_SERIALIZATION
00288 template<class Archive> void
00289 load( Archive &ar, unsigned int );
00290
00291 template<class Archive> void
00292 save( Archive &ar, unsigned int ) const;
00293
00294 BOOST_SERIALIZATION_SPLIT_MEMBER()
00295
00296 void
00297 restoreMaster() throw(Error);
00298
00299 mutable MasterData *mMasterData;
00300 #endif //GENOM_SERIALIZATION
00301
00302 ViewSharedPtr mMaster;
00303 SymTab< std::string,
00304 PortReferenceSharedPtr > mPortReferences;
00305 mutable ParameterContext mMyContext;
00306 std::string mDesignator;
00307 TimingSharedPtr mTiming;
00308 SymTab< std::string,
00309 NetReferenceSharedPtr > mNetReferences;
00310 };
00311
00312
00313
00314
00315
00316
00317 inline ViewSharedPtr
00318 Instance::getMaster() const throw() {
00319 return mMaster;
00320 }
00321
00322
00323
00324
00325
00326
00327 template<typename _Action>
00328 inline void
00329 Instance::applyOnAllPortReferences( const _Action &action ) throw(Error)
00330 {
00331 try
00332 {
00333 mPortReferences.applyOnAll( action );
00334 }
00335 catch(Error &e)
00336 {
00337 e.setCurrentLocation( __FUNCTION__, __FILE__, __LINE__ );
00338 throw;
00339 }
00340 }
00341
00342 inline const std::string
00343 Instance::getDesignator() const throw() {
00344 return mDesignator;
00345 }
00346
00347
00348
00349
00350
00351
00352 inline const TimingSharedPtr
00353 Instance::getTiming() const throw() {
00354 return mTiming;
00355 }
00356
00357
00358 }
00359
00360 }
00361 #endif // TORC_GENERIC_OM_INSTANCE_HPP