GammaLib
2.1.0.dev
|
Interface class for registries. More...
#include <GRegistry.hpp>
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... | |
std::string | content (void) const |
Return list of names in registry. More... | |
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.
|
inlinevirtual |
|
pure virtual |
Return 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.
std::string GRegistry::content | ( | void | ) | const |
Return list of names in registry.
Definition at line 54 of file GRegistry.cpp.
References name(), and size().
Referenced by GSkyMap::alloc_wcs(), GObservations::read(), GModels::read(), and GSkyMap::set_wcs().
|
pure virtual |
Return name of registered class by index.
[in] | index | Class 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.
Referenced by content().
Print content of 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, GObservationRegistry, GWcsRegistry, GModelRegistry, and GCTAModelRadialRegistry.
Referenced by operator<<().
|
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.
Referenced by content().