00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "torc/generic/om/Event.hpp"
00017 #include "torc/generic/om/Port.hpp"
00018 #include "torc/generic/om/PortList.hpp"
00019
00020 namespace torc {
00021
00022 namespace generic {
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 EventSharedPtr
00040 Event::Factory::newEventPtr( const Event::Type & inEventType,
00041 const std::list< PortSharedPtr > & inPorts,
00042 const std::list < PortReferenceSharedPtr > & inPortReferences,
00043 const std::list< NetSharedPtr > & inNets,
00044 const LogicElementSharedPtr & inTransition,
00045 const PortListSharedPtr & inPortList,
00046 const Value & inOffsetTime ) throw(Error) {
00047 try
00048 {
00049 EventSharedPtr newEvent;
00050 create( newEvent );
00051 newEvent->setType( inEventType );
00052 std::list< PortSharedPtr >::const_iterator portIt = inPorts.begin();
00053 for( ; portIt != inPorts.end(); portIt++ )
00054 {
00055 newEvent->addPort( *portIt );
00056 }
00057
00058 std::list< PortReferenceSharedPtr >::const_iterator portRefIt
00059 = inPortReferences.begin();
00060 for( ; portRefIt != inPortReferences.end(); portRefIt++ )
00061 {
00062 newEvent->addPortReference( *portRefIt );
00063 }
00064
00065 std::list< NetSharedPtr >::const_iterator netIt = inNets.begin();
00066 for( ; netIt != inNets.end(); netIt++ )
00067 {
00068 newEvent->addNet( *netIt );
00069 }
00070 if( inTransition )
00071 {
00072 newEvent->setTransition( inTransition );
00073 }
00074 if( inPortList )
00075 {
00076 newEvent->setPortList( inPortList );
00077 }
00078 if( Event::eTypeOffsetEvent == inEventType )
00079 {
00080 if( inOffsetTime.getIsSet() )
00081 {
00082 newEvent->setOffsetTime( inOffsetTime );
00083 }
00084 }
00085 return newEvent;
00086 }
00087 catch( Error &e )
00088 {
00089 e.setCurrentLocation(
00090 __FUNCTION__, __FILE__, __LINE__ );
00091 throw;
00092 }
00093 }
00094
00095 void
00096 Event::accept(BaseVisitor & inoutVisitor) throw(Error) {
00097 try
00098 {
00099 runVisitor( *this, inoutVisitor );
00100 }
00101 catch( Error &e )
00102 {
00103 e.setCurrentLocation(
00104 __FUNCTION__, __FILE__, __LINE__ );
00105 throw;
00106 }
00107 }
00108
00109
00110
00111
00112
00113
00114 void
00115 Event::setType( const Type & inSource ) throw() {
00116 mType = inSource;
00117 }
00118
00119
00120
00121
00122
00123
00124 void
00125 Event::addPort( const PortSharedPtr &inPort ) throw() {
00126 mPortElements.push_back( PortElement( inPort ) );
00127 }
00128
00129
00130
00131
00132
00133
00134 void
00135 Event::addPortReference(
00136 const PortReferenceSharedPtr &inPortRef ) throw() {
00137 mPortElements.push_back( PortElement( inPortRef ) );
00138 }
00139
00140
00141
00142
00143
00144
00145
00146 void
00147 Event::setPortList(const PortListSharedPtr & inPortList) throw() {
00148 mPortList = inPortList;
00149 }
00150
00151
00152
00153
00154
00155
00156 void
00157 Event::addNet( const NetSharedPtr &inNet ) throw() {
00158 mNets.push_back( inNet );
00159 }
00160
00161
00162
00163
00164
00165
00166 void
00167 Event::setTransition(const LogicElementSharedPtr & inSource) throw() {
00168 mTransition = inSource;
00169 }
00170
00171
00172
00173
00174
00175 void
00176 Event::setOffsetTime(const Value & value) throw() {
00177 mOffsetTime = value;
00178 }
00179
00180 Event::Event()
00181 : Visitable(),
00182 SelfReferencing<Event>(),
00183 mType(),
00184 mPortElements(),
00185 mPortList(),
00186 mNets(),
00187 mTransition(),
00188 mOffsetTime() {
00189 }
00190
00191 Event::~Event() throw() {
00192 }
00193
00194 }
00195
00196 }