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

COMPTEL Housekeeping Data collection class. More...

#include <GCOMHkds.hpp>

Inheritance diagram for GCOMHkds:
GContainer GBase

Public Member Functions

 GCOMHkds (void)
 Void constructor. More...
 
 GCOMHkds (const GFilename &filename)
 Filename constructor. More...
 
 GCOMHkds (const GCOMHkds &hkds)
 Copy constructor. More...
 
virtual ~GCOMHkds (void)
 Destructor. More...
 
GCOMHkdsoperator= (const GCOMHkds &hkds)
 Assignment operator. More...
 
GCOMHkdoperator[] (const int &index)
 Return reference to Housekeeping Data container. More...
 
const GCOMHkdoperator[] (const int &index) const
 Return reference to Housekeeping Data (const version) More...
 
GCOMHkdoperator[] (const std::string &name)
 Return reference to Housekeeping Data container. More...
 
const GCOMHkdoperator[] (const std::string &name) const
 Return reference to Housekeeping Data container (const version) More...
 
void clear (void)
 Clear Housekeeping Data collection. More...
 
GCOMHkdsclone (void) const
 Clone Housekeeping Data collection. More...
 
std::string classname (void) const
 Return class name. More...
 
GCOMHkdat (const int &index)
 Return reference to Housekeeping Data container. More...
 
const GCOMHkdat (const int &index) const
 Return reference to Housekeeping Data container (const version) More...
 
int size (void) const
 Return number of Housekeeping parameters in collection. More...
 
bool is_empty (void) const
 Signals if there are no Housekeeping Data containers in collection. More...
 
GCOMHkdset (const int &index, const GCOMHkd &hkd)
 Set Housekeeping Data container in collection. More...
 
GCOMHkdset (const std::string &name, const GCOMHkd &hkd)
 Set Housekeeping Data container in collection. More...
 
GCOMHkdappend (const GCOMHkd &hkd)
 Append Housekeeping Data container to collection. More...
 
GCOMHkdinsert (const int &index, const GCOMHkd &hkd)
 Insert Housekeeping Data container into collection. More...
 
void remove (const int &index)
 Remove Housekeeping Data container from collection. More...
 
void reserve (const int &num)
 Reserves space for Housekeeping Data containers in collection. More...
 
bool contains (const std::string &name) const
 Signals if Housekeeping parameter exists in collection. More...
 
void extend (const GCOMHkds &hkds)
 Extend Housekeeping Data collection. More...
 
void load (const GFilename &filename)
 Load Housekeeping Data collection from FITS file. More...
 
void read (const GFitsTable &table)
 Read Housekeeping Data collection from FITS table. More...
 
std::string print (const GChatter &chatter=NORMAL) const
 Print Housekeeping Data collection. 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 GCOMHkds &hkds)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
int get_index (const std::string &name) const
 Return Housekeeping Data container index by parameter name. More...
 

Protected Attributes

std::vector< GCOMHkdm_hkds
 Housekeeping Data containers. More...
 

Detailed Description

COMPTEL Housekeeping Data collection class.

The COMPTEL Housekeeping Data collection class holds Housekeeping Data containers for various parameters.

Definition at line 51 of file GCOMHkds.hpp.

Constructor & Destructor Documentation

GCOMHkds::GCOMHkds ( void  )

Void constructor.

Constructs an empty Housekeeping Data collection.

Definition at line 66 of file GCOMHkds.cpp.

References init_members().

Referenced by clone().

GCOMHkds::GCOMHkds ( const GFilename filename)
explicit

Filename constructor.

Parameters
[in]filenameHousekeeping Data FITS file.

Constructs a Housekeeping Data collection from a HKD FITS file.

Definition at line 83 of file GCOMHkds.cpp.

References init_members(), and load().

GCOMHkds::GCOMHkds ( const GCOMHkds hkds)

Copy constructor.

Parameters
[in]hkdsHousekeeping Data collection.

Definition at line 101 of file GCOMHkds.cpp.

References copy_members(), and init_members().

GCOMHkds::~GCOMHkds ( void  )
virtual

Destructor.

Definition at line 117 of file GCOMHkds.cpp.

References free_members().

Member Function Documentation

GCOMHkd & GCOMHkds::append ( const GCOMHkd hkd)

Append Housekeeping Data container to collection.

Parameters
[in]hkdHousekeeping Data container.
Returns
Reference to appended Housekeeping Data container.

Appends Housekeeping Data container to the collection by making a deep copy of specified container.

Definition at line 421 of file GCOMHkds.cpp.

References m_hkds, and size().

Referenced by extend(), and read().

GCOMHkd & GCOMHkds::at ( const int &  index)

Return reference to Housekeeping Data container.

Parameters
[in]indexHousekeeping Data index [0,...,size()-1].
Returns
Reference to Housekeeping Data container.
Exceptions
GException::out_of_rangeHousekeeping Data container index is out of range.

Returns a reference to the Housekeeping Data container with the specified index.

Definition at line 269 of file GCOMHkds.cpp.

References G_AT, m_hkds, and size().

const GCOMHkd & GCOMHkds::at ( const int &  index) const

Return reference to Housekeeping Data container (const version)

Parameters
[in]indexHousekeeping Data index [0,...,size()-1].
Returns
Reference to Housekeeping Data container.
Exceptions
GException::out_of_rangeHousekeeping Data container index is out of range.

Returns a reference to the Housekeeping Data container with the specified index.

Definition at line 294 of file GCOMHkds.cpp.

References G_AT, m_hkds, and size().

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

Return class name.

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

Implements GBase.

Definition at line 105 of file GCOMHkds.hpp.

void GCOMHkds::clear ( void  )
virtual

Clear Housekeeping Data collection.

Implements GBase.

Definition at line 233 of file GCOMHkds.cpp.

References free_members(), and init_members().

Referenced by GCOMObservation::init_members(), and read().

GCOMHkds * GCOMHkds::clone ( void  ) const
virtual

Clone Housekeeping Data collection.

Returns
Pointer to deep copy of Housekeeping Data collection.

Implements GBase.

Definition at line 251 of file GCOMHkds.cpp.

References GCOMHkds().

bool GCOMHkds::contains ( const std::string &  name) const

Signals if Housekeeping parameter exists in collection.

Parameters
[in]nameHousekeeping parameter name.
Returns
True if Housekeeping parameter with specified name exists.

Searches the collection for a given Housekeeping parameter name. The method returns true if the specified name was found.

Definition at line 507 of file GCOMHkds.cpp.

References get_index().

Referenced by extend().

void GCOMHkds::copy_members ( const GCOMHkds hkds)
protected

Copy class members.

Parameters
[in]hkdsHousekeeping Data collection.

Definition at line 691 of file GCOMHkds.cpp.

References m_hkds.

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

void GCOMHkds::extend ( const GCOMHkds hkds)

Extend Housekeeping Data collection.

Parameters
[in]hkdsHousekeeping Data collection.

Extend Housekeeping Data collection by extending the container for each Housekeeping parameter.

Definition at line 525 of file GCOMHkds.cpp.

References append(), contains(), is_empty(), m_hkds, and size().

Referenced by GCOMObservation::load().

void GCOMHkds::free_members ( void  )
protected

Delete class members.

Definition at line 704 of file GCOMHkds.cpp.

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

int GCOMHkds::get_index ( const std::string &  name) const
protected

Return Housekeeping Data container index by parameter name.

Parameters
[in]nameHousekeeping parameter name.
Returns
Housekeeping parameter index (-1 if Housekeeping parameter name has not been found)

Returns Housekeeping Data container index based on the specified housekeeping parameter name. If no Housekeeping Data container with the specified name is found the method returns -1.

Definition at line 722 of file GCOMHkds.cpp.

References m_hkds, and size().

Referenced by contains(), operator[](), read(), and set().

void GCOMHkds::init_members ( void  )
protected

Initialise class members.

Definition at line 676 of file GCOMHkds.cpp.

References m_hkds.

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

GCOMHkd & GCOMHkds::insert ( const int &  index,
const GCOMHkd hkd 
)

Insert Housekeeping Data container into collection.

Parameters
[in]indexHousekeeping Data container index (0,...,size()-1).
[in]hkdHousekeeping Data container.
Returns
Reference to inserted Housekeeping Data container.
Exceptions
GException::out_of_rangeHousekeeping Data container index is out of range.

Inserts an Housekeeping Data container into the collection before the Housekeeping Data container with the specified index.

Definition at line 444 of file GCOMHkds.cpp.

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

bool GCOMHkds::is_empty ( void  ) const
inlinevirtual

Signals if there are no Housekeeping Data containers in collection.

Returns
True if collection is empty, false otherwise.

Signals if the collection does not contain any Housekeeping Data containers.

Implements GContainer.

Definition at line 166 of file GCOMHkds.hpp.

References m_hkds.

Referenced by extend(), insert(), and GCOMObservation::print().

void GCOMHkds::load ( const GFilename filename)

Load Housekeeping Data collection from FITS file.

Parameters
[in]filenameCOMPTEL HKD FITS file name.

Load a Housekeeping Data collection from a HKD FITS file into the collection.

Definition at line 561 of file GCOMHkds.cpp.

References GFits::close(), read(), and GFits::table().

Referenced by GCOMHkds().

GCOMHkds & GCOMHkds::operator= ( const GCOMHkds hkds)

Assignment operator.

Parameters
[in]hkdsHousekeeping Data collection.
Returns
Housekeeping Data collection.

Definition at line 139 of file GCOMHkds.cpp.

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

GCOMHkd & GCOMHkds::operator[] ( const int &  index)
inline

Return reference to Housekeeping Data container.

Parameters
[in]indexHousekeeping Data container index [0,...,size()-1].
Returns
Reference to Housekeeping Data container.

Returns a reference to the Housekeeping Data container with the specified index.

Definition at line 121 of file GCOMHkds.hpp.

References m_hkds.

const GCOMHkd & GCOMHkds::operator[] ( const int &  index) const
inline

Return reference to Housekeeping Data (const version)

Parameters
[in]indexHousekeeping Data container index [0,...,size()-1].
Returns
Reference to Housekeeping Data container.

Returns a reference to the Housekeeping Data container with the specified index.

Definition at line 137 of file GCOMHkds.hpp.

References m_hkds.

GCOMHkd & GCOMHkds::operator[] ( const std::string &  name)

Return reference to Housekeeping Data container.

Parameters
[in]nameHousekeeping parameter name.
Returns
Reference to Housekeeping Data container.
Exceptions
GException::invalid_argumentHousekeeping parameter with specified name not found in collection.

Returns a reference to the Housekeeping Data container with the specified name. An exception is thrown if the specified name is not found in the collection.

Definition at line 174 of file GCOMHkds.cpp.

References G_ACCESS, get_index(), and m_hkds.

const GCOMHkd & GCOMHkds::operator[] ( const std::string &  name) const

Return reference to Housekeeping Data container (const version)

Parameters
[in]nameHousekeeping parameter name.
Returns
Reference to Housekeeping Data container.
Exceptions
GException::invalid_argumentHousekeeping parameter with specified name not found in collection.

Returns a reference to the Housekeeping Data container with the specified name. An exception is thrown if the specified name is not found in the collection.

Definition at line 206 of file GCOMHkds.cpp.

References G_ACCESS, get_index(), and m_hkds.

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

Print Housekeeping Data collection.

Parameters
[in]chatterChattiness.
Returns
String containing Housekeeping Data collection information.

Implements GBase.

Definition at line 639 of file GCOMHkds.cpp.

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

Referenced by GCOMObservation::print().

void GCOMHkds::read ( const GFitsTable table)

Read Housekeeping Data collection from FITS table.

Parameters
[in]tableCOMPTEL HKD FITS table.

Reads a Housekeeping Data collection from a FITS table into the collection.

Definition at line 588 of file GCOMHkds.cpp.

References GCOMHkd::append(), append(), clear(), gammalib::com_time(), get_index(), GFitsTableCol::integer(), GFitsTable::nrows(), GFitsTableCol::real(), and GFitsTableCol::string().

Referenced by load().

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

Remove Housekeeping Data container from collection.

Parameters
[in]indexHousekeeping Data container index (0,...,size()-1).
Exceptions
GException::out_of_rangeHousekeeping Data container index is out of range.

Remove Housekeeping Data container of specified index from collection.

Implements GContainer.

Definition at line 480 of file GCOMHkds.cpp.

References G_REMOVE, m_hkds, and size().

void GCOMHkds::reserve ( const int &  num)
inlinevirtual

Reserves space for Housekeeping Data containers in collection.

Parameters
[in]numNumber of Housekeeping Data containers in collection.

Reserves space for num Housekeeping Data containers in the collection.

Implements GContainer.

Definition at line 180 of file GCOMHkds.hpp.

References m_hkds.

GCOMHkd & GCOMHkds::set ( const int &  index,
const GCOMHkd hkd 
)

Set Housekeeping Data container in collection.

Parameters
[in]indexHousekeeping Data container index [0,...,size()[.
[in]hkdHousekeeping Data container.
Returns
Reference to deep copy of Housekeeping Data container.
Exceptions
GException::out_of_rangeHousekeeping Data container index is out of range.
GException::invalid_valueHousekeeping parameter exists already in collection at other index.

Set Housekeeping Data container in the collection. Note that each housekeeping parameter can only exist once in an collection, hence an exception will be thrown if the same housekeeping parameter exists already at another index. A deep copy of the Housekeeping Data container will be made.

Definition at line 326 of file GCOMHkds.cpp.

References G_SET1, get_index(), m_hkds, GCOMHkd::name(), size(), and gammalib::str().

GCOMHkd & GCOMHkds::set ( const std::string &  name,
const GCOMHkd hkd 
)

Set Housekeeping Data container in collection.

Parameters
[in]nameHousekeeping parameter name.
[in]hkdHousekeeping Data container.
Returns
Reference to deep copy of Housekeeping Data container.
Exceptions
GException::invalid_argumentHousekeeping parameter with specified name not found in collection.
GException::invalid_valueName of Housekeeping parameter exists already in collection.

Set Housekeeping Data container in the collection replacing the container with the specified Housekeeping parameter name. Note that each housekeeping parameter can only exist once in an collection, hence an exception will be thrown if the same housekeeping parameter exists already at another index. A deep copy of the Housekeeping Data container will be made.

Definition at line 377 of file GCOMHkds.cpp.

References G_SET2, get_index(), m_hkds, GCOMHkd::name(), and gammalib::str().

int GCOMHkds::size ( void  ) const
inlinevirtual

Return number of Housekeeping parameters in collection.

Returns
Number of Housekeeping parameters in collection.

Returns the number of Housekeeping parameters in the collection.

Implements GContainer.

Definition at line 151 of file GCOMHkds.hpp.

References m_hkds.

Referenced by append(), at(), extend(), get_index(), insert(), GCOMObservation::load(), print(), remove(), and set().

Member Data Documentation

std::vector<GCOMHkd> GCOMHkds::m_hkds
protected

Housekeeping Data containers.

Definition at line 95 of file GCOMHkds.hpp.

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


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