GammaLib 2.0.0
Loading...
Searching...
No Matches
GTimes Class Reference

Time container class. More...

#include <GTimes.hpp>

Inheritance diagram for GTimes:
GContainer GBase

Public Member Functions

 GTimes (void)
 Void constructor.
 
 GTimes (const GTimes &times)
 Copy constructor.
 
virtual ~GTimes (void)
 Destructor.
 
GTimesoperator= (const GTimes &times)
 Assignment operator.
 
GTimeoperator[] (const int &index)
 Return reference to time.
 
const GTimeoperator[] (const int &index) const
 Return reference to time (const version)
 
void clear (void)
 Clear container.
 
GTimesclone (void) const
 Clone object.
 
std::string classname (void) const
 Return class name.
 
int size (void) const
 Return number of times.
 
bool is_empty (void) const
 Signal if there are no times.
 
void append (const GTime &time)
 Append time to container.
 
void insert (const int &index, const GTime &time)
 Insert time into container.
 
void remove (const int &index)
 Remove time from container.
 
void reserve (const int &num)
 Reserve memory for times in container.
 
void extend (const GTimes &times)
 Append time container.
 
std::string print (const GChatter &chatter=NORMAL) const
 Print time container information.
 
- Public Member Functions inherited from GContainer
virtual ~GContainer (void)
 Destructor.
 
- Public Member Functions inherited from GBase
virtual ~GBase (void)
 Destructor.
 

Protected Member Functions

void init_members (void)
 Initialise class members.
 
void copy_members (const GTimes &times)
 Copy class members.
 
void free_members (void)
 Delete class members.
 

Protected Attributes

std::vector< GTimem_times
 List of times.
 

Detailed Description

Time container class.

This class is a container for times. Times are implemented by the GTime class which stores time in a system independent way.

Definition at line 45 of file GTimes.hpp.

Constructor & Destructor Documentation

◆ GTimes() [1/2]

GTimes::GTimes ( void )

Void constructor.

Definition at line 56 of file GTimes.cpp.

References init_members().

Referenced by clone().

◆ GTimes() [2/2]

GTimes::GTimes ( const GTimes & times)

Copy constructor.

Parameters
timesPhoton container.

Definition at line 71 of file GTimes.cpp.

References copy_members(), and init_members().

◆ ~GTimes()

GTimes::~GTimes ( void )
virtual

Destructor.

Definition at line 87 of file GTimes.cpp.

References free_members().

Member Function Documentation

◆ append()

void GTimes::append ( const GTime & time)

Append time to container.

Parameters
[in]timeTime.

This method appends a time to the container by copying it.

Definition at line 216 of file GTimes.cpp.

References m_times.

Referenced by GModelTemporalConst::mc(), GModelTemporalLightCurve::mc(), GModelTemporalPhaseCurve::mc(), gammalib::spi_annealing_start_times(), and gammalib::spi_gedfail_times().

◆ classname()

std::string GTimes::classname ( void ) const
inlinevirtual

Return class name.

Returns
String containing the class name ("GTimes").

Implements GBase.

Definition at line 88 of file GTimes.hpp.

◆ clear()

void GTimes::clear ( void )
virtual

Clear container.

Implements GBase.

Definition at line 185 of file GTimes.cpp.

References free_members(), and init_members().

◆ clone()

GTimes * GTimes::clone ( void ) const
virtual

Clone object.

Returns
Pointer to deep copy of time container.

Implements GBase.

Definition at line 203 of file GTimes.cpp.

References GTimes().

◆ copy_members()

void GTimes::copy_members ( const GTimes & times)
protected

Copy class members.

Parameters
[in]timesTime container.

Definition at line 400 of file GTimes.cpp.

References m_times.

Referenced by GTimes(), and operator=().

◆ extend()

void GTimes::extend ( const GTimes & times)

Append time container.

Parameters
[in]timesTime container.

Append time container to the container.

Definition at line 299 of file GTimes.cpp.

References is_empty(), m_times, reserve(), and size().

◆ free_members()

void GTimes::free_members ( void )
protected

Delete class members.

Definition at line 413 of file GTimes.cpp.

Referenced by clear(), operator=(), and ~GTimes().

◆ init_members()

void GTimes::init_members ( void )
protected

Initialise class members.

Definition at line 385 of file GTimes.cpp.

References m_times.

Referenced by clear(), GTimes(), GTimes(), and operator=().

◆ insert()

void GTimes::insert ( const int & index,
const GTime & time )

Insert time into container.

Parameters
[in]indexTime index [0,...,size()[.
[in]timeTime.
Exceptions
GException::out_of_rangeTime index is out of range.

Inserts a time into the container before the time with the specified index.

Definition at line 238 of file GTimes.cpp.

References G_INSERT, is_empty(), m_times, and size().

◆ is_empty()

bool GTimes::is_empty ( void ) const
inlinevirtual

Signal if there are no times.

Returns
True if there are no times.

Implements GContainer.

Definition at line 112 of file GTimes.hpp.

References m_times.

Referenced by extend(), and insert().

◆ operator=()

GTimes & GTimes::operator= ( const GTimes & times)

Assignment operator.

Parameters
[in]timesTime container.
Returns
Time container.

Definition at line 109 of file GTimes.cpp.

References copy_members(), free_members(), and init_members().

◆ operator[]() [1/2]

GTime & GTimes::operator[] ( const int & index)

Return reference to time.

Parameters
[in]indexTime index [0,...,size()[.
Exceptions
GException::out_of_rangeTime index is out of range.

Definition at line 138 of file GTimes.cpp.

References G_OP_ACCESS, m_times, and size().

◆ operator[]() [2/2]

const GTime & GTimes::operator[] ( const int & index) const

Return reference to time (const version)

Parameters
[in]indexTime index [0,...,size()[.
Exceptions
GException::out_of_rangeTime index is out of range.

Definition at line 161 of file GTimes.cpp.

References G_OP_ACCESS, m_times, and size().

◆ print()

std::string GTimes::print ( const GChatter & chatter = NORMAL) const
virtual

Print time container information.

Parameters
[in]chatterChattiness.
Returns
String containing time container information.

Implements GBase.

Definition at line 347 of file GTimes.cpp.

References EXPLICIT, m_times, gammalib::parformat(), print(), SILENT, size(), and gammalib::str().

Referenced by print().

◆ remove()

void GTimes::remove ( const int & index)
virtual

Remove time from container.

Parameters
[in]indexTime index [0,...,size()[.
Exceptions
GException::out_of_rangeTime index is out of range.

Remove time of specified index from container.

Implements GContainer.

Definition at line 274 of file GTimes.cpp.

References G_REMOVE, m_times, and size().

◆ reserve()

void GTimes::reserve ( const int & num)
virtual

Reserve memory for times in container.

Parameters
[in]numNumber of times.

This method reserves memory for num times in the container.

Implements GContainer.

Definition at line 331 of file GTimes.cpp.

References m_times.

Referenced by extend().

◆ size()

int GTimes::size ( void ) const
inlinevirtual

Member Data Documentation

◆ m_times

std::vector<GTime> GTimes::m_times
protected

List of times.

Definition at line 78 of file GTimes.hpp.

Referenced by append(), copy_members(), extend(), init_members(), insert(), is_empty(), operator[](), operator[](), print(), remove(), reserve(), and size().


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