GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GTimes Class Reference

Time container class. More...

#include <GTimes.hpp>

Inheritance diagram for GTimes:
GContainer GBase

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

std::vector< GTimem_times
 List of times. More...
 

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::GTimes ( void  )

Void constructor.

Definition at line 56 of file GTimes.cpp.

References init_members().

Referenced by clone().

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 ( void  )
virtual

Destructor.

Definition at line 87 of file GTimes.cpp.

References free_members().

Member Function Documentation

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 GCOMHkd::append(), GCOMHkd::extend(), GModelTemporalConst::mc(), GModelTemporalLightCurve::mc(), GModelTemporalPhaseCurve::mc(), GCOMHkd::print(), gammalib::spi_annealing_start_times(), and gammalib::spi_gedfail_times().

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.

void GTimes::clear ( void  )
virtual

Clear container.

Implements GBase.

Definition at line 185 of file GTimes.cpp.

References free_members(), and init_members().

Referenced by GCOMHkd::init_members().

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().

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=().

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().

void GTimes::free_members ( void  )
protected

Delete class members.

Definition at line 413 of file GTimes.cpp.

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

void GTimes::init_members ( void  )
protected

Initialise class members.

Definition at line 385 of file GTimes.cpp.

References m_times.

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

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().

Referenced by GCOMHkd::extend().

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(), insert(), and GCOMHkd::is_empty().

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().

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().

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().

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(), SILENT, size(), and gammalib::str().

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().

Referenced by GCOMHkd::remove().

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(), and GCOMHkd::reserve().

int GTimes::size ( void  ) const
inlinevirtual

Member Data Documentation

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[](), print(), remove(), reserve(), and size().


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