00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef TORC_GENERIC_OM_VIEW_HPP
00017 #define TORC_GENERIC_OM_VIEW_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/util/Error.hpp"
00030 #include "torc/generic/om/Extern.hpp"
00031 #include "torc/generic/om/FactoryType.hpp"
00032 #include "torc/generic/om/Nameable.hpp"
00033 #include "torc/generic/om/ParameterMap.hpp"
00034 #include "torc/generic/om/ParentedObject.hpp"
00035 #include "torc/generic/om/PropertyContainer.hpp"
00036 #include "torc/generic/om/Renamable.hpp"
00037 #include "torc/generic/om/SelfReferencing.hpp"
00038 #include "torc/generic/om/SymTab.hpp"
00039 #include "torc/generic/om/Visitable.hpp"
00040 #include "torc/generic/om/VisitorType.hpp"
00041 #include "torc/generic/om/UserDataContainer.hpp"
00042 #include "torc/generic/om/StatusContainer.hpp"
00043
00044 namespace torc { namespace generic { class BaseVisitor; } }
00045 namespace torc { namespace generic { class Cell; } }
00046 namespace torc { namespace generic { class Instance; } }
00047 namespace torc { namespace generic { class Net; } }
00048 namespace torc { namespace generic { class Port; } }
00049 namespace torc { namespace generic { class Permutable; } }
00050 namespace torc { namespace generic { class InterfaceAttributes; } }
00051 namespace torc { namespace generic { class InterfaceJoinedInfo; } }
00052
00053 namespace torc {
00054
00055 namespace generic {
00056
00057
00058
00059
00060
00061
00062
00063
00064 class View :
00065 public Commentable,
00066 public Extern,
00067 public Nameable,
00068 public ParentedObject<Cell>,
00069 public PropertyContainer,
00070 public Renamable,
00071 public SelfReferencing<View>,
00072 public Visitable,
00073 public UserDataContainer,
00074 public StatusContainer {
00075
00076 #ifdef GENOM_SERIALIZATION
00077 friend class boost::serialization::access;
00078 friend class RestoredViewUpdater;
00079 #endif //GENOM_SERIALIZATION
00080
00081 friend class FactoryType<View>;
00082
00083 public:
00084
00085
00086
00087
00088 enum Type
00089 {
00090 eTypeMaskLayout = 0,
00091 eTypePCBLayout,
00092 eTypeNetlist,
00093 eTypeSchematic,
00094 eTypeSymbolic,
00095 eTypeBehavior,
00096 eTypeLogicModel,
00097 eTypeDocument,
00098 eTypeGraphic,
00099 eTypeStranger
00100 };
00101
00102
00103
00104
00105 typedef VisitorType<View> Visitor;
00106
00107
00108
00109
00110 class Factory: public FactoryType<View>
00111 {
00112 public:
00113 using FactoryType<View>::create;
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124 virtual ViewSharedPtr
00125 newViewPtr( const std::string &inName,
00126 const CellSharedPtr &inCellPtr,
00127 const View::Type &inViewType = View::eTypeNetlist,
00128 const std::string &inOriginalName = std::string()) throw(Error);
00129 };
00130
00131 virtual void
00132 accept(BaseVisitor & inoutVisitor) throw(Error);
00133
00134
00135
00136
00137
00138
00139 inline ParameterContext
00140 getParameterContext() const throw();
00141
00142
00143
00144
00145
00146
00147 ParameterMapSharedPtr
00148 getParameters() throw(Error);
00149
00150 void
00151 setParameters(
00152 const ParameterMapSharedPtr &inSource) throw();
00153
00154
00155
00156
00157
00158
00159 inline const Type
00160 getType() const throw();
00161
00162
00163
00164
00165
00166
00167 void
00168 setType(const Type & inSource) throw();
00169
00170
00171
00172
00173
00174
00175 inline void
00176 getInstances(
00177 std::vector< InstanceSharedPtr > &outInstances
00178 ) const throw();
00179
00180
00181
00182
00183
00184
00185 void
00186 setInstances(
00187 const std::vector< InstanceSharedPtr > &inSource) throw(Error);
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231 void
00232 addInstance(const InstanceSharedPtr &inInstance) throw(Error);
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254 InstanceSharedPtr
00255 findInstance(const std::string &inName) throw();
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287 void
00288 removeInstance( const std::string &inName) throw(Error);
00289
00290
00291
00292
00293
00294
00295 template<typename _Action>
00296 inline void
00297 applyOnAllInstances( const _Action &action ) throw(Error);
00298
00299
00300
00301
00302
00303
00304 inline void
00305 getNets(
00306 std::vector< NetSharedPtr > &outNets
00307 ) const throw();
00308
00309
00310
00311
00312
00313
00314 void
00315 setNets(const std::vector< NetSharedPtr > & inSource) throw(Error);
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347 void
00348 addNet(const NetSharedPtr & inNet) throw(Error);
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370 NetSharedPtr
00371 findNet(const std::string &inName) throw();
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403 void
00404 removeNet(const std::string &inName) throw(Error);
00405
00406
00407
00408
00409
00410
00411 template<typename _Action>
00412 inline void
00413 applyOnAllNets( const _Action &action ) throw(Error);
00414
00415
00416
00417
00418
00419
00420 inline void
00421 getPorts(
00422 std::vector< PortSharedPtr > &outPorts
00423 ) const throw();
00424
00425
00426
00427
00428
00429
00430 void
00431 setPorts(const std::vector< PortSharedPtr > & inSource) throw(Error);
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464 void
00465 addPort(const PortSharedPtr & inPort) throw(Error);
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488 PortSharedPtr
00489 findPort(const std::string &inName) throw();
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521 void
00522 removePort(const std::string &inName) throw(Error);
00523
00524
00525
00526
00527
00528
00529 template<typename _Action>
00530 inline void
00531 applyOnAllPorts( const _Action &action ) throw(Error);
00532
00533
00534
00535
00536
00537
00538 inline void
00539 getPermutables(
00540 std::vector< PermutableSharedPtr > & outPermutables
00541 ) const throw();
00542
00543
00544
00545
00546
00547
00548
00549 void
00550 setPermutables( const std::vector< PermutableSharedPtr >
00551 & inSource ) throw(Error);
00552
00553
00554
00555
00556
00557
00558 bool
00559 addPermutable(
00560 const PermutableSharedPtr & inPermutable) throw(Error);
00561
00562
00563
00564
00565
00566
00567 template<typename _Action>
00568 inline void
00569 applyOnAllPermutables( const _Action &action ) throw(Error);
00570
00571
00572
00573
00574
00575
00576 inline void
00577 getInterfaceJoinedInfos(
00578 std::vector< InterfaceJoinedInfoSharedPtr > & outJoinedInfos
00579 ) const throw();
00580
00581
00582
00583
00584
00585
00586
00587 void
00588 setInterfaceJoinedInfos( const std::vector< InterfaceJoinedInfoSharedPtr >
00589 & inSource ) throw(Error);
00590
00591
00592
00593
00594
00595
00596 bool
00597 addInterfaceJoinedInfo(
00598 const InterfaceJoinedInfoSharedPtr & inJoinedInfo ) throw(Error);
00599
00600
00601
00602
00603
00604
00605 template<typename _Action>
00606 inline void
00607 applyOnAllInterfaceJoinedInfos( const _Action &action ) throw(Error);
00608
00609
00610
00611
00612
00613
00614
00615
00616 inline const InterfaceAttributesSharedPtr
00617 getInterfaceAttributes() const throw();
00618
00619
00620
00621
00622
00623
00624
00625
00626 void
00627 setInterfaceAttributes(const InterfaceAttributesSharedPtr & inSource) throw();
00628
00629 inline const std::string &
00630 getNonNetlistViewData() const throw();
00631
00632 void
00633 setNonNetlistViewData( const std::string &inData) throw();
00634
00635
00636
00637
00638
00639
00640 inline const SimulateSharedPtr
00641 getSimulate() const throw();
00642
00643
00644
00645
00646
00647
00648 void
00649 setSimulate(const SimulateSharedPtr & inSource ) throw();
00650
00651
00652
00653
00654
00655
00656 inline const TimingSharedPtr
00657 getTiming() const throw();
00658
00659
00660
00661
00662
00663
00664 void
00665 setTiming(const TimingSharedPtr & inSource ) throw();
00666
00667 virtual
00668 ~View() throw();
00669
00670 protected:
00671 View();
00672
00673 private:
00674 #ifdef GENOM_SERIALIZATION
00675 template<class Archive> void
00676 load( Archive &ar, unsigned int );
00677
00678 template<class Archive> void
00679 save( Archive &ar, unsigned int ) const;
00680
00681 BOOST_SERIALIZATION_SPLIT_MEMBER()
00682
00683 void
00684 restoreActions() throw(Error);
00685 #endif //GENOM_SERIALIZATION
00686
00687 ParameterMapSharedPtr mParameters;
00688 ParameterContext mMyContext;
00689 SymTab< std::string, InstanceSharedPtr > mInstanceSymTab;
00690 SymTab< std::string, NetSharedPtr > mNetSymTab;
00691 SymTab< std::string, PortSharedPtr > mPortSymTab;
00692 std::string mNonNetlistViewData;
00693 Type mType;
00694 std::vector< PermutableSharedPtr > mPermutables;
00695 std::vector< InterfaceJoinedInfoSharedPtr > mInterfaceJoinedInfos;
00696 InterfaceAttributesSharedPtr mAttributes;
00697 SimulateSharedPtr mSimulate;
00698 TimingSharedPtr mTiming;
00699 };
00700
00701 inline ParameterContext
00702 View::getParameterContext() const throw() {
00703 return mMyContext;
00704 }
00705
00706
00707
00708
00709
00710
00711 inline const View::Type
00712 View::getType() const throw() {
00713 return mType;
00714 }
00715
00716 inline void
00717 View::getInstances(
00718 std::vector< InstanceSharedPtr > &outInstances
00719 ) const throw() {
00720 return mInstanceSymTab.getValues( outInstances );
00721 }
00722
00723
00724 template<typename _Action>
00725 inline void
00726 View::applyOnAllInstances( const _Action &action ) throw(Error)
00727 {
00728 try
00729 {
00730 mInstanceSymTab.applyOnAll( action );
00731 }
00732 catch(Error &e)
00733 {
00734 e.setCurrentLocation( __FUNCTION__, __FILE__, __LINE__ );
00735 throw;
00736 }
00737 }
00738
00739 inline void
00740 View::getNets(
00741 std::vector< NetSharedPtr > &outNets
00742 ) const throw() {
00743 return mNetSymTab.getValues( outNets );
00744 }
00745
00746 template<typename _Action>
00747 inline void
00748 View::applyOnAllNets( const _Action &action ) throw(Error)
00749 {
00750 try
00751 {
00752 mNetSymTab.applyOnAll( action );
00753 }
00754 catch(Error &e)
00755 {
00756 e.setCurrentLocation( __FUNCTION__, __FILE__, __LINE__ );
00757 throw;
00758 }
00759 }
00760
00761 inline void
00762 View::getPorts(
00763 std::vector< PortSharedPtr > &outPorts
00764 ) const throw() {
00765 return mPortSymTab.getValues( outPorts );
00766 }
00767
00768 template<typename _Action>
00769 inline void
00770 View::applyOnAllPorts( const _Action &action ) throw(Error)
00771 {
00772 try
00773 {
00774 mPortSymTab.applyOnAll( action );
00775 }
00776 catch(Error &e)
00777 {
00778 e.setCurrentLocation( __FUNCTION__, __FILE__, __LINE__ );
00779 throw;
00780 }
00781 }
00782
00783 inline const std::string &
00784 View::getNonNetlistViewData() const throw() {
00785 return mNonNetlistViewData;
00786 }
00787
00788
00789
00790
00791
00792
00793
00794 inline void
00795 View::getPermutables(
00796 std::vector< PermutableSharedPtr > & outPermutables ) const throw() {
00797 outPermutables.insert( outPermutables.end(),
00798 mPermutables.begin(), mPermutables.end() );
00799 }
00800
00801
00802
00803
00804
00805
00806 template<typename _Action>
00807 inline void
00808 View::applyOnAllPermutables( const _Action &action ) throw(Error) {
00809 try
00810 {
00811 std::vector< PermutableSharedPtr >::iterator it = mPermutables.begin();
00812 for(; it != mPermutables.end(); ++ it )
00813 {
00814 action( *it );
00815 }
00816 }
00817 catch(Error &e)
00818 {
00819 e.setCurrentLocation( __FUNCTION__, __FILE__, __LINE__ );
00820 throw;
00821 }
00822 }
00823
00824
00825
00826
00827
00828
00829 inline void
00830 View::getInterfaceJoinedInfos(
00831 std::vector< InterfaceJoinedInfoSharedPtr > & outJoinedInfos
00832 ) const throw() {
00833 outJoinedInfos.insert( outJoinedInfos.end(),
00834 mInterfaceJoinedInfos.begin(), mInterfaceJoinedInfos.end() );
00835 }
00836
00837
00838
00839
00840
00841
00842
00843 template<typename _Action>
00844 inline void
00845 View::applyOnAllInterfaceJoinedInfos( const _Action &action ) throw(Error) {
00846 try
00847 {
00848 std::vector< InterfaceJoinedInfoSharedPtr >::iterator it
00849 = mInterfaceJoinedInfos.begin();
00850 for(; it != mInterfaceJoinedInfos.end(); ++ it )
00851 {
00852 action( *it );
00853 }
00854 }
00855 catch(Error &e)
00856 {
00857 e.setCurrentLocation( __FUNCTION__, __FILE__, __LINE__ );
00858 throw;
00859 }
00860 }
00861
00862
00863
00864
00865
00866
00867 inline const InterfaceAttributesSharedPtr
00868 View::getInterfaceAttributes() const throw() {
00869 return mAttributes;
00870 }
00871
00872
00873
00874
00875
00876
00877 inline const SimulateSharedPtr
00878 View::getSimulate() const throw() {
00879 return mSimulate;
00880 }
00881
00882
00883
00884
00885
00886
00887 inline const TimingSharedPtr
00888 View::getTiming() const throw() {
00889 return mTiming;
00890 }
00891
00892
00893 }
00894
00895 }
00896 #endif // TORC_GENERIC_OM_VIEW_HPP