GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GRegistry Class Referenceabstract

Interface class for registries. More...

#include <GRegistry.hpp>

Inheritance diagram for GRegistry:
GCTAModelRadialRegistry GCTAModelSpatialRegistry GModelRegistry GModelSpatialRegistry GModelSpectralRegistry GModelTemporalRegistry GObservationRegistry GWcsRegistry

Public Member Functions

virtual ~GRegistry (void)
 Destructor. More...
 
virtual std::string classname (void) const =0
 Return class name. More...
 
virtual int size (void) const =0
 Return number of classes in registry. More...
 
virtual std::string name (const int &index) const =0
 Return name of registered class by index. More...
 
virtual std::string print (const GChatter &chatter=NORMAL) const =0
 Print content of object. More...
 

Detailed Description

Interface class for registries.

This class defines the interface for registries. A registry is a container class that contains instance of derived classes. For example, if three different derived classes exist for a given base class, the registry will contain one instance for each derived class. Using the clone mechanism, the registry may thus provide a new instance of a given derived class, depending on the type of the derived class.

The interface class requires the implementation of the following methods for all registry classes:

size(void) Number of elements in registry class

name(const int& index) Name of registered class by index

print() Print content of registry

Definition at line 101 of file GRegistry.hpp.

Constructor & Destructor Documentation

virtual GRegistry::~GRegistry ( void  )
inlinevirtual

Destructor.

Destroys class.

Definition at line 107 of file GRegistry.hpp.

Member Function Documentation

virtual std::string GRegistry::classname ( void  ) const
pure virtual

Return class name.

Returns
String containing the class name.

Returns the class name for non-abstract classes in a human readable way.

Implemented in GModelSpatialRegistry, GModelSpectralRegistry, GModelTemporalRegistry, GCTAModelSpatialRegistry, GObservationRegistry, GModelRegistry, GWcsRegistry, and GCTAModelRadialRegistry.

virtual std::string GRegistry::name ( const int &  index) const
pure virtual

Return name of registered class by index.

Parameters
[in]indexClass index [0,...,size()-1]

Returns the name of a registered class, specified by its index in the registry.

Implemented in GModelSpatialRegistry, GModelSpectralRegistry, GModelTemporalRegistry, GCTAModelSpatialRegistry, GObservationRegistry, GWcsRegistry, GModelRegistry, and GCTAModelRadialRegistry.

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

Print content of object.

Returns
String containing the content of the object.

Formats the content in a standard way and puts this content in a C++ string that is returned.

Implemented in GModelSpatialRegistry, GModelSpectralRegistry, GModelTemporalRegistry, GCTAModelSpatialRegistry, GWcsRegistry, GObservationRegistry, GModelRegistry, and GCTAModelRadialRegistry.

Referenced by operator<<().

virtual int GRegistry::size ( void  ) const
pure virtual

Return number of classes in registry.

Returns the number of classes that have been registered in the registry.

Implemented in GModelSpatialRegistry, GModelSpectralRegistry, GModelTemporalRegistry, GCTAModelSpatialRegistry, GObservationRegistry, GModelRegistry, GWcsRegistry, and GCTAModelRadialRegistry.


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