|
GammaLib 2.2.0.dev
|
Interface definition for the observation registry class. More...
#include <GObservationRegistry.hpp>
Public Member Functions | |
| GObservationRegistry (void) | |
| Void constructor. | |
| GObservationRegistry (const GObservation *obs) | |
| Observation constructor. | |
| GObservationRegistry (const GObservationRegistry ®istry) | |
| Copy constructor. | |
| virtual | ~GObservationRegistry (void) |
| Destructor. | |
| GObservationRegistry & | operator= (const GObservationRegistry ®istry) |
| Assignment operator. | |
| std::string | classname (void) const |
| Return class name. | |
| int | size (void) const |
| Return number of registered observations. | |
| GObservation * | alloc (const std::string &name) const |
| Allocate observation of given name. | |
| std::string | name (const int &index) const |
| Returns instrument name for a specific registered observation. | |
| std::string | print (const GChatter &chatter=NORMAL) const |
| Print registry information. | |
Public Member Functions inherited from GRegistry | |
| virtual | ~GRegistry (void) |
| Destructor. | |
| std::string | content (void) const |
| Return list of names in registry. | |
Protected Member Functions | |
| void | init_members (void) |
| Initialise class members. | |
| void | copy_members (const GObservationRegistry ®istry) |
| Copy class members. | |
| void | free_members (void) |
| Delete class members. | |
Static Private Member Functions | |
| static int & | number () |
| static GRegistryPointer< std::string > & | names () |
| static GRegistryPointer< const GObservation * > & | obs () |
Interface definition for the observation registry class.
The registry class allows the registration of observations that are not necessarily compiled into the GammaLib. It uses the static members m_number, m_names, and m_obs which are allocated globally to keep track of observations that are available throughout all linked libraries. To register an observation it is sufficient to add
const GXXXObservation g_obs_XXX_seed; const GObservationRegistry g_obs_XXX_registry(&g_obs_XXX_seed);
at the top of the .cpp file of the observation. Here, XXX is a unique name that describes the instrument for which the observation class is implemented.
Definition at line 54 of file GObservationRegistry.hpp.
| GObservationRegistry::GObservationRegistry | ( | void | ) |
Void constructor.
Definition at line 55 of file GObservationRegistry.cpp.
References init_members(), names(), and size().
| GObservationRegistry::GObservationRegistry | ( | const GObservation * | obs | ) |
Observation constructor.
| [in] | obs | Observation. |
Definition at line 79 of file GObservationRegistry.cpp.
References init_members(), names(), number(), obs(), and size().
| GObservationRegistry::GObservationRegistry | ( | const GObservationRegistry & | registry | ) |
Copy constructor.
| [in] | registry | Registry. |
Definition at line 130 of file GObservationRegistry.cpp.
References copy_members(), and init_members().
|
virtual |
| GObservation * GObservationRegistry::alloc | ( | const std::string & | name | ) | const |
Allocate observation of given name.
| [in] | name | Instrument name. |
Returns a pointer to an observation instance for a specific name. If the instrument name has not been found in the registry, a NULL pointer is returned.
Definition at line 205 of file GObservationRegistry.cpp.
References GObservation::clone(), name(), names(), obs(), and size().
Referenced by GObservations::read().
|
inlinevirtual |
Return class name.
Implements GRegistry.
Definition at line 108 of file GObservationRegistry.hpp.
|
protected |
Copy class members.
| [in] | registry | Registry. |
Definition at line 304 of file GObservationRegistry.cpp.
Referenced by GObservationRegistry(), and operator=().
|
protected |
Delete class members.
Definition at line 314 of file GObservationRegistry.cpp.
Referenced by operator=(), and ~GObservationRegistry().
|
protected |
Initialise class members.
Definition at line 292 of file GObservationRegistry.cpp.
Referenced by GObservationRegistry(), GObservationRegistry(), GObservationRegistry(), and operator=().
|
virtual |
Returns instrument name for a specific registered observation.
| [in] | index | Observation index [0,...,size()[. |
| GException::out_of_range | Observation index is out of range. |
Implements GRegistry.
Definition at line 232 of file GObservationRegistry.cpp.
References G_NAME, names(), and size().
Referenced by alloc().
|
inlinestaticprivate |
Definition at line 90 of file GObservationRegistry.hpp.
Referenced by alloc(), GObservationRegistry(), GObservationRegistry(), name(), and print().
|
inlinestaticprivate |
Definition at line 85 of file GObservationRegistry.hpp.
Referenced by GObservationRegistry(), and size().
|
inlinestaticprivate |
Definition at line 95 of file GObservationRegistry.hpp.
Referenced by alloc(), GObservationRegistry(), and print().
| GObservationRegistry & GObservationRegistry::operator= | ( | const GObservationRegistry & | registry | ) |
Assignment operator.
| [in] | registry | Registry. |
Definition at line 168 of file GObservationRegistry.cpp.
References copy_members(), free_members(), and init_members().
Print registry information.
| [in] | chatter | Chattiness (defaults to NORMAL). |
Implements GRegistry.
Definition at line 253 of file GObservationRegistry.cpp.
References names(), NORMAL, obs(), gammalib::parformat(), SILENT, size(), and gammalib::str().
|
inlinevirtual |
Return number of registered observations.
Returns the number of registered observations.
Implements GRegistry.
Definition at line 122 of file GObservationRegistry.hpp.
References number().
Referenced by alloc(), GObservationRegistry(), GObservationRegistry(), name(), and print().