00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef TORC_GENERIC_OM_LIBRARY_HPP
00017 #define TORC_GENERIC_OM_LIBRARY_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 #endif //GENOM_SERIALIZATION
00027
00028 #include "torc/generic/om/Commentable.hpp"
00029 #include "torc/generic/om/Extern.hpp"
00030 #include "torc/generic/om/EdifLevel.hpp"
00031 #include "torc/generic/util/Error.hpp"
00032 #include "torc/generic/om/FactoryType.hpp"
00033 #include "torc/generic/om/Nameable.hpp"
00034 #include "torc/generic/om/ParentedObject.hpp"
00035 #include "torc/generic/om/Renamable.hpp"
00036 #include "torc/generic/om/Root.hpp"
00037 #include "torc/generic/om/ScaleFactor.hpp"
00038 #include "torc/generic/om/SelfReferencing.hpp"
00039 #include "torc/generic/om/SymTab.hpp"
00040 #include "torc/generic/om/Visitable.hpp"
00041 #include "torc/generic/om/VisitorType.hpp"
00042 #include "torc/generic/om/Unit.hpp"
00043 #include "torc/generic/om/UserDataContainer.hpp"
00044 #include "torc/generic/om/StatusContainer.hpp"
00045
00046 namespace torc { namespace generic { class BaseVisitor; } }
00047 namespace torc { namespace generic { class Cell; } }
00048
00049 namespace torc {
00050
00051 namespace generic {
00052
00053
00054
00055
00056
00057
00058 class Library :
00059 public Commentable,
00060 public Extern,
00061 public Nameable,
00062 public Renamable,
00063 public Visitable,
00064 public ParentedObject<Root>,
00065 public SelfReferencing<Library>,
00066 public UserDataContainer,
00067 public StatusContainer {
00068
00069 #ifdef GENOM_SERIALIZATION
00070 friend class boost::serialization::access;
00071 #endif //GENOM_SERIALIZATION
00072
00073 friend class FactoryType<Library>;
00074
00075 public:
00076
00077
00078
00079 typedef VisitorType<Library> Visitor;
00080
00081
00082
00083
00084
00085 class Factory: public FactoryType<Library>
00086 {
00087 public:
00088 using FactoryType<Library>::create;
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099 virtual LibrarySharedPtr
00100 newLibraryPtr( const std::string &inName,
00101 const RootSharedPtr &inRootPtr,
00102 const EdifLevel &inEdifLevel = eEdifLevel0,
00103 const std::string &inOriginalName = std::string()) throw(Error);
00104 };
00105
00106 virtual void
00107 accept(BaseVisitor & inoutVisitor) throw(Error);
00108
00109
00110
00111
00112
00113
00114 inline const EdifLevel
00115 getLevel() const throw();
00116
00117
00118
00119
00120
00121
00122
00123
00124 void
00125 setLevel(const EdifLevel & inSource) throw();
00126
00127
00128
00129
00130
00131
00132 inline const std::map<Unit,ScaleFactor>
00133 getScaleFactors() const throw();
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143 bool
00144 findScaleFactor(
00145 Unit inUnit, ScaleFactor &outResult ) const throw();
00146
00147
00148
00149
00150
00151
00152
00153
00154 bool
00155 setScaleFactor(
00156 Unit inUnit, const ScaleFactor &inScale) throw();
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189 void
00190 addCell(const CellSharedPtr &inCell) throw(Error);
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212 virtual CellSharedPtr
00213 findCell(const std::string &inName) throw(Error);
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245 void
00246 removeCell(const std::string &inName) throw(Error);
00247
00248
00249
00250
00251
00252
00253
00254 virtual void
00255 getCells(
00256 std::vector< CellSharedPtr > &outCells) throw();
00257
00258
00259
00260
00261
00262
00263 template<typename _Action>
00264 inline void
00265 applyOnAllCells( const _Action &action ) throw(Error);
00266
00267
00268
00269
00270
00271
00272 inline const SimulationInfoSharedPtr
00273 getSimulationInfo() const throw();
00274
00275
00276
00277
00278
00279
00280 void
00281 setSimulationInfo(const SimulationInfoSharedPtr & inSource ) throw();
00282
00283 virtual
00284 ~Library() throw();
00285
00286 protected:
00287 Library();
00288
00289 private:
00290 Library( const Library &);
00291
00292 Library &
00293 operator =(const Library &);
00294
00295 private:
00296 #ifdef GENOM_SERIALIZATION
00297 template<class Archive> void
00298 load( Archive &ar, unsigned int );
00299
00300 template<class Archive> void
00301 save( Archive &ar, unsigned int ) const;
00302
00303 CellSharedPtr
00304 restoreSingleCell( const std::string &inName ) throw(Error);
00305
00306 void
00307 restoreAllCells() throw(Error);
00308
00309 BOOST_SERIALIZATION_SPLIT_MEMBER()
00310
00311 #endif //GENOM_SERIALIZATION
00312
00313 SymTab<Unit,ScaleFactor> mScaleFactors;
00314 EdifLevel mLevel;
00315 SymTab< std::string,CellSharedPtr > mCellSymTab;
00316 SimulationInfoSharedPtr mSimulationInfo;
00317 #ifdef GENOM_SERIALIZATION
00318 mutable std::list< std::string > mDumpedCells;
00319 #endif //GENOM_SERIALIZATION
00320 };
00321
00322
00323
00324
00325
00326
00327
00328 inline const EdifLevel
00329 Library::getLevel() const throw() {
00330 return mLevel;
00331 }
00332
00333
00334
00335
00336
00337
00338 inline const std::map<Unit,ScaleFactor>
00339 Library::getScaleFactors() const throw() {
00340 std::map<Unit,ScaleFactor> temp;
00341 mScaleFactors.getValueMap( temp );
00342 return temp;
00343 }
00344
00345
00346
00347
00348
00349
00350 template<typename _Action>
00351 inline void
00352 Library::applyOnAllCells( const _Action &action ) throw(Error) {
00353 try
00354 {
00355 #ifdef GENOM_SERIALIZATION
00356 restoreAllCells();
00357 #endif //GENOM_SERIALIZATION
00358 mCellSymTab.applyOnAll( action );
00359 }
00360 catch(Error &e)
00361 {
00362 e.setCurrentLocation( __FUNCTION__, __FILE__, __LINE__ );
00363 throw;
00364 }
00365 }
00366
00367
00368
00369
00370
00371
00372 inline const SimulationInfoSharedPtr
00373 Library::getSimulationInfo() const throw() {
00374 return mSimulationInfo;
00375 }
00376
00377 #ifdef GENOM_SERIALIZATION
00378 void
00379 dump( const LibrarySharedPtr &inLibrary ) throw(Error);
00380
00381 void
00382 dump( const LibrarySharedPtr &inLibrary,
00383 const DumpRestoreData &inData ) throw(Error);
00384
00385 LibrarySharedPtr
00386 restore( const std::string &inName,
00387 const RootSharedPtr &inParent) throw(Error);
00388
00389 LibrarySharedPtr
00390 restore( const std::string &inName,
00391 const RootSharedPtr &inParent,
00392 const DumpRestoreData &inData ) throw(Error);
00393 #endif //GENOM_SERIALIZATION
00394
00395 }
00396
00397 }
00398 #endif // TORC_GENERIC_OM_LIBRARY_HPP