00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "torc/generic/om/Timing.hpp"
00017 #include "torc/generic/om/PathDelay.hpp"
00018 #include "torc/generic/om/ForbiddenEvent.hpp"
00019 #include "torc/generic/om/InterfaceAttributes.hpp"
00020 #include "torc/generic/om/View.hpp"
00021 #include "torc/generic/om/Instance.hpp"
00022
00023 namespace torc {
00024
00025 namespace generic {
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 TimingSharedPtr
00043 Timing::Factory::newTimingPtr( const Derivation & inDerivation,
00044 const std::list< PathDelaySharedPtr > & inPathDelays,
00045 const std::list< ForbiddenEventSharedPtr > & inForbiddentEvents,
00046 const ViewSharedPtr & inView,
00047 const InterfaceAttributesSharedPtr & inInterfaceAttributes,
00048 const InstanceSharedPtr & inInstance ) throw(Error) {
00049 try
00050 {
00051 TimingSharedPtr newTiming;
00052 create( newTiming );
00053 newTiming->setDerivation( inDerivation );
00054 newTiming->setPathDelays( inPathDelays );
00055 newTiming->setForbiddentEvents( inForbiddentEvents );
00056 if( inInstance )
00057 {
00058 inInstance->setTiming( newTiming );
00059 }
00060 else if( inInterfaceAttributes )
00061 {
00062 inInterfaceAttributes->setTiming( newTiming );
00063 inView->setInterfaceAttributes( inInterfaceAttributes );
00064 }
00065 else
00066 {
00067 inView->setTiming( newTiming );
00068 }
00069 return newTiming;
00070 }
00071 catch( Error &e )
00072 {
00073 e.setCurrentLocation(
00074 __FUNCTION__, __FILE__, __LINE__ );
00075 throw;
00076 }
00077 }
00078
00079 void
00080 Timing::accept(BaseVisitor & inoutVisitor) throw(Error) {
00081 try
00082 {
00083 runVisitor( *this, inoutVisitor );
00084 }
00085 catch( Error &e )
00086 {
00087 e.setCurrentLocation(
00088 __FUNCTION__, __FILE__, __LINE__ );
00089 throw;
00090 }
00091 }
00092
00093
00094
00095
00096
00097
00098 void
00099 Timing::setDerivation(const Derivation & value) throw() {
00100 mDerivation = value;
00101 }
00102
00103
00104
00105
00106
00107
00108 void
00109 Timing::setPathDelays(
00110 const std::list< PathDelaySharedPtr > & inPathDelays ) throw() {
00111 std::list< PathDelaySharedPtr >::const_iterator it = inPathDelays.begin();
00112 for( ; it != inPathDelays.end(); it++ )
00113 {
00114 try
00115 {
00116 addPathDelay( *it );
00117 }
00118 catch( Error &e )
00119 {
00120 e.setCurrentLocation(
00121 __FUNCTION__, __FILE__, __LINE__ );
00122 throw;
00123 }
00124 }
00125 }
00126
00127
00128
00129
00130
00131
00132 void
00133 Timing::setForbiddentEvents(
00134 const std::list< ForbiddenEventSharedPtr > & inForbiddentEvents ) throw() {
00135 std::list< ForbiddenEventSharedPtr >::const_iterator it = inForbiddentEvents.begin();
00136 for( ; it != inForbiddentEvents.end(); it++ )
00137 {
00138 try
00139 {
00140 addForbiddenEvent( *it );
00141 }
00142 catch( Error &e )
00143 {
00144 e.setCurrentLocation(
00145 __FUNCTION__, __FILE__, __LINE__ );
00146 throw;
00147 }
00148 }
00149 }
00150
00151
00152
00153
00154
00155
00156 void
00157 Timing::addPathDelay(const PathDelaySharedPtr & inSource) throw() {
00158 try
00159 {
00160 mPathDelays.push_back( inSource );
00161 }
00162 catch( Error &e )
00163 {
00164 e.setCurrentLocation(
00165 __FUNCTION__, __FILE__, __LINE__ );
00166 throw;
00167 }
00168 }
00169
00170
00171
00172
00173
00174
00175 void
00176 Timing::addForbiddenEvent(const ForbiddenEventSharedPtr & inSource) throw(){
00177 try
00178 {
00179 mForbiddentEvents.push_back( inSource );
00180 }
00181 catch( Error &e )
00182 {
00183 e.setCurrentLocation(
00184 __FUNCTION__, __FILE__, __LINE__ );
00185 throw;
00186 }
00187 }
00188
00189 Timing::Timing()
00190 : Visitable(),
00191 SelfReferencing<Timing>(),
00192 Commentable(),
00193 UserDataContainer(),
00194 mDerivation(),
00195 mPathDelays(),
00196 mForbiddentEvents() {
00197 }
00198
00199 Timing::~Timing() throw() {
00200 }
00201
00202 }
00203
00204 }