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

Phase Intervals class. More...

#include <GPhases.hpp>

Inheritance diagram for GPhases:
GContainer GBase

Public Member Functions

 GPhases (void)
 Void constructor. More...
 
 GPhases (const GPhases &phases)
 Copy constructor. More...
 
 GPhases (const double &pmin, const double &pmax)
 Single phase interval constructor. More...
 
virtual ~GPhases (void)
 Destructor. More...
 
GPhasesoperator= (const GPhases &phases)
 Assignment operator. More...
 
void clear (void)
 Clear phase intervals. More...
 
GPhasesclone (void) const
 Clone phase intervals. More...
 
std::string classname (void) const
 Return class name. More...
 
int size (void) const
 Return number of phase intervals. More...
 
bool is_empty (void) const
 Signal if there are no phase intervals. More...
 
void append (const double &pmin, const double &pmax)
 Append phase interval. More...
 
void remove (const int &index)
 Remove phase interval. More...
 
void reserve (const int &num)
 Reserve space for phase intervals. More...
 
void extend (const GPhases &phases)
 Append phase intervals. More...
 
double pmin (const int &index) const
 Returns lower boundary for a given phase interval. More...
 
double pmax (const int &index) const
 Returns upper boundary for a given phase interval. More...
 
std::string print (const GChatter &chatter=NORMAL) const
 Print phase intervals. 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 GPhases &phases)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
void insert_interval (const int &index, const double &pmin, const double &pmax)
 Insert phase interval. More...
 

Protected Attributes

std::vector< double > m_pmin
 
std::vector< double > m_pmax
 

Detailed Description

Phase Intervals class.

Definition at line 42 of file GPhases.hpp.

Constructor & Destructor Documentation

GPhases::GPhases ( void  )

Void constructor.

Constructs empty phase intervals.

Definition at line 59 of file GPhases.cpp.

References init_members().

Referenced by clone().

GPhases::GPhases ( const GPhases phases)

Copy constructor.

Parameters
[in]phasesPhase intervals.

Constructs phase intervals by copying other phase intervals.

Definition at line 76 of file GPhases.cpp.

References copy_members(), and init_members().

GPhases::GPhases ( const double &  pmin,
const double &  pmax 
)

Single phase interval constructor.

Parameters
[in]pminLower boundary of phase interval.
[in]pmaxUpper boundary of phase interval.

Constructs Good Time Intervals from a single phase interval, given by [p@ pmin, pmax].

Definition at line 98 of file GPhases.cpp.

References append(), and init_members().

GPhases::~GPhases ( void  )
virtual

Destructor.

Definition at line 114 of file GPhases.cpp.

References free_members().

Member Function Documentation

void GPhases::append ( const double &  pmin,
const double &  pmax 
)

Append phase interval.

Parameters
[in]pminLower boundary of phase interval.
[in]pmaxUpper boundary of phase interval.

Appends a phase interval at the end of the container.

Definition at line 198 of file GPhases.cpp.

References insert_interval(), and size().

Referenced by GPhases(), and gammalib::read_ds_phase().

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

Return class name.

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

Implements GBase.

Definition at line 88 of file GPhases.hpp.

void GPhases::clear ( void  )
virtual

Clear phase intervals.

Implements GBase.

Definition at line 166 of file GPhases.cpp.

References free_members(), and init_members().

Referenced by GCTAEventList::init_members().

GPhases * GPhases::clone ( void  ) const
virtual

Clone phase intervals.

Returns
Pointer to deep copy of phase intervals.

Implements GBase.

Definition at line 184 of file GPhases.cpp.

References GPhases().

void GPhases::copy_members ( const GPhases phases)
protected

Copy class members.

Parameters
[in]phasesPhase intervals.

Definition at line 385 of file GPhases.cpp.

References m_pmax, and m_pmin.

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

void GPhases::extend ( const GPhases phases)

Append phase intervals.

Parameters
[in]phasesPhase intervals.

Append phase intervals to the container.

Definition at line 258 of file GPhases.cpp.

References is_empty(), m_pmax, m_pmin, pmax(), pmin(), reserve(), and size().

void GPhases::free_members ( void  )
protected

Delete class members.

Definition at line 399 of file GPhases.cpp.

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

void GPhases::init_members ( void  )
protected

Initialise class members.

Definition at line 369 of file GPhases.cpp.

References m_pmax, and m_pmin.

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

void GPhases::insert_interval ( const int &  index,
const double &  pmin,
const double &  pmax 
)
protected

Insert phase interval.

Parameters
[in]indexIndex after which interval is inserted.
[in]pminLower boundary of interval.
[in]pmaxUpper boundary of interval.
Exceptions
GException::invalid_argumentInvalid phase interval boundaries specified

Inserts a phase interval before the interval with the specified index. If no interval with the specified index exists then append the interval at the end of the existing phase intervals.

Definition at line 420 of file GPhases.cpp.

References G_INSERT_INTERVAL, m_pmax, m_pmin, pmax(), pmin(), size(), and gammalib::str().

Referenced by append().

bool GPhases::is_empty ( void  ) const
inlinevirtual

Signal if there are no phase intervals.

Returns
True if there are no phase intervals.

Implements GContainer.

Definition at line 112 of file GPhases.hpp.

References m_pmin.

Referenced by extend().

GPhases & GPhases::operator= ( const GPhases phases)

Assignment operator.

Parameters
[in]phasesPhase intervals.
Returns
Phase intervals.

Definition at line 136 of file GPhases.cpp.

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

double GPhases::pmax ( const int &  index) const

Returns upper boundary for a given phase interval.

Parameters
[in]indexPhase interval index (0,...,size()-1).
Returns
Upper boundary of phase interval.
Exceptions
GException::out_of_rangeSpecified index is out of range.

Definition at line 317 of file GPhases.cpp.

References G_PMAX, m_pmax, and size().

Referenced by extend(), insert_interval(), and GCTAEventList::write_ds_keys().

double GPhases::pmin ( const int &  index) const

Returns lower boundary for a given phase interval.

Parameters
[in]indexPhase interval index (0,...,size()-1).
Returns
Lower boundary of phase interval.
Exceptions
GException::out_of_rangeSpecified index is out of range.

Definition at line 293 of file GPhases.cpp.

References G_PMIN, m_pmin, and size().

Referenced by extend(), insert_interval(), and GCTAEventList::write_ds_keys().

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

Print phase intervals.

Parameters
[in]chatterChattiness.
Returns
String containing phase interval information.

Implements GBase.

Definition at line 338 of file GPhases.cpp.

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

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

Remove phase interval.

Parameters
[in]indexPhase interval index (0,...,size()-1).

Removes phase interval at index from the container. All intervals after the specified index are moved forward by one position.

Implements GContainer.

Definition at line 216 of file GPhases.cpp.

References G_REMOVE, m_pmax, m_pmin, and size().

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

Reserve space for phase intervals.

Parameters
[in]numNumber of elements.

Implements GContainer.

Definition at line 240 of file GPhases.cpp.

References m_pmax, and m_pmin.

Referenced by extend().

int GPhases::size ( void  ) const
inlinevirtual

Return number of phase intervals.

Returns
Number of phase intervals.

Implements GContainer.

Definition at line 100 of file GPhases.hpp.

References m_pmin.

Referenced by append(), extend(), insert_interval(), pmax(), pmin(), print(), remove(), and GCTAEventList::write_ds_keys().

Member Data Documentation

std::vector<double> GPhases::m_pmax
protected

Definition at line 78 of file GPhases.hpp.

Referenced by copy_members(), extend(), init_members(), insert_interval(), pmax(), remove(), and reserve().

std::vector<double> GPhases::m_pmin
protected

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