GammaLib
2.1.0.dev
|
Interface definition for the temporal model registry class. More...
#include <GModelTemporalRegistry.hpp>
Public Member Functions | |
GModelTemporalRegistry (void) | |
Void constructor. More... | |
GModelTemporalRegistry (const GModelTemporal *model) | |
Model constructor. More... | |
GModelTemporalRegistry (const GModelTemporalRegistry ®istry) | |
Copy constructor. More... | |
virtual | ~GModelTemporalRegistry (void) |
Destructor. More... | |
GModelTemporalRegistry & | operator= (const GModelTemporalRegistry ®istry) |
Assignment operator. More... | |
std::string | classname (void) const |
Return class name. More... | |
int | size (void) const |
Return number of registered models. More... | |
GModelTemporal * | alloc (const GXmlElement &xml) const |
Allocate temporal model that is found in XML element. More... | |
std::string | name (const int &index) const |
Returns model name. More... | |
std::string | print (const GChatter &chatter=NORMAL) const |
Print registry information. More... | |
Public Member Functions inherited from GRegistry | |
virtual | ~GRegistry (void) |
Destructor. More... | |
std::string | content (void) const |
Return list of names in registry. More... | |
Protected Member Functions | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GModelTemporalRegistry ®istry) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
Static Private Member Functions | |
static int & | number () |
static GRegistryPointer< const GModelTemporal * > & | models () |
Interface definition for the temporal model registry class.
The registry class allows the registration of temporal models that are not necessarily compiled into the GammaLib. It uses the static members m_number and m_models which are allocated globally to keep track of temporal models that are available throughout all linked libraries. To register a temporal model it is sufficient to add
const GModelTemporalXXX g_temporal_XXX_seed; const GModelTemporalRegistry g_temporal_XXX_registry(&g_spectral_XXX_seed);
at the top of the .cpp file of the temporal model. Here, XXX is a unique name that describes the model.
Definition at line 56 of file GModelTemporalRegistry.hpp.
GModelTemporalRegistry::GModelTemporalRegistry | ( | void | ) |
Void constructor.
Definition at line 58 of file GModelTemporalRegistry.cpp.
References init_members(), models(), and size().
GModelTemporalRegistry::GModelTemporalRegistry | ( | const GModelTemporal * | model | ) |
Model constructor.
[in] | model | Model. |
Construct registry by adding a model to the registry. This is the standard constructor that is used to register a new model to GammaLib.
Definition at line 85 of file GModelTemporalRegistry.cpp.
References init_members(), models(), number(), size(), and GModelTemporal::type().
GModelTemporalRegistry::GModelTemporalRegistry | ( | const GModelTemporalRegistry & | registry | ) |
Copy constructor.
[in] | registry | Registry. |
Definition at line 132 of file GModelTemporalRegistry.cpp.
References copy_members(), and init_members().
|
virtual |
GModelTemporal * GModelTemporalRegistry::alloc | ( | const GXmlElement & | xml | ) | const |
Allocate temporal model that is found in XML element.
[in] | xml | XML element. |
GException::invalid_value | No appropriate temporal model found in XML element. |
Returns a pointer to a temporal model instance that corresponds to the type found in an XML element. If no appropriate model is found the method will throw an exception.
Definition at line 210 of file GModelTemporalRegistry.cpp.
References GXmlElement::attribute(), G_ALLOC, models(), GModelTemporal::read(), and size().
Referenced by GCTAModelIrfBackground::xml_temporal(), GCTAModelAeffBackground::xml_temporal(), GCTAModelCubeBackground::xml_temporal(), GCTAModelRadialAcceptance::xml_temporal(), GCTAModelBackground::xml_temporal(), GCTAModelSkyCube::xml_temporal(), and GModelSky::xml_temporal().
|
inlinevirtual |
Return class name.
Implements GRegistry.
Definition at line 105 of file GModelTemporalRegistry.hpp.
|
protected |
Copy class members.
[in] | registry | Registry. |
Definition at line 331 of file GModelTemporalRegistry.cpp.
Referenced by GModelTemporalRegistry(), and operator=().
|
protected |
Delete class members.
Definition at line 341 of file GModelTemporalRegistry.cpp.
Referenced by operator=(), and ~GModelTemporalRegistry().
|
protected |
Initialise class members.
Definition at line 319 of file GModelTemporalRegistry.cpp.
Referenced by GModelTemporalRegistry(), and operator=().
|
inlinestaticprivate |
Definition at line 92 of file GModelTemporalRegistry.hpp.
Referenced by alloc(), GModelTemporalRegistry(), name(), and print().
|
virtual |
Returns model name.
[in] | index | Model index [0,...,size()-1]. |
GException::out_of_range | Model index is out of range. |
Implements GRegistry.
Definition at line 252 of file GModelTemporalRegistry.cpp.
References G_NAME, models(), and size().
Referenced by print().
|
inlinestaticprivate |
Definition at line 87 of file GModelTemporalRegistry.hpp.
Referenced by GModelTemporalRegistry(), and size().
GModelTemporalRegistry & GModelTemporalRegistry::operator= | ( | const GModelTemporalRegistry & | registry | ) |
Assignment operator.
[in] | registry | Registry. |
Definition at line 170 of file GModelTemporalRegistry.cpp.
References copy_members(), free_members(), and init_members().
Print registry information.
[in] | chatter | Chattiness. |
Implements GRegistry.
Definition at line 273 of file GModelTemporalRegistry.cpp.
References models(), name(), NORMAL, gammalib::parformat(), SILENT, size(), and gammalib::str().
|
inlinevirtual |
Return number of registered models.
Returns the number of registered model.
Implements GRegistry.
Definition at line 119 of file GModelTemporalRegistry.hpp.
References number().
Referenced by alloc(), GModelTemporalRegistry(), name(), and print().