GammaLib
2.0.0
|
Phase Intervals class. More...
#include <GPhases.hpp>
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... | |
GPhases & | operator= (const GPhases &phases) |
Assignment operator. More... | |
void | clear (void) |
Clear phase intervals. More... | |
GPhases * | clone (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... | |
bool | contains (const double &phase) const |
Check whether phase is contained in phases. 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... | |
double | length (void) const |
Returns total length of phase intervals. 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 |
Phase Intervals class.
Definition at line 42 of file GPhases.hpp.
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.
[in] | phases | Phase 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.
[in] | pmin | Lower boundary of phase interval. |
[in] | pmax | Upper 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().
|
virtual |
void GPhases::append | ( | const double & | pmin, |
const double & | pmax | ||
) |
Append phase interval.
[in] | pmin | Lower boundary of phase interval. |
[in] | pmax | Upper boundary of phase interval. |
Appends a phase interval at the end of the container.
Definition at line 226 of file GPhases.cpp.
References insert_interval(), and size().
Referenced by GPhases(), and gammalib::read_ds_phase().
|
inlinevirtual |
Return class name.
Implements GBase.
Definition at line 90 of file GPhases.hpp.
|
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(), and GCOMSelection::init_members().
|
virtual |
Clone phase intervals.
Implements GBase.
Definition at line 184 of file GPhases.cpp.
References GPhases().
bool GPhases::contains | ( | const double & | phase | ) | const |
Check whether phase is contained in phases.
[in] | phase | Phase. |
Checks whether a phase is contained in one of the phase intervals. The lower phase bound is included while the upper phase bound is excluded by the check.
Definition at line 200 of file GPhases.cpp.
References m_pmax, m_pmin, and size().
Referenced by GCOMDri::compute_dre(), and GCOMDri::use_superpacket().
|
protected |
Copy class members.
[in] | phases | Phase intervals. |
Definition at line 442 of file GPhases.cpp.
References m_pmax, and m_pmin.
Referenced by GPhases(), and operator=().
void GPhases::extend | ( | const GPhases & | phases | ) |
Append phase intervals.
[in] | phases | Phase intervals. |
Append phase intervals to the container.
Definition at line 286 of file GPhases.cpp.
References is_empty(), m_pmax, m_pmin, pmax(), pmin(), reserve(), and size().
|
protected |
Delete class members.
Definition at line 456 of file GPhases.cpp.
Referenced by clear(), operator=(), and ~GPhases().
|
protected |
Initialise class members.
Definition at line 426 of file GPhases.cpp.
References m_pmax, and m_pmin.
Referenced by clear(), GPhases(), and operator=().
|
protected |
Insert phase interval.
[in] | index | Index after which interval is inserted. |
[in] | pmin | Lower boundary of interval. |
[in] | pmax | Upper boundary of interval. |
GException::invalid_argument | Invalid 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 477 of file GPhases.cpp.
References G_INSERT_INTERVAL, m_pmax, m_pmin, pmax(), pmin(), size(), and gammalib::str().
Referenced by append().
|
inlinevirtual |
Signal if there are no phase intervals.
Implements GContainer.
Definition at line 114 of file GPhases.hpp.
References m_pmin.
Referenced by extend(), GCOMSelection::print(), and GCOMDri::use_superpacket().
double GPhases::length | ( | void | ) | const |
Returns total length of phase intervals.
Definition at line 365 of file GPhases.cpp.
References m_pmax, m_pmin, and size().
Referenced by GCOMDri::compute_dre().
Assignment operator.
[in] | phases | 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.
[in] | index | Phase interval index (0,...,size()-1). |
GException::out_of_range | Specified index is out of range. |
Definition at line 345 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.
[in] | index | Phase interval index (0,...,size()-1). |
GException::out_of_range | Specified index is out of range. |
Definition at line 321 of file GPhases.cpp.
References G_PMIN, m_pmin, and size().
Referenced by extend(), insert_interval(), and GCTAEventList::write_ds_keys().
Print phase intervals.
[in] | chatter | Chattiness. |
Implements GBase.
Definition at line 386 of file GPhases.cpp.
References m_pmax, m_pmin, gammalib::parformat(), SILENT, size(), and gammalib::str().
Referenced by GCOMSelection::print().
|
virtual |
Remove phase interval.
[in] | index | Phase 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 244 of file GPhases.cpp.
|
virtual |
Reserve space for phase intervals.
[in] | num | Number of elements. |
Implements GContainer.
Definition at line 268 of file GPhases.cpp.
References m_pmax, and m_pmin.
Referenced by extend().
|
inlinevirtual |
Return number of phase intervals.
Implements GContainer.
Definition at line 102 of file GPhases.hpp.
References m_pmin.
Referenced by append(), contains(), extend(), insert_interval(), length(), pmax(), pmin(), print(), remove(), and GCTAEventList::write_ds_keys().
|
protected |
Definition at line 80 of file GPhases.hpp.
Referenced by contains(), copy_members(), extend(), init_members(), insert_interval(), length(), pmax(), print(), remove(), and reserve().
|
protected |
Definition at line 79 of file GPhases.hpp.
Referenced by contains(), copy_members(), extend(), init_members(), insert_interval(), is_empty(), length(), pmin(), print(), remove(), reserve(), and size().