SST  12.0.0
StructuralSimulationToolkit
SST::Link Class Reference

Link between two components. More...

#include <link.h>

Inheritance diagram for SST::Link:
SST::SelfLink

Public Member Functions

void addSendLatency (int cycles, const std::string &timebase)
 Set additional Latency to be added to events being sent out of this link. More...
 
void addSendLatency (SimTime_t cycles, TimeConverter *timebase)
 Set additional Latency to be added to events being sent out of this link. More...
 
void addRecvLatency (int cycles, const std::string &timebase)
 Set additional Latency to be added on to events coming in on this link. More...
 
void addRecvLatency (SimTime_t cycles, TimeConverter *timebase)
 Set additional Latency to be added on to events coming in on this link. More...
 
void setFunctor (Event::HandlerBase *functor)
 Set the callback function to be called when a message is delivered. More...
 
void replaceFunctor (Event::HandlerBase *functor)
 Replace the callback function to be called when a message is delivered. More...
 
void send (SimTime_t delay, TimeConverter *tc, Event *event)
 Send an event over the link with additional delay. More...
 
void send (SimTime_t delay, Event *event)
 Send an event with additional delay. More...
 
void send (Event *event)
 Send an event with the Link's default delay. More...
 
Eventrecv ()
 Retrieve a pending event from the Link. More...
 
void setDefaultTimeBase (TimeConverter *tc)
 Manually set the default detaulTimeBase. More...
 
TimeConvertergetDefaultTimeBase ()
 Return the default Time Base for this link. More...
 
const TimeConvertergetDefaultTimeBase () const
 Return the default Time Base for this link. More...
 
LinkId_t getId ()
 Return the ID of this link. More...
 
void sendUntimedData (Event *data)
 Send data during the init() or complete() phase. More...
 
EventrecvUntimedData ()
 Receive an event (if any) during the init() or complete() phase. More...
 
void sendInitData (Event *init_data)
 Send data during the init() or complete() phase. More...
 
EventrecvInitData ()
 Receive an event (if any) during the init() or complete() phase. More...
 
bool isConfigured ()
 Return whether link has been configured. More...
 

Protected Member Functions

void setAsSyncLink ()
 
void setDeliveryInfo (uintptr_t info)
 Set the delivery_info for the link.
 
void send_impl (SimTime_t delay, Event *event)
 Send an event over the link with additional delay. More...
 

Protected Attributes

ActivityQueuesend_queue
 Queue of events to be received by the owning component.
 
uintptr_t delivery_info
 Holds the delivery information. More...
 
SimTime_t defaultTimeBase
 Timebase used if no other timebase is specified. More...
 
SimTime_t latency
 Latency of the link. More...
 
Linkpair_link
 Pointer to the opposite side of this link.
 

Friends

class LinkPair
 
class RankSync
 
class ThreadSync
 
class Simulation_impl
 
class SyncManager
 
class ComponentInfo
 
class BaseComponent
 

Detailed Description

Link between two components.

Carries events

Member Function Documentation

void SST::Link::addRecvLatency ( int  cycles,
const std::string &  timebase 
)

Set additional Latency to be added on to events coming in on this link.

Parameters
cyclesNumber of Cycles to be added
timebaseBase Units of cycles

References SST::TimeLord::getSimCycles(), SST::Simulation_impl::getSimulation(), SST::Simulation_impl::getTimeLord(), latency, and pair_link.

void SST::Link::addRecvLatency ( SimTime_t  cycles,
TimeConverter timebase 
)

Set additional Latency to be added on to events coming in on this link.

Parameters
cyclesNumber of Cycles to be added
timebaseBase Units of cycles

References SST::TimeConverter::convertToCoreTime(), latency, and pair_link.

void SST::Link::addSendLatency ( int  cycles,
const std::string &  timebase 
)

Set additional Latency to be added to events being sent out of this link.

Parameters
cyclesNumber of Cycles to be added
timebaseBase Units of cycles

References SST::TimeLord::getSimCycles(), SST::Simulation_impl::getSimulation(), SST::Simulation_impl::getTimeLord(), and latency.

void SST::Link::addSendLatency ( SimTime_t  cycles,
TimeConverter timebase 
)

Set additional Latency to be added to events being sent out of this link.

Parameters
cyclesNumber of Cycles to be added
timebaseBase Units of cycles

References SST::TimeConverter::convertToCoreTime(), and latency.

TimeConverter * SST::Link::getDefaultTimeBase ( )

Return the default Time Base for this link.

Returns
the default Time Base for this link

References defaultTimeBase, SST::Simulation_impl::getSimulation(), SST::TimeLord::getTimeConverter(), and SST::Simulation_impl::getTimeLord().

const TimeConverter * SST::Link::getDefaultTimeBase ( ) const

Return the default Time Base for this link.

Returns
the default Time Base for this link

References defaultTimeBase, SST::Simulation_impl::getSimulation(), SST::TimeLord::getTimeConverter(), and SST::Simulation_impl::getTimeLord().

LinkId_t SST::Link::getId ( )
inline

Return the ID of this link.

Returns
the unique ID for this link
bool SST::Link::isConfigured ( )
inline

Return whether link has been configured.

Returns
whether link is configured
Event * SST::Link::recv ( )

Retrieve a pending event from the Link.

For links which do not have a set event handler, they can be polled with this function. Returns nullptr if there is no pending event. Not available for HANDLER-type links.

Returns
Event if one is available
nullptr if no Event is available

References SST::ActivityQueue::empty(), SST::Output::fatal(), SST::ActivityQueue::front(), SST::Simulation::getCurrentSimCycle(), SST::Activity::getDeliveryTime(), SST::Simulation_impl::getSimulation(), SST::Simulation_impl::getSimulationOutput(), pair_link, SST::ActivityQueue::pop(), and send_queue.

Event* SST::Link::recvInitData ( )
inline

Receive an event (if any) during the init() or complete() phase.

Same as recvUntimedData()

Returns
Event if one is available
nullptr if no Event is available

References recvUntimedData().

Event * SST::Link::recvUntimedData ( )

Receive an event (if any) during the init() or complete() phase.

Returns
Event if one is available
nullptr if no Event is available

References SST::ActivityQueue::empty(), SST::ActivityQueue::front(), SST::Activity::getDeliveryTime(), SST::Simulation_impl::getSimulation(), pair_link, SST::ActivityQueue::pop(), and send_queue.

Referenced by recvInitData().

void SST::Link::replaceFunctor ( Event::HandlerBase functor)

Replace the callback function to be called when a message is delivered.

Any previous handler will be deleted. Not available for Polling links.

Parameters
functorFunctor to call when message is delivered

References delivery_info, SST::Output::fatal(), SST::Simulation_impl::getSimulation(), SST::Simulation_impl::getSimulationOutput(), and pair_link.

void SST::Link::send ( SimTime_t  delay,
TimeConverter tc,
Event event 
)
inline

Send an event over the link with additional delay.

Sends an event over a link with an additional delay specified with a TimeConverter. I.e. the total delay is the link's delay + the additional specified delay.

Parameters
delay- additional delay
tc- time converter to specify units for the additional delay
event- the Event to send

References SST::TimeConverter::convertToCoreTime(), and send_impl().

void SST::Link::send ( SimTime_t  delay,
Event event 
)
inline

Send an event with additional delay.

Sends an event over a link with additional delay specified by the Link's default timebase.

Parameters
delayThe additional delay, in units of the default Link timebase
eventThe event to send

References defaultTimeBase, and send_impl().

void SST::Link::send ( Event event)
inline

Send an event with the Link's default delay.

Parameters
eventThe event to send

References send_impl().

void SST::Link::send_impl ( SimTime_t  delay,
Event event 
)
protected

Send an event over the link with additional delay.

Sends an event over a link with an additional delay specified with a TimeConverter. I.e. the total delay is the link's delay + the additional specified delay.

Parameters
delay- additional total delay to add
event- the Event to send

References delivery_info, SST::Output::fatal(), SST::Simulation_impl::getSimulation(), SST::Simulation_impl::getSimulationOutput(), SST::ActivityQueue::insert(), latency, pair_link, and send_queue.

Referenced by send().

void SST::Link::sendInitData ( Event init_data)
inline

Send data during the init() or complete() phase.

Same as sendUntimedData()

Parameters
init_datadata to send

References sendUntimedData().

void SST::Link::sendUntimedData ( Event data)
void SST::Link::setDefaultTimeBase ( TimeConverter tc)

Manually set the default detaulTimeBase.

Parameters
tcTimeConverter object for the timebase

References defaultTimeBase, and SST::TimeConverter::getFactor().

Referenced by SST::BaseComponent::configureLink().

void SST::Link::setFunctor ( Event::HandlerBase functor)

Set the callback function to be called when a message is delivered.

Not available for Polling links.

Parameters
functorFunctor to call when message is delivered

References delivery_info, SST::Output::fatal(), SST::Simulation_impl::getSimulation(), SST::Simulation_impl::getSimulationOutput(), and pair_link.

Referenced by SST::BaseComponent::configureLink().

Field Documentation

SimTime_t SST::Link::defaultTimeBase
protected

Timebase used if no other timebase is specified.

Used to specify the units for added delays when sending, such as in Link::send(). Often set by the Component::registerClock() function if the regAll argument is true.

Referenced by getDefaultTimeBase(), send(), and setDefaultTimeBase().

uintptr_t SST::Link::delivery_info
protected

Holds the delivery information.

This is stored as a uintptr_t, but is actually a pointer converted using reinterpret_cast. For links connected to a Component/SubComponent, this holds a pointer to the delivery functor. For links connected to a Sync object, this holds a pointer to the remote link to send the event on after synchronization.

Referenced by replaceFunctor(), send_impl(), sendUntimedData(), setDeliveryInfo(), and setFunctor().

SimTime_t SST::Link::latency
protected

Latency of the link.

It is used by the partitioner as the weight. This latency is added to the delay put on the event by the component.

Referenced by addRecvLatency(), addSendLatency(), and send_impl().


The documentation for this class was generated from the following files: