GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GWcsRegistry Class Reference

Interface definition for the WCS registry class. More...

#include <GWcsRegistry.hpp>

Inheritance diagram for GWcsRegistry:
GRegistry

Public Member Functions

 GWcsRegistry (void)
 Void constructor. More...
 
 GWcsRegistry (const GWcs *wcs)
 Projection constructor. More...
 
 GWcsRegistry (const GWcsRegistry &registry)
 Copy constructor. More...
 
virtual ~GWcsRegistry (void)
 Destructor. More...
 
GWcsRegistryoperator= (const GWcsRegistry &registry)
 Assignment operator. More...
 
std::string classname (void) const
 Return class name. More...
 
int size (void) const
 Return number of registered models. More...
 
GWcsalloc (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 &registry)
 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 ()
 

Detailed Description

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.

Constructor & Destructor Documentation

GWcsRegistry::GWcsRegistry ( void  )

Void constructor.

Definition at line 56 of file GWcsRegistry.cpp.

References codes(), init_members(), and size().

GWcsRegistry::GWcsRegistry ( const GWcs wcs)
explicit

Projection constructor.

Parameters
[in]wcsWorld 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.

Parameters
[in]registryRegistry.

Definition at line 135 of file GWcsRegistry.cpp.

References copy_members(), and init_members().

GWcsRegistry::~GWcsRegistry ( void  )
virtual

Destructor.

Definition at line 151 of file GWcsRegistry.cpp.

References free_members().

Member Function Documentation

GWcs * GWcsRegistry::alloc ( const std::string &  code) const

Allocate World Coordinate System of given code.

Parameters
[in]codeSky projection code.
Returns
Pointer to World Coordinate System (NULL if code is not registered).

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().

std::string GWcsRegistry::classname ( void  ) const
inlinevirtual

Return class name.

Returns
String containing the class name ("GWcsRegistry").

Implements GRegistry.

Definition at line 113 of file GWcsRegistry.hpp.

std::string GWcsRegistry::code ( const int &  index) const

Returns projection code.

Parameters
[in]indexProjection index [0,...,size()[.
Returns
Projection code.
Exceptions
GException::out_of_rangeProjection index is out of range.

Definition at line 236 of file GWcsRegistry.cpp.

References codes(), G_CODE, and size().

Referenced by alloc().

static GRegistryPointer<std::string>& GWcsRegistry::codes ( )
inlinestaticprivate

Definition at line 90 of file GWcsRegistry.hpp.

Referenced by alloc(), code(), GWcsRegistry(), and print().

void GWcsRegistry::copy_members ( const GWcsRegistry registry)
protected

Copy class members.

Parameters
[in]registryRegistry.

Definition at line 332 of file GWcsRegistry.cpp.

Referenced by GWcsRegistry(), and operator=().

void GWcsRegistry::free_members ( void  )
protected

Delete class members.

Definition at line 342 of file GWcsRegistry.cpp.

Referenced by operator=(), and ~GWcsRegistry().

void GWcsRegistry::init_members ( void  )
protected

Initialise class members.

Definition at line 320 of file GWcsRegistry.cpp.

Referenced by GWcsRegistry(), and operator=().

std::string GWcsRegistry::name ( const int &  index) const
virtual

Returns projection name.

Parameters
[in]indexProjection index [0,...,size()[.
Returns
Projection name.
Exceptions
GException::out_of_rangeProjection index is out of range.

Implements GRegistry.

Definition at line 260 of file GWcsRegistry.cpp.

References G_CODE, names(), and size().

static GRegistryPointer<std::string>& GWcsRegistry::names ( )
inlinestaticprivate

Definition at line 95 of file GWcsRegistry.hpp.

Referenced by GWcsRegistry(), name(), and print().

static int& GWcsRegistry::number ( void  )
inlinestaticprivate

Definition at line 85 of file GWcsRegistry.hpp.

Referenced by GWcsRegistry(), and size().

GWcsRegistry & GWcsRegistry::operator= ( const GWcsRegistry registry)

Assignment operator.

Parameters
[in]registryRegistry.
Returns
Reference to registry.

Definition at line 173 of file GWcsRegistry.cpp.

References copy_members(), free_members(), and init_members().

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

Print registry information.

Parameters
[in]chatterChatter level.
Returns
Registry content.

Implements GRegistry.

Definition at line 281 of file GWcsRegistry.cpp.

References codes(), names(), NORMAL, gammalib::parformat(), SILENT, size(), and gammalib::str().

static GRegistryPointer<const GWcs*>& GWcsRegistry::projections ( )
inlinestaticprivate

Definition at line 100 of file GWcsRegistry.hpp.

Referenced by alloc(), and GWcsRegistry().

int GWcsRegistry::size ( void  ) const
inlinevirtual

Return number of registered models.

Returns
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().


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