A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::TimeSpan Class Reference

Class representing a period of time defined via a begin time and an end time. More...

#include "time-span.h"

Collaboration diagram for ns3::TimeSpan:

Public Member Functions

 TimeSpan ()=default
 TimeSpan (const std::string &s)
 Construct a TimeSpan from a string.
 TimeSpan (const Time &begin, const Time &end)
 Construct a TimeSpan from a begin time and an end time.
Time Begin () const
Time Duration () const
Time End () const
bool operator== (const TimeSpan &other) const =default
 Compare two TimeSpan objects for equality.

Static Public Member Functions

static TimeSpan Create (const Time &begin, const Time &end)
 TimeSpan factory (required by TimeSpanValue).

Private Attributes

Time m_begin
 begin time
Time m_end
 end time

Detailed Description

Class representing a period of time defined via a begin time and an end time.

An object of this class can also be set/get via the attribute system by using the TimeSpanValue attribute value.

Definition at line 29 of file time-span.h.

Constructor & Destructor Documentation

◆ TimeSpan() [1/3]

ns3::TimeSpan::TimeSpan ( )
default

References TimeSpan().

Referenced by TimeSpan(), Create(), and operator==().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TimeSpan() [2/3]

ns3::TimeSpan::TimeSpan ( const std::string & s)
explicit

Construct a TimeSpan from a string.

The string representation is "{begin, end}". Whitespace around the begin and end times is allowed.

Parameters
sThe string to parse into a TimeSpan

Definition at line 22 of file time-span.cc.

◆ TimeSpan() [3/3]

ns3::TimeSpan::TimeSpan ( const Time & begin,
const Time & end )

Construct a TimeSpan from a begin time and an end time.

Parameters
beginthe begin time
endthe end time

Definition at line 28 of file time-span.cc.

References m_begin, m_end, and NS_ASSERT_MSG.

Member Function Documentation

◆ Begin()

Time ns3::TimeSpan::Begin ( ) const
Returns
the begin time

Definition at line 44 of file time-span.cc.

References m_begin.

Referenced by TimeInputOutputTestCase::DoRun(), and ns3::operator<<().

Here is the caller graph for this function:

◆ Create()

TimeSpan ns3::TimeSpan::Create ( const Time & begin,
const Time & end )
static

TimeSpan factory (required by TimeSpanValue).

Parameters
beginthe begin time
endthe end time
Returns
a TimeSpan object

Definition at line 38 of file time-span.cc.

References TimeSpan().

Here is the call graph for this function:

◆ Duration()

Time ns3::TimeSpan::Duration ( ) const
Returns
the duration of the timespan

Definition at line 56 of file time-span.cc.

References m_begin, and m_end.

◆ End()

Time ns3::TimeSpan::End ( ) const
Returns
the end time

Definition at line 50 of file time-span.cc.

References m_end.

Referenced by TimeInputOutputTestCase::DoRun(), and ns3::operator<<().

Here is the caller graph for this function:

◆ operator==()

bool ns3::TimeSpan::operator== ( const TimeSpan & other) const
default

Compare two TimeSpan objects for equality.

Parameters
otherThe TimeSpan to compare with
Returns
true if both TimeSpan objects have the same begin and end times

References TimeSpan().

Here is the call graph for this function:

Member Data Documentation

◆ m_begin

Time ns3::TimeSpan::m_begin
private

begin time

Definition at line 84 of file time-span.h.

Referenced by TimeSpan(), Begin(), and Duration().

◆ m_end

Time ns3::TimeSpan::m_end
private

end time

Definition at line 85 of file time-span.h.

Referenced by TimeSpan(), Duration(), and End().


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