SST 16.0.0
Structural Simulation Toolkit
SST::TimeConverter Class Reference

A class to convert between a component's view of time and the core's view of time. More...

#include <timeConverter.h>

Public Member Functions

 TimeConverter ()
 Do not directly invoke this constructor from Components to get a TimeConverter.
 TimeConverter (const std::string &time)
 Create a TimeConverter for the time specified as a UnitAlgebra.
 TimeConverter (const UnitAlgebra &time)
 Create a TimeConverter for the time specified as a UnitAlgebra.
 TimeConverter (const char *time)
 Create a TimeConverter for the time specified as a UnitAlgebra.
SimTime_t convertToCoreTime (SimTime_t time) const
 Converts from the component's view to the core's view of time.
SimTime_t convertFromCoreTime (SimTime_t time) const
 Converts from the core's view to the components's view of time.
SimTime_t getFactor () const
void reset ()
 Resets a TimeConverter to uninitialized state (factor = 0).
UnitAlgebra getPeriod () const
 ~TimeConverter ()
 TimeConverter* returned by the core should never be deleted by Elements.
bool isInitialized () const
 Function to check to see if the TimeConverter is initialized (non-zero factor).
 operator bool () const
 Conversion to bool.

Friends

class TimeLord
class SyncManager
class SST::Core::Serialization::serialize_impl< TimeConverter >
class SST::Core::Serialization::serialize_impl< TimeConverter * >

Detailed Description

A class to convert between a component's view of time and the core's view of time.

Constructor & Destructor Documentation

◆ TimeConverter() [1/4]

SST::TimeConverter::TimeConverter ( )
inline

Do not directly invoke this constructor from Components to get a TimeConverter.

Instead, use the BaseComponent API functions and the constructor that uses a TimeConverter* to create a TimeConverter.

Referenced by TimeConverter().

◆ TimeConverter() [2/4]

SST::TimeConverter::TimeConverter ( const std::string & time)

Create a TimeConverter for the time specified as a UnitAlgebra.

The time must be in seconds, or it also supports a unit of Hz, which will give you the time for the period of that frequency. You may also use an SI prefix as part of the unit.

Parameters
timeTime to base the TimeConverter on

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

◆ TimeConverter() [3/4]

SST::TimeConverter::TimeConverter ( const UnitAlgebra & time)

Create a TimeConverter for the time specified as a UnitAlgebra.

The time must be in seconds, or it also supports a unit of Hz, which will give you the time for the period of that frequency.

Parameters
timeTime to base the TimeConverter on

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

◆ TimeConverter() [4/4]

SST::TimeConverter::TimeConverter ( const char * time)
inline

Create a TimeConverter for the time specified as a UnitAlgebra.

The time must be in seconds, or it also supports a unit of Hz, which will give you the time for the period of that frequency. You may also use an SI prefix as part of the unit.

Parameters
timeTime to base the TimeConverter on

References TimeConverter().

◆ ~TimeConverter()

SST::TimeConverter::~TimeConverter ( )
inline

TimeConverter* returned by the core should never be deleted by Elements.

This was moved to public due to needing to support ObjectMaps.

Member Function Documentation

◆ convertFromCoreTime()

SimTime_t SST::TimeConverter::convertFromCoreTime ( SimTime_t time) const
inline

Converts from the core's view to the components's view of time.

The result is truncated, not rounded.

Parameters
timetime to convert from core time

Referenced by SST::BaseComponent::getCurrentSimTime(), SST::BaseComponent::getCurrentSimTimeMicro(), SST::BaseComponent::getCurrentSimTimeMilli(), and SST::BaseComponent::getCurrentSimTimeNano().

◆ convertToCoreTime()

SimTime_t SST::TimeConverter::convertToCoreTime ( SimTime_t time) const
inline

Converts from the component's view to the core's view of time.

Parameters
timetime to convert to core time

Referenced by SST::Link::addRecvLatency(), SST::Link::addSendLatency(), and SST::Link::send().

◆ getFactor()

◆ getPeriod()

UnitAlgebra SST::TimeConverter::getPeriod ( ) const
Returns
The period represented by this TimeConverter as a UnitAlgebra

References SST::TimeLord::getTimeBase(), and SST::Simulation::getTimeLord().

◆ isInitialized()

bool SST::TimeConverter::isInitialized ( ) const
inline

Function to check to see if the TimeConverter is initialized (non-zero factor).

Returns
true if TimeConverter is initialized (factor is non-zero), false otherwise

◆ operator bool()

SST::TimeConverter::operator bool ( ) const
inlineexplicit

Conversion to bool.

This will allow !tc to work to check if it has been initialized (has a non-zero factor).

Returns
true if TimeConverter is initialized (factor is non-zero)

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