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

Interface definition for the CTA radial model registry class. More...

#include <GCTAModelRadialRegistry.hpp>

Inheritance diagram for GCTAModelRadialRegistry:
GRegistry

Public Member Functions

 GCTAModelRadialRegistry (void)
 Void constructor. More...
 
 GCTAModelRadialRegistry (const GCTAModelRadial *model)
 Model constructor. More...
 
 GCTAModelRadialRegistry (const GCTAModelRadialRegistry &registry)
 Copy constructor. More...
 
virtual ~GCTAModelRadialRegistry (void)
 Destructor. More...
 
GCTAModelRadialRegistryoperator= (const GCTAModelRadialRegistry &registry)
 Assignment operator. More...
 
std::string classname (void) const
 Return class name. More...
 
int size (void) const
 Return number of registered models. More...
 
GCTAModelRadialalloc (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 &registry)
 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 ()
 

Detailed Description

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.

Constructor & Destructor Documentation

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.

Parameters
[in]modelModel.

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.

Parameters
[in]registryRegistry.

Definition at line 130 of file GCTAModelRadialRegistry.cpp.

References copy_members(), and init_members().

GCTAModelRadialRegistry::~GCTAModelRadialRegistry ( void  )
virtual

Destructor.

Definition at line 146 of file GCTAModelRadialRegistry.cpp.

References free_members().

Member Function Documentation

GCTAModelRadial * GCTAModelRadialRegistry::alloc ( const std::string &  name) const

Allocate radial model of given name.

Parameters
[in]nameRadial 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().

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

Return class name.

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

Implements GRegistry.

Definition at line 107 of file GCTAModelRadialRegistry.hpp.

void GCTAModelRadialRegistry::copy_members ( const GCTAModelRadialRegistry registry)
protected

Copy class members.

Parameters
[in]registryRegistry.

Definition at line 301 of file GCTAModelRadialRegistry.cpp.

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

void GCTAModelRadialRegistry::free_members ( void  )
protected

Delete class members.

Definition at line 311 of file GCTAModelRadialRegistry.cpp.

Referenced by operator=(), and ~GCTAModelRadialRegistry().

void GCTAModelRadialRegistry::init_members ( void  )
protected

Initialise class members.

Definition at line 289 of file GCTAModelRadialRegistry.cpp.

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

static GRegistryPointer<const GCTAModelRadial*>& GCTAModelRadialRegistry::models ( void  )
inlinestaticprivate

Definition at line 94 of file GCTAModelRadialRegistry.hpp.

Referenced by alloc(), GCTAModelRadialRegistry(), and print().

std::string GCTAModelRadialRegistry::name ( const int &  index) const
virtual

Returns model name.

Parameters
[in]indexModel index [0,...,size()-1].
Returns
Model name.
Exceptions
GException::out_of_rangeModel index is out of range.

Implements GRegistry.

Definition at line 231 of file GCTAModelRadialRegistry.cpp.

References G_NAME, names(), and size().

Referenced by alloc().

static GRegistryPointer<std::string>& GCTAModelRadialRegistry::names ( )
inlinestaticprivate

Definition at line 89 of file GCTAModelRadialRegistry.hpp.

Referenced by alloc(), GCTAModelRadialRegistry(), name(), and print().

static int& GCTAModelRadialRegistry::number ( void  )
inlinestaticprivate

Definition at line 84 of file GCTAModelRadialRegistry.hpp.

Referenced by GCTAModelRadialRegistry(), and size().

GCTAModelRadialRegistry & GCTAModelRadialRegistry::operator= ( const GCTAModelRadialRegistry registry)

Assignment operator.

Parameters
[in]registryRegistry.
Returns
Reference to registry.

Definition at line 168 of file GCTAModelRadialRegistry.cpp.

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

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

Print registry information.

Parameters
[in]chatterChattiness (defaults to NORMAL).
Returns
String containing registry information.

Implements GRegistry.

Definition at line 251 of file GCTAModelRadialRegistry.cpp.

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

int GCTAModelRadialRegistry::size ( void  ) const
inlinevirtual

Return number of registered models.

Returns
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().


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