GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GModelSpectralTablePars Class Reference

Spectral table model parameter container class. More...

#include <GModelSpectralTablePars.hpp>

Inheritance diagram for GModelSpectralTablePars:
GContainer GBase

Public Member Functions

 GModelSpectralTablePars (void)
 Void constructor. More...
 
 GModelSpectralTablePars (const GModelSpectralTablePars &pars)
 Copy constructor. More...
 
virtual ~GModelSpectralTablePars (void)
 Destructor. More...
 
GModelSpectralTableParsoperator= (const GModelSpectralTablePars &pars)
 Assignment operator. More...
 
GModelSpectralTableParoperator[] (const int &index)
 Return pointer to table model parameter. More...
 
const GModelSpectralTableParoperator[] (const int &index) const
 Return pointer to table model parameter (const version) More...
 
GModelSpectralTableParoperator[] (const std::string &name)
 Return pointer to table model parameter. More...
 
const GModelSpectralTableParoperator[] (const std::string &name) const
 Return pointer to table model parameter (const version) More...
 
void clear (void)
 Clear table model parameters. More...
 
GModelSpectralTableParsclone (void) const
 Clone table model parameters. More...
 
std::string classname (void) const
 Return class name. More...
 
GModelSpectralTableParat (const int &index)
 Return pointer to table model parameter. More...
 
const GModelSpectralTableParat (const int &index) const
 Return pointer to table model parameter (const version) More...
 
int size (void) const
 Return number of table model parameters in container. More...
 
bool is_empty (void) const
 Signals if there are no table model parameters in container. More...
 
GModelSpectralTableParset (const int &index, const GModelSpectralTablePar &par)
 Set table model parameter in container. More...
 
GModelSpectralTableParset (const std::string &name, const GModelSpectralTablePar &par)
 Set table model parameter in container. More...
 
GModelSpectralTableParappend (const GModelSpectralTablePar &par)
 Append table model parameter to container. More...
 
GModelSpectralTableParinsert (const int &index, const GModelSpectralTablePar &par)
 Insert table model parameter into container. More...
 
GModelSpectralTableParinsert (const std::string &name, const GModelSpectralTablePar &par)
 Insert table model parameter into container. More...
 
void remove (const int &index)
 Remove table model parameter from container. More...
 
void remove (const std::string &name)
 Remove table model parameter from container. More...
 
void reserve (const int &num)
 Reserves space for table model parameters in container. More...
 
void extend (const GModelSpectralTablePars &pars)
 Append table model parameter container. More...
 
bool contains (const std::string &name) const
 Signals if table model parameter exists. More...
 
std::string print (const GChatter &chatter=NORMAL) const
 Print table model parameters. 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 GModelSpectralTablePars &model)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
int get_index (const std::string &name) const
 Return parameter index by name. More...
 

Protected Attributes

std::vector
< GModelSpectralTablePar * > 
m_pars
 List of parameters. More...
 

Detailed Description

Spectral table model parameter container class.

Definition at line 44 of file GModelSpectralTablePars.hpp.

Constructor & Destructor Documentation

GModelSpectralTablePars::GModelSpectralTablePars ( void  )

Void constructor.

Definition at line 71 of file GModelSpectralTablePars.cpp.

References init_members().

Referenced by clone().

GModelSpectralTablePars::GModelSpectralTablePars ( const GModelSpectralTablePars pars)

Copy constructor.

Parameters
[in]parsTable model parameters.

Definition at line 86 of file GModelSpectralTablePars.cpp.

References copy_members(), and init_members().

GModelSpectralTablePars::~GModelSpectralTablePars ( void  )
virtual

Destructor.

Definition at line 102 of file GModelSpectralTablePars.cpp.

References free_members().

Member Function Documentation

GModelSpectralTablePar * GModelSpectralTablePars::append ( const GModelSpectralTablePar par)

Append table model parameter to container.

Parameters
[in]parTable model parameter.
Returns
Pointer to deep copy of table model parameter.
Exceptions
GException::invalid_argumentName of table model parameter exists already in container.

Appends table model parameter to the container by making a deep copy of the table model parameter and storing its pointer.

Definition at line 357 of file GModelSpectralTablePars.cpp.

References GModelSpectralTablePar::clone(), G_APPEND, get_index(), m_pars, GOptimizerPar::name(), GModelSpectralTablePar::par(), and gammalib::str().

Referenced by GModelSpectralTable::load_par(), and GModelSpectralTable::print().

GModelSpectralTablePar * GModelSpectralTablePars::at ( const int &  index)

Return pointer to table model parameter.

Parameters
[in]indexParameter index [0,...,size()-1].
Exceptions
GException::out_of_rangeTable model parameter index is out of range.

Returns a pointer to the table model parameter with the specified index.

Definition at line 217 of file GModelSpectralTablePars.cpp.

References G_AT, m_pars, and size().

const GModelSpectralTablePar * GModelSpectralTablePars::at ( const int &  index) const

Return pointer to table model parameter (const version)

Parameters
[in]indexParameter index [0,...,size()-1].
Exceptions
GException::out_of_rangeTable model parameter index is out of range.

Returns a pointer to the table model parameter with the specified index.

Definition at line 242 of file GModelSpectralTablePars.cpp.

References G_AT, m_pars, and size().

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

Return class name.

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

Implements GBase.

Definition at line 101 of file GModelSpectralTablePars.hpp.

void GModelSpectralTablePars::clear ( void  )
virtual

Clear table model parameters.

Implements GBase.

Definition at line 183 of file GModelSpectralTablePars.cpp.

References free_members(), and init_members().

Referenced by GModelSpectralTable::init_members().

GModelSpectralTablePars * GModelSpectralTablePars::clone ( void  ) const
virtual

Clone table model parameters.

Implements GBase.

Definition at line 199 of file GModelSpectralTablePars.cpp.

References GModelSpectralTablePars().

Referenced by extend().

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

Signals if table model parameter exists.

Parameters
[in]nameTable model parameter name.
Returns
True if table model parameter with specified name exists.

Searches all table model parameters for a match with the specified name. If the specified name has been found, true is returned.

Definition at line 590 of file GModelSpectralTablePars.cpp.

References get_index().

void GModelSpectralTablePars::copy_members ( const GModelSpectralTablePars pars)
protected

Copy class members.

Parameters
[in]parsTable model parameters.

Definition at line 655 of file GModelSpectralTablePars.cpp.

References m_pars.

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

void GModelSpectralTablePars::extend ( const GModelSpectralTablePars pars)

Append table model parameter container.

Parameters
[in]parsTable model parameter container.

Append table model parameter container to the container.

Definition at line 539 of file GModelSpectralTablePars.cpp.

References clone(), G_EXTEND, get_index(), is_empty(), m_pars, reserve(), size(), and gammalib::str().

void GModelSpectralTablePars::free_members ( void  )
protected

Delete class members.

Definition at line 671 of file GModelSpectralTablePars.cpp.

References m_pars.

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

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

Return parameter index by name.

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

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

Definition at line 693 of file GModelSpectralTablePars.cpp.

References m_pars, and size().

Referenced by append(), contains(), extend(), insert(), operator[](), remove(), and set().

void GModelSpectralTablePars::init_members ( void  )
protected

Initialise class members.

Definition at line 640 of file GModelSpectralTablePars.cpp.

References m_pars.

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

GModelSpectralTablePar * GModelSpectralTablePars::insert ( const int &  index,
const GModelSpectralTablePar par 
)

Insert table model parameter into container.

Parameters
[in]indexTable model parameter index [0,...,size()[.
[in]parTable model parameter.
Returns
Pointer to deep copy of table model parameter.
Exceptions
GException::out_of_rangeModel index is out of range.
GException::invalid_valueName of model exists already in container.

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

Definition at line 397 of file GModelSpectralTablePars.cpp.

References GModelSpectralTablePar::clone(), G_INSERT1, get_index(), is_empty(), m_pars, GOptimizerPar::name(), GModelSpectralTablePar::par(), size(), and gammalib::str().

Referenced by insert().

GModelSpectralTablePar * GModelSpectralTablePars::insert ( const std::string &  name,
const GModelSpectralTablePar par 
)

Insert table model parameter into container.

Parameters
[in]nameTable model parameter name.
[in]parTable model parameter.
Returns
Pointer to deep copy of table model parameter.
Exceptions
GException::invalid_argumentTable model parameter with name not found.

Inserts a table model parameter into the container before the table model parameter with the specified name.

Definition at line 453 of file GModelSpectralTablePars.cpp.

References G_INSERT2, get_index(), and insert().

bool GModelSpectralTablePars::is_empty ( void  ) const
inlinevirtual

Signals if there are no table model parameters in container.

Returns
True if container is empty, false otherwise.

Signals if the table model parameters container does not contain any table model parameter.

Implements GContainer.

Definition at line 174 of file GModelSpectralTablePars.hpp.

References m_pars.

Referenced by extend(), and insert().

GModelSpectralTablePars & GModelSpectralTablePars::operator= ( const GModelSpectralTablePars pars)

Assignment operator.

Parameters
[in]parsTable model parameters.
Returns
Table model parameters.

Definition at line 124 of file GModelSpectralTablePars.cpp.

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

GModelSpectralTablePar * GModelSpectralTablePars::operator[] ( const int &  index)
inline

Return pointer to table model parameter.

Parameters
[in]indexTable model parameter index [0,...,size()-1].

Returns a pointer to the table model parameter with the specified index.

Definition at line 116 of file GModelSpectralTablePars.hpp.

References m_pars.

const GModelSpectralTablePar * GModelSpectralTablePars::operator[] ( const int &  index) const
inline

Return pointer to table model parameter (const version)

Parameters
[in]indexTable model parameter index [0,...,size()-1].

Returns a const pointer to the table model parameter with the specified index.

Definition at line 131 of file GModelSpectralTablePars.hpp.

References m_pars.

GModelSpectralTablePar * GModelSpectralTablePars::operator[] ( const std::string &  name)
inline

Return pointer to table model parameter.

Parameters
[in]nameTable model parameter name.

Returns a pointer to the table model parameter with the specified name.

Definition at line 145 of file GModelSpectralTablePars.hpp.

const GModelSpectralTablePar * GModelSpectralTablePars::operator[] ( const std::string &  name) const

Return pointer to table model parameter (const version)

Parameters
[in]nameTable model parameter name.
Exceptions
GException::invalid_argumentTable model parameter with specified name not found in container.

Returns a const pointer to the table model parameter with the specified name.

Definition at line 157 of file GModelSpectralTablePars.cpp.

References G_ACCESS, get_index(), and m_pars.

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

Print table model parameters.

Parameters
[in]chatterChattiness.
Returns
String containing file table model parameters information.

Implements GBase.

Definition at line 606 of file GModelSpectralTablePars.cpp.

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

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

Remove table model parameter from container.

Parameters
[in]indexTable model parameter index [0,...,size()[.
Exceptions
GException::out_of_rangeTable model parameter index is out of range.

Remove table model parameter of specified index from container.

Implements GContainer.

Definition at line 481 of file GModelSpectralTablePars.cpp.

References G_REMOVE1, m_pars, and size().

void GModelSpectralTablePars::remove ( const std::string &  name)

Remove table model parameter from container.

Parameters
[in]nameTable model parameter name.
Exceptions
GException::invalid_argumentTable model parameter with name not found.

Remove table model parameter with name from container.

Definition at line 512 of file GModelSpectralTablePars.cpp.

References G_REMOVE2, and get_index().

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

Reserves space for table model parameters in container.

Parameters
[in]numNumber of table model parameters

Reserves space for num table model parameters in the container.

Implements GContainer.

Definition at line 188 of file GModelSpectralTablePars.hpp.

References m_pars.

Referenced by extend().

GModelSpectralTablePar * GModelSpectralTablePars::set ( const int &  index,
const GModelSpectralTablePar par 
)

Set table model parameter in container.

Parameters
[in]indexTable model parameter index [0,...,size()[.
[in]parTable model parameter.
Returns
Pointer to deep copy of table model parameter.
Exceptions
GException::out_of_rangeTable model parameter index is out of range.
GException::invalid_valueName of table model parameter exists already in container.

Set table model parameter at position index in the container. The method will overwrite the table model parameter that existed in the specified slot. The method will store a deep copy of the table model parameter in the container.

Definition at line 273 of file GModelSpectralTablePars.cpp.

References GModelSpectralTablePar::clone(), G_SET1, get_index(), m_pars, GOptimizerPar::name(), GModelSpectralTablePar::par(), size(), and gammalib::str().

Referenced by set().

GModelSpectralTablePar * GModelSpectralTablePars::set ( const std::string &  name,
const GModelSpectralTablePar par 
)

Set table model parameter in container.

Parameters
[in]nameTable model parameter name.
[in]parTable model parameter.
Returns
Pointer to deep copy of table model parameter.
Exceptions
GException::invalid_argumentTable model parameter with name not found.

Set table model parameter at the position of the parameter with the specified name in the container. The method will overwrite the table model parameter with the specified name. The method will store a deep copy of the table model parameter in the container.

Definition at line 327 of file GModelSpectralTablePars.cpp.

References G_SET2, get_index(), and set().

int GModelSpectralTablePars::size ( void  ) const
inlinevirtual

Return number of table model parameters in container.

Returns
Number of table model parameters in container.

Returns the number of table model parameters in the model container.

Implements GContainer.

Definition at line 159 of file GModelSpectralTablePars.hpp.

References m_pars.

Referenced by at(), GModelSpectralTable::create_par_table(), GModelSpectralTable::create_spec_table(), GModelSpectralTable::eval(), extend(), get_index(), GModelSpectralTable::GModelSpectralTable(), insert(), print(), GModelSpectralTable::print(), GModelSpectralTable::read(), remove(), set(), GModelSpectralTable::set_par_pointers(), GModelSpectralTable::update(), and GModelSpectralTable::write().

Member Data Documentation

std::vector<GModelSpectralTablePar*> GModelSpectralTablePars::m_pars
protected

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