GammaLib
2.1.0.dev
|
Interface definition for the CTA radial model registry class. More...
#include <GCTAModelRadialRegistry.hpp>
Public Member Functions | |
GCTAModelRadialRegistry (void) | |
Void constructor. More... | |
GCTAModelRadialRegistry (const GCTAModelRadial *model) | |
Model constructor. More... | |
GCTAModelRadialRegistry (const GCTAModelRadialRegistry ®istry) | |
Copy constructor. More... | |
virtual | ~GCTAModelRadialRegistry (void) |
Destructor. More... | |
GCTAModelRadialRegistry & | operator= (const GCTAModelRadialRegistry ®istry) |
Assignment operator. More... | |
std::string | classname (void) const |
Return class name. More... | |
int | size (void) const |
Return number of registered models. More... | |
GCTAModelRadial * | alloc (const std::string &name) const |
Allocate radial model of given name. 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 GCTAModelRadialRegistry ®istry) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
Static Private Member Functions | |
static int & | number () |
static GRegistryPointer < std::string > & | names () |
static GRegistryPointer< const GCTAModelRadial * > & | models () |
Interface definition for the CTA radial model registry class.
The registry class allows the registration of radial models for CTA that are not necessarily compiled into the GammaLib. It uses the static members m_number, m_names, and m_models which are allocated globally to keep track of radial models that are available throughout all linked libraries. To register a radial model it is sufficient to add
const GCTAModelRadialXXX g_cta_radial_XXX_seed; const GCTAModelRadialRegistry g_cta_radial_XXX_registry(&g_cta_radial_XXX_seed);
at the top of the .cpp file of the radial model. Here, XXX is a unique name that describes the model.
Definition at line 53 of file GCTAModelRadialRegistry.hpp.
GCTAModelRadialRegistry::GCTAModelRadialRegistry | ( | void | ) |
Void constructor.
Definition at line 55 of file GCTAModelRadialRegistry.cpp.
References init_members(), names(), and size().
GCTAModelRadialRegistry::GCTAModelRadialRegistry | ( | const GCTAModelRadial * | model | ) |
Model constructor.
[in] | model | Model. |
Definition at line 79 of file GCTAModelRadialRegistry.cpp.
References init_members(), models(), names(), number(), size(), and GCTAModelRadial::type().
GCTAModelRadialRegistry::GCTAModelRadialRegistry | ( | const GCTAModelRadialRegistry & | registry | ) |
Copy constructor.
[in] | registry | Registry. |
Definition at line 130 of file GCTAModelRadialRegistry.cpp.
References copy_members(), and init_members().
|
virtual |
GCTAModelRadial * GCTAModelRadialRegistry::alloc | ( | const std::string & | name | ) | const |
Allocate radial model of given name.
[in] | name | Radial model name. |
Returns a pointer to a radial model instance of the specified name. If the name has not been found in the registry, a NULL pointer is returned.
Definition at line 204 of file GCTAModelRadialRegistry.cpp.
References models(), name(), names(), and size().
Referenced by GCTAModelRadialAcceptance::xml_radial().
|
inlinevirtual |
Return class name.
Implements GRegistry.
Definition at line 107 of file GCTAModelRadialRegistry.hpp.
|
protected |
Copy class members.
[in] | registry | Registry. |
Definition at line 301 of file GCTAModelRadialRegistry.cpp.
Referenced by GCTAModelRadialRegistry(), and operator=().
|
protected |
Delete class members.
Definition at line 311 of file GCTAModelRadialRegistry.cpp.
Referenced by operator=(), and ~GCTAModelRadialRegistry().
|
protected |
Initialise class members.
Definition at line 289 of file GCTAModelRadialRegistry.cpp.
Referenced by GCTAModelRadialRegistry(), and operator=().
|
inlinestaticprivate |
Definition at line 94 of file GCTAModelRadialRegistry.hpp.
Referenced by alloc(), GCTAModelRadialRegistry(), 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 231 of file GCTAModelRadialRegistry.cpp.
References G_NAME, names(), and size().
Referenced by alloc().
|
inlinestaticprivate |
Definition at line 89 of file GCTAModelRadialRegistry.hpp.
Referenced by alloc(), GCTAModelRadialRegistry(), name(), and print().
|
inlinestaticprivate |
Definition at line 84 of file GCTAModelRadialRegistry.hpp.
Referenced by GCTAModelRadialRegistry(), and size().
GCTAModelRadialRegistry & GCTAModelRadialRegistry::operator= | ( | const GCTAModelRadialRegistry & | registry | ) |
Assignment operator.
[in] | registry | Registry. |
Definition at line 168 of file GCTAModelRadialRegistry.cpp.
References copy_members(), free_members(), and init_members().
Print registry information.
[in] | chatter | Chattiness (defaults to NORMAL). |
Implements GRegistry.
Definition at line 251 of file GCTAModelRadialRegistry.cpp.
References models(), names(), 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 121 of file GCTAModelRadialRegistry.hpp.
References number().
Referenced by alloc(), GCTAModelRadialRegistry(), name(), and print().