SST 15.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 (TimeConverter *tc)
 Create a new TimeConverter object from a TimeConverter* Use this to create a local TimeConverter from a TimeConverter* returned by the BaseComponent and other public APIs.
 
 TimeConverter (std::nullptr_t UNUSED(tc))
 
 TimeConverter ()
 Do not directly invoke this constructor from Components to get a TimeConverter.
 
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 intialized (non-zero factor)
 
 operator bool () const
 Conversion to bool.
 

Friends

class TimeLord
 
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/2]

SST::TimeConverter::TimeConverter ( TimeConverter * tc)
inline

Create a new TimeConverter object from a TimeConverter* Use this to create a local TimeConverter from a TimeConverter* returned by the BaseComponent and other public APIs.

Parameters
tcTimeConverter to initialize factor from

References TimeConverter().

Referenced by TimeConverter().

◆ TimeConverter() [2/2]

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.

◆ ~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::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_impl::getTimeLord().

◆ isInitialized()

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

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

Returns
true if TimeConverter is intialized (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: