SST  6.0.0
StructuralSimulationToolkit
SST::SubComponent Class Reference

SubComponent is a class loadable through the factory which allows dynamic functionality to be added to a Component. More...

#include <subcomponent.h>

Inheritance diagram for SST::SubComponent:
SST::Module SST::Interfaces::SimpleMem SST::Interfaces::SimpleNetwork SST::Interfaces::SimpleNetwork::NetworkInspector

Public Member Functions

 SubComponent (Component *parent)
 
virtual void init (unsigned int phase)
 Used during the init phase. More...
 
virtual void setup ()
 Called after all components have been constructed and inialization has completed, but before simulation time has begun. More...
 
virtual void finish ()
 Called after simulation completes, but before objects are destroyed. More...
 

Protected Member Functions

bool isPortConnected (const std::string &name) const
 Determine if a port name is connected to any links.
 
LinkconfigureLink (std::string name, TimeConverter *time_base, Event::HandlerBase *handler=NULL)
 Configure a Link. More...
 
LinkconfigureLink (std::string name, std::string time_base, Event::HandlerBase *handler=NULL)
 Configure a Link. More...
 
LinkconfigureLink (std::string name, Event::HandlerBase *handler=NULL)
 Configure a Link. More...
 
LinkconfigureSelfLink (std::string name, TimeConverter *time_base, Event::HandlerBase *handler=NULL)
 Configure a SelfLink (Loopback link) More...
 
LinkconfigureSelfLink (std::string name, std::string time_base, Event::HandlerBase *handler=NULL)
 Configure a SelfLink (Loopback link) More...
 
LinkconfigureSelfLink (std::string name, Event::HandlerBase *handler=NULL)
 Configure a SelfLink (Loopback link) More...
 
bool doesSubComponentInfoStatisticExist (std::string statisticName)
 
template<typename T >
Statistic< T > * registerStatistic (std::string statName, std::string statSubId="")
 
TimeConverterregisterClock (std::string freq, Clock::HandlerBase *handler)
 Registers a clock for this component. More...
 
TimeConverterregisterClock (const UnitAlgebra &freq, Clock::HandlerBase *handler)
 
void unregisterClock (TimeConverter *tc, Clock::HandlerBase *handler)
 Removes a clock handler from the component.
 
Cycle_t reregisterClock (TimeConverter *freq, Clock::HandlerBase *handler)
 Reactivates an existing Clock and Handler. More...
 
Cycle_t getNextClockCycle (TimeConverter *freq)
 Returns the next Cycle that the TimeConverter would fire.
 
TimeConvertergetTimeConverter (const std::string &base)
 
TimeConvertergetTimeConverter (const UnitAlgebra &base)
 
SimTime_t getCurrentSimTime (TimeConverter *tc) const
 return the time since the simulation began in units specified by the parameter. More...
 
SimTime_t getCurrentSimTime (std::string base)
 return the time since the simulation began in timebase specified More...
 
SimTime_t getCurrentSimTimeNano () const
 Utility function to return the time since the simulation began in nanoseconds.
 
SimTime_t getCurrentSimTimeMicro () const
 Utility function to return the time since the simulation began in microseconds.
 
SimTime_t getCurrentSimTimeMilli () const
 Utility function to return the time since the simulation began in milliseconds.
 
ModuleloadModule (std::string type, Params &params)
 
ModuleloadModuleWithComponent (std::string type, Params &params)
 
SubComponentloadSubComponent (std::string type, Params &params)
 
SharedRegiongetLocalSharedRegion (const std::string &key, size_t size)
 Find a lookup table.
 
SharedRegiongetGlobalSharedRegion (const std::string &key, size_t size, SharedRegionMerger *merger=NULL)
 

Protected Attributes

Component *const parent
 

Friends

class Component
 Component's type, set by the factory when the object is created. More...
 

Detailed Description

SubComponent is a class loadable through the factory which allows dynamic functionality to be added to a Component.

The SubComponent API is nearly identical to the Component API and all the calls are proxied to the parent Compoent.

Member Function Documentation

Link * SST::SubComponent::configureLink ( std::string  name,
TimeConverter time_base,
Event::HandlerBase handler = NULL 
)
protected

Configure a Link.

Parameters
name- Port Name on which the link to configure is attached.
time_base- Time Base of the link
handler- Optional Handler to be called when an Event is received
Returns
A pointer to the configured link, or NULL if an error occured.

References SST::Component::configureLink().

Referenced by configureLink().

Link * SST::SubComponent::configureLink ( std::string  name,
std::string  time_base,
Event::HandlerBase handler = NULL 
)
protected

Configure a Link.

Parameters
name- Port Name on which the link to configure is attached.
time_base- Time Base of the link
handler- Optional Handler to be called when an Event is received
Returns
A pointer to the configured link, or NULL if an error occured.

References configureLink(), and SST::Simulation::getSimulation().

Link * SST::SubComponent::configureLink ( std::string  name,
Event::HandlerBase handler = NULL 
)
protected

Configure a Link.

Parameters
name- Port Name on which the link to configure is attached.
handler- Optional Handler to be called when an Event is received
Returns
A pointer to the configured link, or NULL if an error occured.

References SST::Component::configureLink().

Link * SST::SubComponent::configureSelfLink ( std::string  name,
TimeConverter time_base,
Event::HandlerBase handler = NULL 
)
protected

Configure a SelfLink (Loopback link)

Parameters
name- Name of the self-link port
time_base- Time Base of the link
handler- Optional Handler to be called when an Event is received
Returns
A pointer to the configured link, or NULL if an error occured.

References SST::Component::configureSelfLink().

Link * SST::SubComponent::configureSelfLink ( std::string  name,
std::string  time_base,
Event::HandlerBase handler = NULL 
)
protected

Configure a SelfLink (Loopback link)

Parameters
name- Name of the self-link port
time_base- Time Base of the link
handler- Optional Handler to be called when an Event is received
Returns
A pointer to the configured link, or NULL if an error occured.

References SST::Component::configureSelfLink().

Link * SST::SubComponent::configureSelfLink ( std::string  name,
Event::HandlerBase handler = NULL 
)
protected

Configure a SelfLink (Loopback link)

Parameters
name- Name of the self-link port
handler- Optional Handler to be called when an Event is received
Returns
A pointer to the configured link, or NULL if an error occured.

References SST::Component::configureSelfLink().

virtual void SST::SubComponent::finish ( )
inlinevirtual

Called after simulation completes, but before objects are destroyed.

A good place to print out statistics.

Reimplemented in SST::Interfaces::SimpleNetwork.

SimTime_t SST::SubComponent::getCurrentSimTime ( TimeConverter tc) const
protected

return the time since the simulation began in units specified by the parameter.

Parameters
tcTimeConverter specificing the units

References SST::TimeConverter::convertFromCoreTime(), and SST::Simulation::getSimulation().

Referenced by getCurrentSimTime(), getCurrentSimTimeMicro(), getCurrentSimTimeMilli(), and getCurrentSimTimeNano().

SimTime_t SST::SubComponent::getCurrentSimTime ( std::string  base)
protected

return the time since the simulation began in timebase specified

Parameters
baseTimebase frequency in SI Units

References getCurrentSimTime(), and SST::Simulation::getSimulation().

virtual void SST::SubComponent::init ( unsigned int  phase)
inlinevirtual

Used during the init phase.

The method will be called each phase of initialization. Initialization ends when no components have sent any data.

Reimplemented in SST::Interfaces::SimpleNetwork.

TimeConverter * SST::SubComponent::registerClock ( std::string  freq,
Clock::HandlerBase handler 
)
protected

Registers a clock for this component.

Parameters
freqFrequency for the clock in SI units
handlerPointer to Clock::HandlerBase which is to be invoked at the specified interval NOTE: Unlike Components, SubComponents do not have a default timebase

References SST::Component::registerClock().

Cycle_t SST::SubComponent::reregisterClock ( TimeConverter freq,
Clock::HandlerBase handler 
)
protected

Reactivates an existing Clock and Handler.

Returns
time of next time clock handler will fire

References SST::Component::reregisterClock().

virtual void SST::SubComponent::setup ( )
inlinevirtual

Called after all components have been constructed and inialization has completed, but before simulation time has begun.

Reimplemented in SST::Interfaces::SimpleNetwork.

Friends And Related Function Documentation

friend class Component
friend

Component's type, set by the factory when the object is created.

It is identical to the configuration string used to create the component. I.e. the XML "<component id="aFoo"><foo>..." would set component::type to "foo"


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