GammaLib
2.0.0
|
Interface definition for the WCS registry class. More...
#include <GWcsRegistry.hpp>
Public Member Functions | |
GWcsRegistry (void) | |
Void constructor. More... | |
GWcsRegistry (const GWcs *wcs) | |
Projection constructor. More... | |
GWcsRegistry (const GWcsRegistry ®istry) | |
Copy constructor. More... | |
virtual | ~GWcsRegistry (void) |
Destructor. More... | |
GWcsRegistry & | operator= (const GWcsRegistry ®istry) |
Assignment operator. More... | |
std::string | classname (void) const |
Return class name. More... | |
int | size (void) const |
Return number of registered models. More... | |
GWcs * | alloc (const std::string &code) const |
Allocate World Coordinate System of given code. More... | |
std::string | code (const int &index) const |
Returns projection code. More... | |
std::string | name (const int &index) const |
Returns projection 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 GWcsRegistry ®istry) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
Static Private Member Functions | |
static int & | number () |
static GRegistryPointer < std::string > & | codes () |
static GRegistryPointer < std::string > & | names () |
static GRegistryPointer< const GWcs * > & | projections () |
Interface definition for the WCS registry class.
The registry class allows the registration of WCS projections that are not necessarily compiled into the GammaLib. It uses the static members m_number, m_codes, m_names, and m_projections which are allocated globally to keep track of projections that are available throughout all linked libraries. To register a projection it is sufficient to add
const GWcsXXX g_wcs_XXX_seed; const GWcsRegistry g_wcs_XXX_registry(&g_wcs_XXX_seed);
at the top of the .cpp file of the projection. Here, XXX is a unique code that describes the projection.
Definition at line 53 of file GWcsRegistry.hpp.
GWcsRegistry::GWcsRegistry | ( | void | ) |
Void constructor.
Definition at line 56 of file GWcsRegistry.cpp.
References codes(), init_members(), and size().
|
explicit |
Projection constructor.
[in] | wcs | World Coordinate System. |
Definition at line 80 of file GWcsRegistry.cpp.
References GWcs::code(), codes(), init_members(), GWcs::name(), names(), number(), projections(), and size().
GWcsRegistry::GWcsRegistry | ( | const GWcsRegistry & | registry | ) |
Copy constructor.
[in] | registry | Registry. |
Definition at line 135 of file GWcsRegistry.cpp.
References copy_members(), and init_members().
|
virtual |
GWcs * GWcsRegistry::alloc | ( | const std::string & | code | ) | const |
Allocate World Coordinate System of given code.
[in] | code | Sky projection code. |
Returns a pointer to a sky projection instance of the specified code. If the code has not been found in the registry, a NULL pointer is returned.
Definition at line 209 of file GWcsRegistry.cpp.
References code(), codes(), projections(), and size().
Referenced by GSkyMap::alloc_wcs(), and GSkyMap::set_wcs().
|
inlinevirtual |
Return class name.
Implements GRegistry.
Definition at line 113 of file GWcsRegistry.hpp.
std::string GWcsRegistry::code | ( | const int & | index | ) | const |
Returns projection code.
[in] | index | Projection index [0,...,size()[. |
GException::out_of_range | Projection index is out of range. |
Definition at line 236 of file GWcsRegistry.cpp.
References codes(), G_CODE, and size().
Referenced by alloc().
|
inlinestaticprivate |
Definition at line 90 of file GWcsRegistry.hpp.
Referenced by alloc(), code(), GWcsRegistry(), and print().
|
protected |
Copy class members.
[in] | registry | Registry. |
Definition at line 332 of file GWcsRegistry.cpp.
Referenced by GWcsRegistry(), and operator=().
|
protected |
Delete class members.
Definition at line 342 of file GWcsRegistry.cpp.
Referenced by operator=(), and ~GWcsRegistry().
|
protected |
Initialise class members.
Definition at line 320 of file GWcsRegistry.cpp.
Referenced by GWcsRegistry(), and operator=().
|
virtual |
Returns projection name.
[in] | index | Projection index [0,...,size()[. |
GException::out_of_range | Projection index is out of range. |
Implements GRegistry.
Definition at line 260 of file GWcsRegistry.cpp.
|
inlinestaticprivate |
Definition at line 95 of file GWcsRegistry.hpp.
Referenced by GWcsRegistry(), name(), and print().
|
inlinestaticprivate |
Definition at line 85 of file GWcsRegistry.hpp.
Referenced by GWcsRegistry(), and size().
GWcsRegistry & GWcsRegistry::operator= | ( | const GWcsRegistry & | registry | ) |
Assignment operator.
[in] | registry | Registry. |
Definition at line 173 of file GWcsRegistry.cpp.
References copy_members(), free_members(), and init_members().
Print registry information.
[in] | chatter | Chatter level. |
Implements GRegistry.
Definition at line 281 of file GWcsRegistry.cpp.
References codes(), names(), NORMAL, gammalib::parformat(), SILENT, size(), and gammalib::str().
|
inlinestaticprivate |
Definition at line 100 of file GWcsRegistry.hpp.
Referenced by alloc(), and GWcsRegistry().
|
inlinevirtual |
Return number of registered models.
Returns the number of registered model.
Implements GRegistry.
Definition at line 127 of file GWcsRegistry.hpp.
References number().
Referenced by alloc(), code(), GWcsRegistry(), name(), and print().