Parallel Analog Ensemble
Public Member Functions | Friends | List of all members
Times Class Reference

Times class is used to store Time. It is a bidirectional map implemented from Boost so that it provides fast translation from and to its underlying Time object. More...

#include <Times.h>

Inheritance diagram for Times:

Public Member Functions

 Times ()=default
 
 Times (const Times &)=default
 
virtual ~Times ()=default
 
void push_back (const Time &)
 
std::size_t getIndex (const Time &time) const
 
void getIndices (const Times &, std::vector< std::size_t > &) const
 
const TimegetTime (std::size_t index) const
 
void getTimestamps (std::vector< std::size_t > &timestamps) const
 
void print (std::ostream &os) const
 
void operator() (const Time &, const Time &, Times &) const
 
void operator() (const std::string &, const std::string &, Times &, bool iso_string=false) const
 
void operator() (size_t, size_t, Times &) const
 

Friends

std::ostream & operator<< (std::ostream &os, Times const &obj)
 

Detailed Description

Times class is used to store Time. It is a bidirectional map implemented from Boost so that it provides fast translation from and to its underlying Time object.

Times class supports the following features:

  1. Time is unique;
  2. Time objects are kept in sequence of insertion and have random access;
  3. Index of a Time object can be quickly retrieved using Time.

Time objects in Times are assumed to be sorted in ascension order.

Constructor & Destructor Documentation

◆ Times() [1/2]

Times::Times ( )
default

◆ Times() [2/2]

Times::Times ( const Times )
default

◆ ~Times()

virtual Times::~Times ( )
virtualdefault

Member Function Documentation

◆ getIndex()

size_t Times::getIndex ( const Time time) const

Retrieve the associated index with a Time object.

Parameters
timeA Time object
Returns
an index

◆ getIndices()

void Times::getIndices ( const Times ,
std::vector< std::size_t > &   
) const

◆ getTime()

const Time & Times::getTime ( std::size_t  index) const

◆ getTimestamps()

void Times::getTimestamps ( std::vector< std::size_t > &  timestamps) const

◆ operator()() [1/3]

void Times::operator() ( const std::string &  ,
const std::string &  ,
Times ,
bool  iso_string = false 
) const

◆ operator()() [2/3]

void Times::operator() ( const Time start,
const Time end,
Times sliced_times 
) const

Slice times based on the start and end times. The input strings should follow

  • (1) the delimited format: YYYY-mm-dd HH:MM:SS.SSS
  • (2) the non delimited iso format: YYYYmmddTHHMMSS

Note that the letter 'T' in the non delimited iso format is a literal letter.

For more documentation, please go to https://www.boost.org/doc/libs/1_72_0/doc/html/date_time/posix_time.html

Parameters
startThe Time, string, or size_t for start time.
endThe Time, string, or size_t for end time.
sliced_timesThe Times object to store the sliced times.
iso_stringWhether the strings use the ISO format.

◆ operator()() [3/3]

void Times::operator() ( size_t  start_time,
size_t  end_time,
Times sliced_times 
) const

◆ print()

void Times::print ( std::ostream &  os) const

◆ push_back()

void Times::push_back ( const Time time)

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
Times const &  obj 
)
friend

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