GammaLib
2.1.0.dev
|
Interface definition for the observation registry class. More...
#include <GObservationRegistry.hpp>
Public Member Functions | |
GObservationRegistry (void) | |
Void constructor. More... | |
GObservationRegistry (const GObservation *obs) | |
Observation constructor. More... | |
GObservationRegistry (const GObservationRegistry ®istry) | |
Copy constructor. More... | |
virtual | ~GObservationRegistry (void) |
Destructor. More... | |
GObservationRegistry & | operator= (const GObservationRegistry ®istry) |
Assignment operator. More... | |
std::string | classname (void) const |
Return class name. More... | |
int | size (void) const |
Return number of registered observations. More... | |
GObservation * | alloc (const std::string &name) const |
Allocate observation of given name. More... | |
std::string | name (const int &index) const |
Returns instrument name for a specific registered observation. 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 GObservationRegistry ®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 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(), GObservation::instrument(), 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 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(), 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(), 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(), name(), and print().