GammaLib
2.1.0.dev
|
Spectral table model parameter container class. More...
#include <GModelSpectralTablePars.hpp>
Public Member Functions | |
GModelSpectralTablePars (void) | |
Void constructor. More... | |
GModelSpectralTablePars (const GModelSpectralTablePars &pars) | |
Copy constructor. More... | |
virtual | ~GModelSpectralTablePars (void) |
Destructor. More... | |
GModelSpectralTablePars & | operator= (const GModelSpectralTablePars &pars) |
Assignment operator. More... | |
GModelSpectralTablePar * | operator[] (const int &index) |
Return pointer to table model parameter. More... | |
const GModelSpectralTablePar * | operator[] (const int &index) const |
Return pointer to table model parameter (const version) More... | |
GModelSpectralTablePar * | operator[] (const std::string &name) |
Return pointer to table model parameter. More... | |
const GModelSpectralTablePar * | operator[] (const std::string &name) const |
Return pointer to table model parameter (const version) More... | |
void | clear (void) |
Clear table model parameters. More... | |
GModelSpectralTablePars * | clone (void) const |
Clone table model parameters. More... | |
std::string | classname (void) const |
Return class name. More... | |
GModelSpectralTablePar * | at (const int &index) |
Return pointer to table model parameter. More... | |
const GModelSpectralTablePar * | at (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... | |
GModelSpectralTablePar * | set (const int &index, const GModelSpectralTablePar &par) |
Set table model parameter in container. More... | |
GModelSpectralTablePar * | set (const std::string &name, const GModelSpectralTablePar &par) |
Set table model parameter in container. More... | |
GModelSpectralTablePar * | append (const GModelSpectralTablePar &par) |
Append table model parameter to container. More... | |
GModelSpectralTablePar * | insert (const int &index, const GModelSpectralTablePar &par) |
Insert table model parameter into container. More... | |
GModelSpectralTablePar * | insert (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... | |
Spectral table model parameter container class.
Definition at line 44 of file GModelSpectralTablePars.hpp.
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.
[in] | pars | Table model parameters. |
Definition at line 86 of file GModelSpectralTablePars.cpp.
References copy_members(), and init_members().
|
virtual |
GModelSpectralTablePar * GModelSpectralTablePars::append | ( | const GModelSpectralTablePar & | par | ) |
Append table model parameter to container.
[in] | par | Table model parameter. |
GException::invalid_argument | Name 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.
[in] | index | Parameter index [0,...,size()-1]. |
GException::out_of_range | Table 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.
const GModelSpectralTablePar * GModelSpectralTablePars::at | ( | const int & | index | ) | const |
Return pointer to table model parameter (const version)
[in] | index | Parameter index [0,...,size()-1]. |
GException::out_of_range | Table 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.
|
inlinevirtual |
Return class name.
Implements GBase.
Definition at line 101 of file GModelSpectralTablePars.hpp.
|
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().
|
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.
[in] | name | Table model parameter name. |
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().
|
protected |
Copy class members.
[in] | pars | Table 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.
[in] | pars | Table 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().
|
protected |
Delete class members.
Definition at line 671 of file GModelSpectralTablePars.cpp.
References m_pars.
Referenced by clear(), operator=(), and ~GModelSpectralTablePars().
|
protected |
Return parameter index by name.
[in] | name | Parameter name. |
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().
|
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.
[in] | index | Table model parameter index [0,...,size()[. |
[in] | par | Table model parameter. |
GException::out_of_range | Model index is out of range. |
GException::invalid_value | Name 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.
[in] | name | Table model parameter name. |
[in] | par | Table model parameter. |
GException::invalid_argument | Table 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().
|
inlinevirtual |
Signals if there are no table model parameters in container.
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.
GModelSpectralTablePars & GModelSpectralTablePars::operator= | ( | const GModelSpectralTablePars & | pars | ) |
Assignment operator.
[in] | pars | Table model parameters. |
Definition at line 124 of file GModelSpectralTablePars.cpp.
References copy_members(), free_members(), and init_members().
|
inline |
Return pointer to table model parameter.
[in] | index | Table 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.
|
inline |
Return pointer to table model parameter (const version)
[in] | index | Table 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.
|
inline |
Return pointer to table model parameter.
[in] | name | Table 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)
[in] | name | Table model parameter name. |
GException::invalid_argument | Table 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.
Print table model parameters.
[in] | chatter | Chattiness. |
Implements GBase.
Definition at line 606 of file GModelSpectralTablePars.cpp.
References m_pars, gammalib::parformat(), SILENT, size(), and gammalib::str().
|
virtual |
Remove table model parameter from container.
[in] | index | Table model parameter index [0,...,size()[. |
GException::out_of_range | Table 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.
void GModelSpectralTablePars::remove | ( | const std::string & | name | ) |
Remove table model parameter from container.
[in] | name | Table model parameter name. |
GException::invalid_argument | Table 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().
|
inlinevirtual |
Reserves space for table model parameters in container.
[in] | num | Number 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.
[in] | index | Table model parameter index [0,...,size()[. |
[in] | par | Table model parameter. |
GException::out_of_range | Table model parameter index is out of range. |
GException::invalid_value | Name 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.
[in] | name | Table model parameter name. |
[in] | par | Table model parameter. |
GException::invalid_argument | Table 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().
|
inlinevirtual |
Return 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::energy_scale(), GModelSpectralTable::eval(), extend(), get_index(), GModelSpectralTable::GModelSpectralTable(), insert(), GModelSpectralTable::nspectra(), print(), GModelSpectralTable::print(), GModelSpectralTable::read(), remove(), GModelSpectralTable::scale_energy(), set(), GModelSpectralTable::set_par_pointers(), GModelSpectralTable::update(), and GModelSpectralTable::write().
|
protected |
List of parameters.
Definition at line 91 of file GModelSpectralTablePars.hpp.
Referenced by append(), at(), copy_members(), extend(), free_members(), get_index(), init_members(), insert(), is_empty(), operator[](), print(), remove(), reserve(), set(), and size().