From cb2fd58a96cb6683ca0c99e09b7712724bb6bfc5 Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Mon, 15 Oct 2012 11:19:12 +0200 Subject: [PATCH] Base classes on GRegistry interface. --- include/GModelRadialRegistry.hpp | 39 ++++++++++++++++++--------------------- include/GModelRegistry.hpp | 27 ++++++++++++--------------- include/GModelSpatialRegistry.hpp | 27 ++++++++++++--------------- include/GModelSpectralRegistry.hpp | 27 ++++++++++++--------------- include/GModelTemporalRegistry.hpp | 25 +++++++++++-------------- include/GObservationRegistry.hpp | 27 ++++++++++++--------------- include/GWcsRegistry.hpp | 21 +++++++++------------ inst/cta/include/GCTAModelRadialRegistry.hpp | 27 ++++++++++++--------------- inst/cta/pyext/GCTAModelRadialRegistry.i | 15 ++++++++------- inst/cta/pyext/cta.i | 4 ++++ inst/cta/src/GCTAModelRadialRegistry.cpp | 68 ++++++++++++++++++-------------------------------------------------- pyext/GModelRadialRegistry.i | 15 ++++++++------- pyext/GModelRegistry.i | 15 ++++++++------- pyext/GModelSpatialRegistry.i | 15 ++++++++------- pyext/GModelSpectralRegistry.i | 13 +++++++------ pyext/GModelTemporalRegistry.i | 15 ++++++++------- pyext/GObservationRegistry.i | 15 ++++++++------- pyext/GWcsRegistry.i | 9 +++++---- pyext/gammalib/model.i | 1 + pyext/gammalib/obs.i | 1 + pyext/gammalib/sky.i | 1 + src/model/GModelRadialRegistry.cpp | 74 ++++++++++++++++++++++---------------------------------------------------- src/model/GModelRegistry.cpp | 77 ++++++++++++++++++++++++++--------------------------------------------------- src/model/GModelSpatialRegistry.cpp | 73 ++++++++++++++++++++++++------------------------------------------------- src/model/GModelSpectralRegistry.cpp | 71 +++++++++++++++++++++-------------------------------------------------- src/model/GModelTemporalRegistry.cpp | 71 +++++++++++++++++++++-------------------------------------------------- src/obs/GException_obs.cpp | 6 +++--- src/obs/GObservationRegistry.cpp | 67 ++++++++++++++++++------------------------------------------------- src/sky/GWcsRegistry.cpp | 68 +++++++++++++++++++++----------------------------------------------- 29 files changed, 339 insertions(+), 575 deletions(-) diff --git a/include/GModelRadialRegistry.hpp b/include/GModelRadialRegistry.hpp index b09d5f6..0ffe46e 100644 --- a/include/GModelRadialRegistry.hpp +++ b/include/GModelRadialRegistry.hpp @@ -1,7 +1,7 @@ /*************************************************************************** - * GModelRadialRegistry.hpp - Radial spatial model registry class * + * GModelRadialRegistry.hpp - Radial model registry class * * ----------------------------------------------------------------------- * - * copyright (C) 2011 by Jurgen Knodlseder * + * copyright (C) 2011-2012 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -20,8 +20,8 @@ ***************************************************************************/ /** * @file GModelRadialRegistry.hpp - * @brief Radial spatial model class interface definition - * @author J. Knodlseder + * @brief Radial model registry class interface definition + * @author Juergen Knoedlseder */ #ifndef GMODELRADIALREGISTRY_HPP @@ -29,31 +29,28 @@ /* __ Includes ___________________________________________________________ */ #include -#include -#include "GLog.hpp" +#include "GRegistry.hpp" #include "GModelRadial.hpp" /***********************************************************************//** * @class GModelRadialRegistry * - * @brief Radial spatial model registry class + * @brief Radial model registry class * - * The registry class allows the registration of radial spatial models that - * are not necessarily compiled into the GammaLib. It uses the static members + * The registry class allows the registration of radial models that are not + * necessarily compiled into the GammaLib. It uses the static members * m_number, m_names, and m_models which are allocated globally to keep track - * of radial spatial models that are available throughout all linked - * libraries. To register a radial spatial model it is sufficient to add - * const GModelRadialXXX g_radial_XXX_seed; - * const GModelRadialRegistry g_radial_XXX_registry(&g_radial_XXX_seed); - * at the top of the .cpp file of the radial spatial model. Here, XXX is a - * unique name that describes the model. + * of radial models that are available throughout all linked libraries. To + * register a radial model it is sufficient to add + * + * const GModelRadialXXX g_radial_XXX_seed; + * const GModelRadialRegistry g_radial_XXX_registry(&g_radial_XXX_seed); + * + * at the top of the .cpp file of the radial model. Here, XXX is a unique + * name that describes the model. ***************************************************************************/ -class GModelRadialRegistry { - - // I/O friends - friend std::ostream& operator<<(std::ostream& os, const GModelRadialRegistry& registry); - friend GLog& operator<<(GLog& log, const GModelRadialRegistry& registry); +class GModelRadialRegistry : public GRegistry { public: // Constructors and destructors @@ -67,7 +64,7 @@ public: // Methods int size(void) const { return m_number; } - GModelRadial* alloc(const std::string& type) const; + GModelRadial* alloc(const std::string& name) const; std::string name(const int& index) const; std::string print(void) const; diff --git a/include/GModelRegistry.hpp b/include/GModelRegistry.hpp index e250426..f9a3097 100644 --- a/include/GModelRegistry.hpp +++ b/include/GModelRegistry.hpp @@ -1,7 +1,7 @@ /*************************************************************************** - * GModelRegistry.hpp - Model registry class * + * GModelRegistry.hpp - Model registry class * * ----------------------------------------------------------------------- * - * copyright (C) 2011 by Jurgen Knodlseder * + * copyright (C) 2011-2012 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -20,8 +20,8 @@ ***************************************************************************/ /** * @file GModelRegistry.hpp - * @brief GModelRegistry class interface definition - * @author J. Knodlseder + * @brief Model registry class definition + * @author Juergen Knoedlseder */ #ifndef GMODELREGISTRY_HPP @@ -29,31 +29,28 @@ /* __ Includes ___________________________________________________________ */ #include -#include -#include "GLog.hpp" +#include "GRegistry.hpp" #include "GModel.hpp" /***********************************************************************//** * @class GModelRegistry * - * @brief Interface definition for the model registry class. + * @brief Interface definition for the model registry class * * The registry class allows the registration of models that are not * necessarily compiled into the GammaLib. It uses the static members * m_number, m_names, and m_models which are allocated globally to keep track * of models that are available throughout all linked libraries. To register * a model it is sufficient to add - * const GModelXXX g_XXX_seed; - * const GModelRegistry g_XXX_registry(&g_XXX_seed); + * + * const GModelXXX g_XXX_seed; + * const GModelRegistry g_XXX_registry(&g_XXX_seed); + * * at the top of the .cpp file of the model. Here, XXX is a unique name that * describes the model. ***************************************************************************/ -class GModelRegistry { - - // I/O friends - friend std::ostream& operator<<(std::ostream& os, const GModelRegistry& registry); - friend GLog& operator<<(GLog& log, const GModelRegistry& registry); +class GModelRegistry : public GRegistry { public: // Constructors and destructors @@ -67,7 +64,7 @@ public: // Methods int size(void) const { return m_number; } - GModel* alloc(const std::string& type) const; + GModel* alloc(const std::string& name) const; std::string name(const int& index) const; std::string print(void) const; diff --git a/include/GModelSpatialRegistry.hpp b/include/GModelSpatialRegistry.hpp index 01b5391..2e51262 100644 --- a/include/GModelSpatialRegistry.hpp +++ b/include/GModelSpatialRegistry.hpp @@ -1,7 +1,7 @@ /*************************************************************************** - * GModelSpatialRegistry.hpp - Spatial model registry class * + * GModelSpatialRegistry.hpp - Spatial model registry class * * ----------------------------------------------------------------------- * - * copyright (C) 2011 by Jurgen Knodlseder * + * copyright (C) 2011-2012 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -20,8 +20,8 @@ ***************************************************************************/ /** * @file GModelSpatialRegistry.hpp - * @brief GModelSpatialRegistry class interface definition - * @author J. Knodlseder + * @brief Spatial model registry class definition + * @author Juergen Knoedlseder */ #ifndef GMODELSPATIALREGISTRY_HPP @@ -29,31 +29,28 @@ /* __ Includes ___________________________________________________________ */ #include -#include -#include "GLog.hpp" +#include "GRegistry.hpp" #include "GModelSpatial.hpp" /***********************************************************************//** * @class GModelSpatialRegistry * - * @brief Interface definition for the spatial model registry class. + * @brief Interface definition for the spatial model registry class * * The registry class allows the registration of spatial models that are not * necessarily compiled into the GammaLib. It uses the static members * m_number, m_names, and m_models which are allocated globally to keep track * of spatial models that are available throughout all linked libraries. To * register a spatial model it is sufficient to add - * const GModelSpatialXXX g_spatial_XXX_seed; - * const GModelSpatialRegistry g_spatial_XXX_registry(&g_spatial_XXX_seed); + * + * const GModelSpatialXXX g_spatial_XXX_seed; + * const GModelSpatialRegistry g_spatial_XXX_registry(&g_spatial_XXX_seed); + * * at the top of the .cpp file of the spatial model. Here, XXX is a unique * name that describes the model. ***************************************************************************/ -class GModelSpatialRegistry { - - // I/O friends - friend std::ostream& operator<<(std::ostream& os, const GModelSpatialRegistry& registry); - friend GLog& operator<<(GLog& log, const GModelSpatialRegistry& registry); +class GModelSpatialRegistry : public GRegistry { public: // Constructors and destructors @@ -67,7 +64,7 @@ public: // Methods int size(void) const { return m_number; } - GModelSpatial* alloc(const std::string& type) const; + GModelSpatial* alloc(const std::string& name) const; std::string name(const int& index) const; std::string print(void) const; diff --git a/include/GModelSpectralRegistry.hpp b/include/GModelSpectralRegistry.hpp index 0444b76..eed1f9c 100644 --- a/include/GModelSpectralRegistry.hpp +++ b/include/GModelSpectralRegistry.hpp @@ -1,7 +1,7 @@ /*************************************************************************** - * GModelSpectralRegistry.hpp - Spectral model registry class * + * GModelSpectralRegistry.hpp - Spectral model registry class * * ----------------------------------------------------------------------- * - * copyright (C) 2011 by Jurgen Knodlseder * + * copyright (C) 2011-2012 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -20,8 +20,8 @@ ***************************************************************************/ /** * @file GModelSpectralRegistry.hpp - * @brief GModelSpectralRegistry class interface definition - * @author J. Knodlseder + * @brief Spectral model registry class definition + * @author Juergen Knoedlseder */ #ifndef GMODELSPECTRALREGISTRY_HPP @@ -29,31 +29,28 @@ /* __ Includes ___________________________________________________________ */ #include -#include -#include "GLog.hpp" +#include "GRegistry.hpp" #include "GModelSpectral.hpp" /***********************************************************************//** * @class GModelSpectralRegistry * - * @brief Interface definition for the spectral model registry class. + * @brief Interface definition for the spectral model registry class * * The registry class allows the registration of spectral models that are not * necessarily compiled into the GammaLib. It uses the static members * m_number, m_names, and m_models which are allocated globally to keep track * of spectral models that are available throughout all linked libraries. To * register a spectral model it is sufficient to add - * const GModelSpectralXXX g_spectral_XXX_seed; - * const GModelSpectralRegistry g_spectral_XXX_registry(&g_spectral_XXX_seed); + * + * const GModelSpectralXXX g_spectral_XXX_seed; + * const GModelSpectralRegistry g_spectral_XXX_registry(&g_spectral_XXX_seed); + * * at the top of the .cpp file of the spectral model. Here, XXX is a unique * name that describes the model. ***************************************************************************/ -class GModelSpectralRegistry { - - // I/O friends - friend std::ostream& operator<<(std::ostream& os, const GModelSpectralRegistry& registry); - friend GLog& operator<<(GLog& log, const GModelSpectralRegistry& registry); +class GModelSpectralRegistry : public GRegistry { public: // Constructors and destructors @@ -67,7 +64,7 @@ public: // Methods int size(void) const { return m_number; } - GModelSpectral* alloc(const std::string& type) const; + GModelSpectral* alloc(const std::string& name) const; std::string name(const int& index) const; std::string print(void) const; diff --git a/include/GModelTemporalRegistry.hpp b/include/GModelTemporalRegistry.hpp index bab3110..af59259 100644 --- a/include/GModelTemporalRegistry.hpp +++ b/include/GModelTemporalRegistry.hpp @@ -1,7 +1,7 @@ /*************************************************************************** - * GModelTemporalRegistry.hpp - Temporal model registry class * + * GModelTemporalRegistry.hpp - Temporal model registry class * * ----------------------------------------------------------------------- * - * copyright (C) 2011 by Jurgen Knodlseder * + * copyright (C) 2011-2012 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -20,8 +20,8 @@ ***************************************************************************/ /** * @file GModelTemporalRegistry.hpp - * @brief GModelTemporalRegistry class interface definition - * @author J. Knodlseder + * @brief Temporal model registry class definition + * @author Juergen Knoedlseder */ #ifndef GMODELTEMPORALREGISTRY_HPP @@ -29,8 +29,7 @@ /* __ Includes ___________________________________________________________ */ #include -#include -#include "GLog.hpp" +#include "GRegistry.hpp" #include "GModelTemporal.hpp" @@ -44,16 +43,14 @@ * m_number, m_names, and m_models which are allocated globally to keep track * of temporal models that are available throughout all linked libraries. To * register a temporal model it is sufficient to add - * const GModelTemporalXXX g_temporal_XXX_seed; - * const GModelTemporalRegistry g_temporal_XXX_registry(&g_spectral_XXX_seed); + * + * const GModelTemporalXXX g_temporal_XXX_seed; + * const GModelTemporalRegistry g_temporal_XXX_registry(&g_spectral_XXX_seed); + * * at the top of the .cpp file of the temporal model. Here, XXX is a unique * name that describes the model. ***************************************************************************/ -class GModelTemporalRegistry { - - // I/O friends - friend std::ostream& operator<<(std::ostream& os, const GModelTemporalRegistry& registry); - friend GLog& operator<<(GLog& log, const GModelTemporalRegistry& registry); +class GModelTemporalRegistry : public GRegistry { public: // Constructors and destructors @@ -67,7 +64,7 @@ public: // Methods int size(void) const { return m_number; } - GModelTemporal* alloc(const std::string& type) const; + GModelTemporal* alloc(const std::string& name) const; std::string name(const int& index) const; std::string print(void) const; diff --git a/include/GObservationRegistry.hpp b/include/GObservationRegistry.hpp index 80a630e..8ddb926 100644 --- a/include/GObservationRegistry.hpp +++ b/include/GObservationRegistry.hpp @@ -1,7 +1,7 @@ /*************************************************************************** - * GObservationRegistry.hpp - Observation registry class * + * GObservationRegistry.hpp - Observation registry class * * ----------------------------------------------------------------------- * - * copyright (C) 2011 by Juergen Knoedlseder * + * copyright (C) 2011-2012 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -20,8 +20,8 @@ ***************************************************************************/ /** * @file GObservationRegistry.hpp - * @brief GObservationRegistry class interface definition - * @author J. Knoedlseder + * @brief Observation registry class definition + * @author Juergen Knoedlseder */ #ifndef GOBSERVATIONREGISTRY_HPP @@ -29,8 +29,7 @@ /* __ Includes ___________________________________________________________ */ #include -#include -#include "GLog.hpp" +#include "GRegistry.hpp" #include "GObservation.hpp" @@ -44,17 +43,15 @@ * 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); + * + * 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. ***************************************************************************/ -class GObservationRegistry { - - // I/O friends - friend std::ostream& operator<<(std::ostream& os, const GObservationRegistry& registry); - friend GLog& operator<<(GLog& log, const GObservationRegistry& registry); +class GObservationRegistry : public GRegistry { public: // Constructors and destructors @@ -68,8 +65,8 @@ public: // Methods int size(void) const { return m_number; } - GObservation* alloc(const std::string& instrument) const; - std::string instrument(const int& index) const; + GObservation* alloc(const std::string& name) const; + std::string name(const int& index) const; std::string print(void) const; protected: diff --git a/include/GWcsRegistry.hpp b/include/GWcsRegistry.hpp index 8cdc249..183403b 100644 --- a/include/GWcsRegistry.hpp +++ b/include/GWcsRegistry.hpp @@ -1,7 +1,7 @@ /*************************************************************************** - * GWcsRegistry.hpp - World Coordinate Projection registry class * + * GWcsRegistry.hpp - World Coordinate Projection registry class * * ----------------------------------------------------------------------- * - * copyright (C) 2011 by Jurgen Knodlseder * + * copyright (C) 2011-2012 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -21,7 +21,7 @@ /** * @file GWcsRegistry.hpp * @brief World Coordinate Projection registry class interface definition - * @author J. Knodlseder + * @author Juergen Knoedlseder */ #ifndef GWCSREGISTRY_HPP @@ -29,8 +29,7 @@ /* __ Includes ___________________________________________________________ */ #include -#include -#include "GLog.hpp" +#include "GRegistry.hpp" #include "GWcslib.hpp" @@ -44,16 +43,14 @@ * m_number, m_codes, m_names, and m_prjs 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); + * + * 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. ***************************************************************************/ -class GWcsRegistry { - - // I/O friends - friend std::ostream& operator<<(std::ostream& os, const GWcsRegistry& registry); - friend GLog& operator<<(GLog& log, const GWcsRegistry& registry); +class GWcsRegistry : public GRegistry { public: // Constructors and destructors diff --git a/inst/cta/include/GCTAModelRadialRegistry.hpp b/inst/cta/include/GCTAModelRadialRegistry.hpp index a91b567..d16e873 100644 --- a/inst/cta/include/GCTAModelRadialRegistry.hpp +++ b/inst/cta/include/GCTAModelRadialRegistry.hpp @@ -1,7 +1,7 @@ /*************************************************************************** - * GCTAModelRadialRegistry.hpp - CTA Radial model registry class * + * GCTAModelRadialRegistry.hpp - CTA Radial model registry class * * ----------------------------------------------------------------------- * - * copyright (C) 2011 by Jurgen Knodlseder * + * copyright (C) 2011-2012 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -20,8 +20,8 @@ ***************************************************************************/ /** * @file GCTAModelRadialRegistry.hpp - * @brief GCTAModelRadialRegistry class interface definition - * @author J. Knodlseder + * @brief CTA radial model registry class definition + * @author Juergen Knoedlseder */ #ifndef GCTAMODELRADIALREGISTRY_HPP @@ -29,31 +29,28 @@ /* __ Includes ___________________________________________________________ */ #include -#include -#include "GLog.hpp" +#include "GRegistry.hpp" #include "GCTAModelRadial.hpp" /***********************************************************************//** * @class GCTAModelRadialRegistry * - * @brief Interface definition for the CTA radial model registry class. + * @brief Interface definition for the CTA radial model registry class * * The registry class allows the registration of radial models for CTA that * are not necessarily compiled into the GammaLib. It uses the static members * m_number, m_names, and m_models which are allocated globally to keep track * of radial models that are available throughout all linked libraries. To * register a radial model it is sufficient to add - * const GCTAModelRadialXXX g_cta_radial_XXX_seed; - * const GCTAModelRadialRegistry g_cta_radial_XXX_registry(&g_cta_radial_XXX_seed); + * + * const GCTAModelRadialXXX g_cta_radial_XXX_seed; + * const GCTAModelRadialRegistry g_cta_radial_XXX_registry(&g_cta_radial_XXX_seed); + * * at the top of the .cpp file of the radial model. Here, XXX is a unique * name that describes the model. ***************************************************************************/ -class GCTAModelRadialRegistry { - - // I/O friends - friend std::ostream& operator<<(std::ostream& os, const GCTAModelRadialRegistry& registry); - friend GLog& operator<<(GLog& log, const GCTAModelRadialRegistry& registry); +class GCTAModelRadialRegistry : public GRegistry { public: // Constructors and destructors @@ -67,7 +64,7 @@ public: // Methods int size(void) const { return m_number; } - GCTAModelRadial* alloc(const std::string& type) const; + GCTAModelRadial* alloc(const std::string& name) const; std::string name(const int& index) const; std::string print(void) const; diff --git a/inst/cta/pyext/GCTAModelRadialRegistry.i b/inst/cta/pyext/GCTAModelRadialRegistry.i index 35801c5..26bf82f 100644 --- a/inst/cta/pyext/GCTAModelRadialRegistry.i +++ b/inst/cta/pyext/GCTAModelRadialRegistry.i @@ -1,7 +1,7 @@ /*************************************************************************** - * GCTAModelRadialRegistry.i - CTA Radial model registry class python I/F* + * GCTAModelRadialRegistry.i - CTA Radial model registry class * * ----------------------------------------------------------------------- * - * copyright (C) 2011 by Jurgen Knodlseder * + * copyright (C) 2011-2012 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -20,8 +20,8 @@ ***************************************************************************/ /** * @file GCTAModelRadialRegistry.i - * @brief GCTAModelRadialRegistry class python interface. - * @author J. Knodlseder + * @brief CTA radial model registry class definition + * @author Juergen Knoedlseder */ %{ /* Put headers and other declarations here that are needed for compilation */ @@ -33,9 +33,10 @@ /***********************************************************************//** * @class GCTAModelRadialRegistry * - * @brief Interface definition for the spatial model registry class. + * @brief Interface definition for the CTA radial model registry class ***************************************************************************/ -class GCTAModelRadialRegistry { +class GCTAModelRadialRegistry : public GRegistry { + public: // Constructors and destructors GCTAModelRadialRegistry(void); @@ -45,7 +46,7 @@ public: // Methods int size(void) const; - GCTAModelRadial* alloc(const std::string& type) const; + GCTAModelRadial* alloc(const std::string& name) const; std::string name(const int& index) const; }; diff --git a/inst/cta/pyext/cta.i b/inst/cta/pyext/cta.i index 353b4ee..a3b79b8 100644 --- a/inst/cta/pyext/cta.i +++ b/inst/cta/pyext/cta.i @@ -27,6 +27,10 @@ /* __ Include standard typemaps for vectors and strings __________________ */ %include stl.i +/* __ Include interface classes __________________________________________ */ +%import(module="gammalib.base") "GBase.i"; +%import(module="gammalib.base") "GRegistry.i"; + /* __ Make sure that exceptions are catched ______________________________ */ %import(module="gammalib.support") "GException.i"; diff --git a/inst/cta/src/GCTAModelRadialRegistry.cpp b/inst/cta/src/GCTAModelRadialRegistry.cpp index 4fd1d0b..5223a09 100644 --- a/inst/cta/src/GCTAModelRadialRegistry.cpp +++ b/inst/cta/src/GCTAModelRadialRegistry.cpp @@ -1,7 +1,7 @@ /*************************************************************************** - * GCTAModelRadialRegistry.cpp - CTA radial model registry class * + * GCTAModelRadialRegistry.cpp - CTA Radial model registry class * * ----------------------------------------------------------------------- * - * copyright (C) 2011 by Jurgen Knodlseder * + * copyright (C) 2011-2012 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -20,8 +20,8 @@ ***************************************************************************/ /** * @file GCTAModelRadialRegistry.cpp - * @brief GCTAModelRadialRegistry class interface definition - * @author J. Knodlseder + * @brief CTA radial model registry class implementation + * @author Juergen Knoedlseder */ /* __ Includes ___________________________________________________________ */ @@ -118,8 +118,9 @@ GCTAModelRadialRegistry::GCTAModelRadialRegistry(const GCTAModelRadial* model) // Debug option: Show actual registry #if G_DEBUG_REGISTRY std::cout << "GCTAModelRadialRegistry(const GCTAModelRadial*): "; - for (int i = 0; i < m_number; ++i) + for (int i = 0; i < m_number; ++i) { std::cout << "\"" << m_names[i] << "\" "; + } std::cout << std::endl; #endif @@ -169,6 +170,7 @@ GCTAModelRadialRegistry::~GCTAModelRadialRegistry(void) * @brief Assignment operator * * @param[in] registry Registry. + * @return Reference to registry. ***************************************************************************/ GCTAModelRadialRegistry& GCTAModelRadialRegistry::operator= (const GCTAModelRadialRegistry& registry) { @@ -198,22 +200,22 @@ GCTAModelRadialRegistry& GCTAModelRadialRegistry::operator= (const GCTAModelRadi ==========================================================================*/ /***********************************************************************//** - * @brief Allocate radial model of given type + * @brief Allocate radial model of given name * - * @param[in] type Radial model type. + * @param[in] name Radial model name. * - * Returns a pointer to a void radial model instance of the specified - * type. If the type has not been found in the registry, a NULL pointer is + * Returns a pointer to a radial model instance of the specified name. + * If the name has not been found in the registry, a NULL pointer is * returned. ***************************************************************************/ -GCTAModelRadial* GCTAModelRadialRegistry::alloc(const std::string& type) const +GCTAModelRadial* GCTAModelRadialRegistry::alloc(const std::string& name) const { // Initialise radial model GCTAModelRadial* model = NULL; // Search for model in registry for (int i = 0; i < m_number; ++i) { - if (m_names[i] == type) { + if (m_names[i] == name) { model = m_models[i]->clone(); break; } @@ -228,6 +230,7 @@ GCTAModelRadial* GCTAModelRadialRegistry::alloc(const std::string& type) const * @brief Returns model name * * @param[in] index Model index [0,...,size()-1]. + * @return Model name. * * @exception GException::out_of_range * Model index is out of range. @@ -236,8 +239,9 @@ std::string GCTAModelRadialRegistry::name(const int& index) const { // Compile option: raise exception if index is out of range #if defined(G_RANGE_CHECK) - if (index < 0 || index >= size()) + if (index < 0 || index >= size()) { throw GException::out_of_range(G_NAME, index, 0, size()-1); + } #endif // Return name @@ -247,6 +251,8 @@ std::string GCTAModelRadialRegistry::name(const int& index) const /***********************************************************************//** * @brief Print registry information + * + * @return Registry content. ***************************************************************************/ std::string GCTAModelRadialRegistry::print(void) const { @@ -303,41 +309,3 @@ void GCTAModelRadialRegistry::free_members(void) // Return return; } - - -/*========================================================================== - = = - = Friends = - = = - ==========================================================================*/ - -/***********************************************************************//** - * @brief Output operator - * - * @param[in] os Output stream. - * @param[in] registry Radial model registry. - ***************************************************************************/ -std::ostream& operator<< (std::ostream& os, const GCTAModelRadialRegistry& registry) -{ - // Write registry in output stream - os << registry.print(); - - // Return output stream - return os; -} - - -/***********************************************************************//** - * @brief Log operator - * - * @param[in] log Logger. - * @param[in] registry Radial model registry. - ***************************************************************************/ -GLog& operator<< (GLog& log, const GCTAModelRadialRegistry& registry) -{ - // Write registry into logger - log << registry.print(); - - // Return logger - return log; -} diff --git a/pyext/GModelRadialRegistry.i b/pyext/GModelRadialRegistry.i index 5745a08..689e938 100644 --- a/pyext/GModelRadialRegistry.i +++ b/pyext/GModelRadialRegistry.i @@ -1,7 +1,7 @@ /*************************************************************************** - * GModelRadialRegistry.i - Radial spatial model registry class * + * GModelRadialRegistry.i - Radial model registry class * * ----------------------------------------------------------------------- * - * copyright (C) 2011 by Jurgen Knodlseder * + * copyright (C) 2011-2012 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -20,8 +20,8 @@ ***************************************************************************/ /** * @file GModelRadialRegistry.i - * @brief Radial spatial model registry class Python interface definition - * @author J. Knodlseder + * @brief Radial model registry class interface definition + * @author Juergen Knoedlseder */ %{ /* Put headers and other declarations here that are needed for compilation */ @@ -33,9 +33,10 @@ /***********************************************************************//** * @class GModelRadialRegistry * - * @brief Radial spatial model registry class + * @brief Radial model registry class ***************************************************************************/ -class GModelRadialRegistry { +class GModelRadialRegistry : public GRegistry { + public: // Constructors and destructors GModelRadialRegistry(void); @@ -45,7 +46,7 @@ public: // Methods int size(void) const; - GModelRadial* alloc(const std::string& type) const; + GModelRadial* alloc(const std::string& name) const; std::string name(const int& index) const; }; diff --git a/pyext/GModelRegistry.i b/pyext/GModelRegistry.i index 2410091..9d0c50e 100644 --- a/pyext/GModelRegistry.i +++ b/pyext/GModelRegistry.i @@ -1,7 +1,7 @@ /*************************************************************************** - * GModelRegistry.i - Model registry class python I/F * + * GModelRegistry.i - Model registry class * * ----------------------------------------------------------------------- * - * copyright (C) 2011 by Jurgen Knodlseder * + * copyright (C) 2011-2012 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -20,8 +20,8 @@ ***************************************************************************/ /** * @file GModelRegistry.i - * @brief GModelRegistry class python interface. - * @author J. Knodlseder + * @brief Model registry class definition + * @author Juergen Knoedlseder */ %{ /* Put headers and other declarations here that are needed for compilation */ @@ -33,9 +33,10 @@ /***********************************************************************//** * @class GModelRegistry * - * @brief Interface definition for the model registry class. + * @brief Interface definition for the model registry class ***************************************************************************/ -class GModelRegistry { +class GModelRegistry : public GRegistry { + public: // Constructors and destructors GModelRegistry(void); @@ -45,7 +46,7 @@ public: // Methods int size(void) const { return m_number; } - GModel* alloc(const std::string& type) const; + GModel* alloc(const std::string& name) const; std::string name(const int& index) const; }; diff --git a/pyext/GModelSpatialRegistry.i b/pyext/GModelSpatialRegistry.i index 50f5a1d..c8b9fa7 100644 --- a/pyext/GModelSpatialRegistry.i +++ b/pyext/GModelSpatialRegistry.i @@ -1,7 +1,7 @@ /*************************************************************************** - * GModelSpatialRegistry.i - Spatial model registry class python I/F * + * GModelSpatialRegistry.i - Spatial model registry class * * ----------------------------------------------------------------------- * - * copyright (C) 2011 by Jurgen Knodlseder * + * copyright (C) 2011-2012 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -20,8 +20,8 @@ ***************************************************************************/ /** * @file GModelSpatialRegistry.i - * @brief GModelSpatialRegistry class python interface. - * @author J. Knodlseder + * @brief Spatial model registry class definition + * @author Juergen Knoedlseder */ %{ /* Put headers and other declarations here that are needed for compilation */ @@ -33,9 +33,10 @@ /***********************************************************************//** * @class GModelSpatialRegistry * - * @brief Interface definition for the spatial model registry class. + * @brief Interface definition for the spatial model registry class ***************************************************************************/ -class GModelSpatialRegistry { +class GModelSpatialRegistry : public GRegistry { + public: // Constructors and destructors GModelSpatialRegistry(void); @@ -45,7 +46,7 @@ public: // Methods int size(void) const { return m_number; } - GModelSpatial* alloc(const std::string& type) const; + GModelSpatial* alloc(const std::string& name) const; std::string name(const int& index) const; }; diff --git a/pyext/GModelSpectralRegistry.i b/pyext/GModelSpectralRegistry.i index 9817b75..1dfbdd8 100644 --- a/pyext/GModelSpectralRegistry.i +++ b/pyext/GModelSpectralRegistry.i @@ -1,7 +1,7 @@ /*************************************************************************** - * GModelSpectralRegistry.i - Spectral model registry class python I/F * + * GModelSpectralRegistry.i - Spectral model registry class * * ----------------------------------------------------------------------- * - * copyright (C) 2011 by Jurgen Knodlseder * + * copyright (C) 2011-2012 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -20,7 +20,7 @@ ***************************************************************************/ /** * @file GModelSpectralRegistry.i - * @brief GModelSpectralRegistry class python interface. + * @brief Spectral model registry class definition * @author J. Knodlseder */ %{ @@ -33,9 +33,10 @@ /***********************************************************************//** * @class GModelSpectralRegistry * - * @brief Interface definition for the spectral model registry class. + * @brief Interface definition for the spectral model registry class ***************************************************************************/ -class GModelSpectralRegistry { +class GModelSpectralRegistry : public GRegistry { + public: // Constructors and destructors GModelSpectralRegistry(void); @@ -45,7 +46,7 @@ public: // Methods int size(void) const { return m_number; } - GModelSpectral* alloc(const std::string& type) const; + GModelSpectral* alloc(const std::string& name) const; std::string name(const int& index) const; }; diff --git a/pyext/GModelTemporalRegistry.i b/pyext/GModelTemporalRegistry.i index dae8cf8..36627d0 100644 --- a/pyext/GModelTemporalRegistry.i +++ b/pyext/GModelTemporalRegistry.i @@ -1,7 +1,7 @@ /*************************************************************************** - * GModelTemporalRegistry.i - Temporal model registry class python I/F * + * GModelTemporalRegistry.i - Temporal model registry class * * ----------------------------------------------------------------------- * - * copyright (C) 2011 by Jurgen Knodlseder * + * copyright (C) 2011-2012 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -20,8 +20,8 @@ ***************************************************************************/ /** * @file GModelTemporalRegistry.i - * @brief GModelTemporalRegistry class python interface. - * @author J. Knodlseder + * @brief Temporal model registry class definition + * @author Juergen Knoedlseder */ %{ /* Put headers and other declarations here that are needed for compilation */ @@ -33,9 +33,10 @@ /***********************************************************************//** * @class GModelTemporalRegistry * - * @brief Interface definition for the temporal model registry class. + * @brief Interface definition for the temporal model registry class ***************************************************************************/ -class GModelTemporalRegistry { +class GModelTemporalRegistry : public GRegistry { + public: // Constructors and destructors GModelTemporalRegistry(void); @@ -45,7 +46,7 @@ public: // Methods int size(void) const { return m_number; } - GModelTemporal* alloc(const std::string& type) const; + GModelTemporal* alloc(const std::string& name) const; std::string name(const int& index) const; }; diff --git a/pyext/GObservationRegistry.i b/pyext/GObservationRegistry.i index 59f4ccc..79d3ecf 100644 --- a/pyext/GObservationRegistry.i +++ b/pyext/GObservationRegistry.i @@ -1,7 +1,7 @@ /*************************************************************************** - * GObservationRegistry.i - Observation registry class python I/F * + * GObservationRegistry.i - Observation registry class * * ----------------------------------------------------------------------- * - * copyright (C) 2011 by Juergen Knoedlseder * + * copyright (C) 2011-2012 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -20,8 +20,8 @@ ***************************************************************************/ /** * @file GObservationRegistry.i - * @brief GObservationRegistry class python interface. - * @author J. Knoedlseder + * @brief Observation registry class definition + * @author Juergen Knoedlseder */ %{ /* Put headers and other declarations here that are needed for compilation */ @@ -35,7 +35,8 @@ * * @brief Interface definition for the observation registry class ***************************************************************************/ -class GObservationRegistry { +class GObservationRegistry : public GRegistry { + public: // Constructors and destructors GObservationRegistry(void); @@ -45,8 +46,8 @@ public: // Methods int size(void) const { return m_number; } - GObservation* alloc(const std::string& instrument) const; - std::string instrument(const int& index) const; + GObservation* alloc(const std::string& name) const; + std::string name(const int& index) const; }; diff --git a/pyext/GWcsRegistry.i b/pyext/GWcsRegistry.i index 06c5ddd..348f7d6 100644 --- a/pyext/GWcsRegistry.i +++ b/pyext/GWcsRegistry.i @@ -1,7 +1,7 @@ /*************************************************************************** - * GWcsRegistry.i - Temporal model registry class python I/F * + * GWcsRegistry.i - World Coordinate Projection registry class * * ----------------------------------------------------------------------- * - * copyright (C) 2011 by Jurgen Knodlseder * + * copyright (C) 2011-2012 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -21,7 +21,7 @@ /** * @file GWcsRegistry.i * @brief World Coordinate Projection registry class interface definition - * @author J. Knodlseder + * @author Juergen Knoedlseder */ %{ /* Put headers and other declarations here that are needed for compilation */ @@ -35,7 +35,8 @@ * * @brief Interface definition for the WCS registry class ***************************************************************************/ -class GWcsRegistry { +class GWcsRegistry : public GRegistry { + public: // Constructors and destructors GWcsRegistry(void); diff --git a/pyext/gammalib/model.i b/pyext/gammalib/model.i index 128c8db..3792f35 100644 --- a/pyext/gammalib/model.i +++ b/pyext/gammalib/model.i @@ -29,6 +29,7 @@ /* __ Include interface classes __________________________________________ */ %import(module="gammalib.base") "GBase.i"; +%import(module="gammalib.base") "GRegistry.i"; /* __ Make sure that exceptions are catched ______________________________ */ %import(module="gammalib.support") "GException.i"; diff --git a/pyext/gammalib/obs.i b/pyext/gammalib/obs.i index ecbdb2f..48749bd 100644 --- a/pyext/gammalib/obs.i +++ b/pyext/gammalib/obs.i @@ -29,6 +29,7 @@ /* __ Include interface classes __________________________________________ */ %import(module="gammalib.base") "GBase.i"; +%import(module="gammalib.base") "GRegistry.i"; /* __ Make sure that exceptions are catched ______________________________ */ %import(module="gammalib.support") "GException.i"; diff --git a/pyext/gammalib/sky.i b/pyext/gammalib/sky.i index 3664c8b..ba7059b 100644 --- a/pyext/gammalib/sky.i +++ b/pyext/gammalib/sky.i @@ -29,6 +29,7 @@ /* __ Include interface classes __________________________________________ */ %import(module="gammalib.base") "GBase.i"; +%import(module="gammalib.base") "GRegistry.i"; /* __ Make sure that exceptions are catched ______________________________ */ %import(module="gammalib.support") "GException.i"; diff --git a/src/model/GModelRadialRegistry.cpp b/src/model/GModelRadialRegistry.cpp index 251d12f..6b9edab 100644 --- a/src/model/GModelRadialRegistry.cpp +++ b/src/model/GModelRadialRegistry.cpp @@ -1,7 +1,7 @@ /*************************************************************************** - * GModelRadialRegistry.cpp - Radial spatial model registry class * + * GModelRadialRegistry.cpp - Radial model registry class * * ----------------------------------------------------------------------- * - * copyright (C) 2011 by Jurgen Knodlseder * + * copyright (C) 2011-2012 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -20,8 +20,8 @@ ***************************************************************************/ /** * @file GModelRadialRegistry.cpp - * @brief Radial spatial model class interface implementation - * @author J. Knodlseder + * @brief Radial model registry class interface implementation + * @author Juergen Knoedlseder */ /* __ Includes ___________________________________________________________ */ @@ -64,8 +64,9 @@ GModelRadialRegistry::GModelRadialRegistry(void) // Debug option: Show actual registry #if G_DEBUG_REGISTRY std::cout << "GModelRadialRegistry(void): "; - for (int i = 0; i < m_number; ++i) + for (int i = 0; i < m_number; ++i) { std::cout << "\"" << m_names[i] << "\" "; + } std::cout << std::endl; #endif @@ -77,7 +78,7 @@ GModelRadialRegistry::GModelRadialRegistry(void) /***********************************************************************//** * @brief Model constructor * - * @param[in] model Radial spatial model pointer. + * @param[in] model Radial model pointer. ***************************************************************************/ GModelRadialRegistry::GModelRadialRegistry(const GModelRadial* model) { @@ -118,8 +119,9 @@ GModelRadialRegistry::GModelRadialRegistry(const GModelRadial* model) // Debug option: Show actual registry #if G_DEBUG_REGISTRY std::cout << "GModelRadialRegistry(const GModelRadial*): "; - for (int i = 0; i < m_number; ++i) + for (int i = 0; i < m_number; ++i) { std::cout << "\"" << m_names[i] << "\" "; + } std::cout << std::endl; #endif @@ -169,6 +171,7 @@ GModelRadialRegistry::~GModelRadialRegistry(void) * @brief Assignment operator * * @param[in] registry Registry. + * @return Reference to registry. ***************************************************************************/ GModelRadialRegistry& GModelRadialRegistry::operator= (const GModelRadialRegistry& registry) { @@ -198,22 +201,23 @@ GModelRadialRegistry& GModelRadialRegistry::operator= (const GModelRadialRegistr ==========================================================================*/ /***********************************************************************//** - * @brief Allocate radial model of given type + * @brief Allocate radial model of given name * - * @param[in] type Radial model type. + * @param[in] name Radial model name. + * @return Pointer to model (NULL if name is not registered). * - * Returns a pointer to a void radial spatial model instance of the specified - * type. If the type has not been found in the registry, a NULL pointer is + * Returns a pointer to a void radial model instance of the specified name. + * If the name has not been found in the registry, a NULL pointer is * returned. ***************************************************************************/ -GModelRadial* GModelRadialRegistry::alloc(const std::string& type) const +GModelRadial* GModelRadialRegistry::alloc(const std::string& name) const { // Initialise radial model GModelRadial* model = NULL; // Search for model in registry for (int i = 0; i < m_number; ++i) { - if (m_names[i] == type) { + if (m_names[i] == name) { model = m_models[i]->clone(); break; } @@ -228,6 +232,7 @@ GModelRadial* GModelRadialRegistry::alloc(const std::string& type) const * @brief Returns model name * * @param[in] index Model index [0,...,size()-1]. + * @return Model name. * * @exception GException::out_of_range * Model index is out of range. @@ -236,8 +241,9 @@ std::string GModelRadialRegistry::name(const int& index) const { // Compile option: raise exception if index is out of range #if defined(G_RANGE_CHECK) - if (index < 0 || index >= size()) + if (index < 0 || index >= size()) { throw GException::out_of_range(G_NAME, index, 0, size()-1); + } #endif // Return name @@ -247,6 +253,8 @@ std::string GModelRadialRegistry::name(const int& index) const /***********************************************************************//** * @brief Print registry information + * + * @return Registry content. ***************************************************************************/ std::string GModelRadialRegistry::print(void) const { @@ -303,41 +311,3 @@ void GModelRadialRegistry::free_members(void) // Return return; } - - -/*========================================================================== - = = - = Friends = - = = - ==========================================================================*/ - -/***********************************************************************//** - * @brief Output operator - * - * @param[in] os Output stream. - * @param[in] registry Radial spatial model registry. - ***************************************************************************/ -std::ostream& operator<< (std::ostream& os, const GModelRadialRegistry& registry) -{ - // Write registry in output stream - os << registry.print(); - - // Return output stream - return os; -} - - -/***********************************************************************//** - * @brief Log operator - * - * @param[in] log Logger. - * @param[in] registry Radial spatial model registry. - ***************************************************************************/ -GLog& operator<< (GLog& log, const GModelRadialRegistry& registry) -{ - // Write registry into logger - log << registry.print(); - - // Return logger - return log; -} diff --git a/src/model/GModelRegistry.cpp b/src/model/GModelRegistry.cpp index 44fa008..0d323d8 100644 --- a/src/model/GModelRegistry.cpp +++ b/src/model/GModelRegistry.cpp @@ -1,7 +1,7 @@ /*************************************************************************** - * GModelRegistry.cpp - Spatial model registry class * + * GModelRegistry.cpp - Model registry class * * ----------------------------------------------------------------------- * - * copyright (C) 2011 by Jurgen Knodlseder * + * copyright (C) 2011-2012 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -20,8 +20,8 @@ ***************************************************************************/ /** * @file GModelRegistry.cpp - * @brief GModelRegistry class interface definition - * @author J. Knodlseder + * @brief Model registry class implementation + * @author Juergen Knoedlseder */ /* __ Includes ___________________________________________________________ */ @@ -65,8 +65,9 @@ GModelRegistry::GModelRegistry(void) // Debug option: Show actual registry #if G_DEBUG_REGISTRY std::cout << "GModelRegistry(void): "; - for (int i = 0; i < m_number; ++i) + for (int i = 0; i < m_number; ++i) { std::cout << "\"" << m_names[i] << "\" "; + } std::cout << std::endl; #endif @@ -77,6 +78,11 @@ GModelRegistry::GModelRegistry(void) /***********************************************************************//** * @brief Model constructor + * + * @param[in] model Model. + * + * Construct registry by adding a model to the registry. This is the standard + * constructor that is used to register a new model to GammaLib. ***************************************************************************/ GModelRegistry::GModelRegistry(const GModel* model) { @@ -117,8 +123,9 @@ GModelRegistry::GModelRegistry(const GModel* model) // Debug option: Show actual registry #if G_DEBUG_REGISTRY std::cout << "GModelRegistry(const GModel*): "; - for (int i = 0; i < m_number; ++i) + for (int i = 0; i < m_number; ++i) { std::cout << "\"" << m_names[i] << "\" "; + } std::cout << std::endl; #endif @@ -168,6 +175,7 @@ GModelRegistry::~GModelRegistry(void) * @brief Assignment operator * * @param[in] registry Registry. + * @return Reference to registry. ***************************************************************************/ GModelRegistry& GModelRegistry::operator= (const GModelRegistry& registry) { @@ -197,21 +205,22 @@ GModelRegistry& GModelRegistry::operator= (const GModelRegistry& registry) ==========================================================================*/ /***********************************************************************//** - * @brief Allocate model of given type + * @brief Allocate model of given name * - * @param[in] type Model type. + * @param[in] name Model name. + * @return Pointer to model (NULL if name is not registered). * - * Returns a pointer to a void model instance of the specified type. If the - * type has not been found in the registry, a NULL pointer is returned. + * Returns a pointer to a void model instance of the specified name. If the + * name has not been found in the registry, a NULL pointer is returned. ***************************************************************************/ -GModel* GModelRegistry::alloc(const std::string& type) const +GModel* GModelRegistry::alloc(const std::string& name) const { // Initialise model GModel* model = NULL; // Search for model in registry for (int i = 0; i < m_number; ++i) { - if (m_names[i] == type) { + if (m_names[i] == name) { model = m_models[i]->clone(); break; } @@ -226,6 +235,7 @@ GModel* GModelRegistry::alloc(const std::string& type) const * @brief Returns model name * * @param[in] index Model index [0,...,size()-1]. + * @return Model name. * * @exception GException::out_of_range * Model index is out of range. @@ -234,8 +244,9 @@ std::string GModelRegistry::name(const int& index) const { // Compile option: raise exception if index is out of range #if defined(G_RANGE_CHECK) - if (index < 0 || index >= size()) + if (index < 0 || index >= size()) { throw GException::out_of_range(G_NAME, index, 0, size()-1); + } #endif // Return name @@ -245,6 +256,8 @@ std::string GModelRegistry::name(const int& index) const /***********************************************************************//** * @brief Print registry information + * + * @return Registry content. ***************************************************************************/ std::string GModelRegistry::print(void) const { @@ -301,41 +314,3 @@ void GModelRegistry::free_members(void) // Return return; } - - -/*========================================================================== - = = - = Friends = - = = - ==========================================================================*/ - -/***********************************************************************//** - * @brief Output operator - * - * @param[in] os Output stream. - * @param[in] registry Model registry. - ***************************************************************************/ -std::ostream& operator<< (std::ostream& os, const GModelRegistry& registry) -{ - // Write registry in output stream - os << registry.print(); - - // Return output stream - return os; -} - - -/***********************************************************************//** - * @brief Log operator - * - * @param[in] log Logger. - * @param[in] registry Model registry. - ***************************************************************************/ -GLog& operator<< (GLog& log, const GModelRegistry& registry) -{ - // Write registry into logger - log << registry.print(); - - // Return logger - return log; -} diff --git a/src/model/GModelSpatialRegistry.cpp b/src/model/GModelSpatialRegistry.cpp index a592ac9..4678ae8 100644 --- a/src/model/GModelSpatialRegistry.cpp +++ b/src/model/GModelSpatialRegistry.cpp @@ -1,7 +1,7 @@ /*************************************************************************** - * GModelSpatialRegistry.cpp - Spatial model registry class * + * GModelSpatialRegistry.cpp - Spatial model registry class * * ----------------------------------------------------------------------- * - * copyright (C) 2011 by Jurgen Knodlseder * + * copyright (C) 2011-2012 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -20,7 +20,7 @@ ***************************************************************************/ /** * @file GModelSpatialRegistry.cpp - * @brief GModelSpatialRegistry class interface definition + * @brief Spatial model registry class implemenation * @author J. Knodlseder */ @@ -64,8 +64,9 @@ GModelSpatialRegistry::GModelSpatialRegistry(void) // Debug option: Show actual registry #if G_DEBUG_REGISTRY std::cout << "GModelSpatialRegistry(void): "; - for (int i = 0; i < m_number; ++i) + for (int i = 0; i < m_number; ++i) { std::cout << "\"" << m_names[i] << "\" "; + } std::cout << std::endl; #endif @@ -76,6 +77,11 @@ GModelSpatialRegistry::GModelSpatialRegistry(void) /***********************************************************************//** * @brief Model constructor + * + * @param[in] model Model. + * + * Construct registry by adding a model to the registry. This is the standard + * constructor that is used to register a new model to GammaLib. ***************************************************************************/ GModelSpatialRegistry::GModelSpatialRegistry(const GModelSpatial* model) { @@ -116,8 +122,9 @@ GModelSpatialRegistry::GModelSpatialRegistry(const GModelSpatial* model) // Debug option: Show actual registry #if G_DEBUG_REGISTRY std::cout << "GModelSpatialRegistry(const GModelSpatial*): "; - for (int i = 0; i < m_number; ++i) + for (int i = 0; i < m_number; ++i) { std::cout << "\"" << m_names[i] << "\" "; + } std::cout << std::endl; #endif @@ -167,6 +174,7 @@ GModelSpatialRegistry::~GModelSpatialRegistry(void) * @brief Assignment operator * * @param[in] registry Registry. + * @return Reference to registry. ***************************************************************************/ GModelSpatialRegistry& GModelSpatialRegistry::operator= (const GModelSpatialRegistry& registry) { @@ -196,22 +204,23 @@ GModelSpatialRegistry& GModelSpatialRegistry::operator= (const GModelSpatialRegi ==========================================================================*/ /***********************************************************************//** - * @brief Allocate spatial model of given type + * @brief Allocate spatial model of given name * - * @param[in] type Spatial model type. + * @param[in] name Model name. + * @return Pointer to model (NULL if name is not registered). * * Returns a pointer to a void spatial model instance of the specified - * type. If the type has not been found in the registry, a NULL pointer is + * name. If the name has not been found in the registry, a NULL pointer is * returned. ***************************************************************************/ -GModelSpatial* GModelSpatialRegistry::alloc(const std::string& type) const +GModelSpatial* GModelSpatialRegistry::alloc(const std::string& name) const { // Initialise spatial model GModelSpatial* model = NULL; // Search for model in registry for (int i = 0; i < m_number; ++i) { - if (m_names[i] == type) { + if (m_names[i] == name) { model = m_models[i]->clone(); break; } @@ -226,6 +235,7 @@ GModelSpatial* GModelSpatialRegistry::alloc(const std::string& type) const * @brief Returns model name * * @param[in] index Model index [0,...,size()-1]. + * @return Model name. * * @exception GException::out_of_range * Model index is out of range. @@ -234,8 +244,9 @@ std::string GModelSpatialRegistry::name(const int& index) const { // Compile option: raise exception if index is out of range #if defined(G_RANGE_CHECK) - if (index < 0 || index >= size()) + if (index < 0 || index >= size()) { throw GException::out_of_range(G_NAME, index, 0, size()-1); + } #endif // Return name @@ -245,6 +256,8 @@ std::string GModelSpatialRegistry::name(const int& index) const /***********************************************************************//** * @brief Print registry information + * + * @return Registry content. ***************************************************************************/ std::string GModelSpatialRegistry::print(void) const { @@ -301,41 +314,3 @@ void GModelSpatialRegistry::free_members(void) // Return return; } - - -/*========================================================================== - = = - = Friends = - = = - ==========================================================================*/ - -/***********************************************************************//** - * @brief Output operator - * - * @param[in] os Output stream. - * @param[in] registry Spatial model registry. - ***************************************************************************/ -std::ostream& operator<< (std::ostream& os, const GModelSpatialRegistry& registry) -{ - // Write registry in output stream - os << registry.print(); - - // Return output stream - return os; -} - - -/***********************************************************************//** - * @brief Log operator - * - * @param[in] log Logger. - * @param[in] registry Spatial model registry. - ***************************************************************************/ -GLog& operator<< (GLog& log, const GModelSpatialRegistry& registry) -{ - // Write registry into logger - log << registry.print(); - - // Return logger - return log; -} diff --git a/src/model/GModelSpectralRegistry.cpp b/src/model/GModelSpectralRegistry.cpp index 7f2e1eb..667001b 100644 --- a/src/model/GModelSpectralRegistry.cpp +++ b/src/model/GModelSpectralRegistry.cpp @@ -1,7 +1,7 @@ /*************************************************************************** - * GModelSpectralRegistry.cpp - Spectral model registry class * + * GModelSpectralRegistry.cpp - Spectral model registry class * * ----------------------------------------------------------------------- * - * copyright (C) 2011 by Jurgen Knodlseder * + * copyright (C) 2011-2012 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -20,8 +20,8 @@ ***************************************************************************/ /** * @file GModelSpectralRegistry.cpp - * @brief GModelSpectralRegistry class interface definition - * @author J. Knodlseder + * @brief Spectral model registry class implementation + * @author Juergen Knoedlseder */ /* __ Includes ___________________________________________________________ */ @@ -77,6 +77,8 @@ GModelSpectralRegistry::GModelSpectralRegistry(void) /***********************************************************************//** * @brief Model constructor + * + * @param[in] model Model. ***************************************************************************/ GModelSpectralRegistry::GModelSpectralRegistry(const GModelSpectral* model) { @@ -117,8 +119,9 @@ GModelSpectralRegistry::GModelSpectralRegistry(const GModelSpectral* model) // Debug option: Show actual registry #if G_DEBUG_REGISTRY std::cout << "GModelSpectralRegistry(const GModelSpatial*): "; - for (int i = 0; i < m_number; ++i) + for (int i = 0; i < m_number; ++i) { std::cout << "\"" << m_names[i] << "\" "; + } std::cout << std::endl; #endif @@ -168,6 +171,7 @@ GModelSpectralRegistry::~GModelSpectralRegistry(void) * @brief Assignment operator * * @param[in] registry Registry. + * @return Reference to registry. ***************************************************************************/ GModelSpectralRegistry& GModelSpectralRegistry::operator= (const GModelSpectralRegistry& registry) { @@ -197,22 +201,23 @@ GModelSpectralRegistry& GModelSpectralRegistry::operator= (const GModelSpectralR ==========================================================================*/ /***********************************************************************//** - * @brief Allocate spectral model of given type + * @brief Allocate spectral model of given name * - * @param[in] type Spectral model type. + * @param[in] name Spectral model name. + * @return Pointer to spectral model (NULL if name is not registered). * - * Returns a pointer to a void spectral model instance of the specified - * type. If the type has not been found in the registry, a NULL pointer is + * Returns a pointer to a spectral model instance of the specified name. + * If the name has not been found in the registry, a NULL pointer is * returned. ***************************************************************************/ -GModelSpectral* GModelSpectralRegistry::alloc(const std::string& type) const +GModelSpectral* GModelSpectralRegistry::alloc(const std::string& name) const { // Initialise spectral model GModelSpectral* model = NULL; // Search for model in registry for (int i = 0; i < m_number; ++i) { - if (m_names[i] == type) { + if (m_names[i] == name) { model = m_models[i]->clone(); break; } @@ -227,6 +232,7 @@ GModelSpectral* GModelSpectralRegistry::alloc(const std::string& type) const * @brief Returns model name * * @param[in] index Model index [0,...,size()-1]. + * @return Model name. * * @exception GException::out_of_range * Model index is out of range. @@ -235,8 +241,9 @@ std::string GModelSpectralRegistry::name(const int& index) const { // Compile option: raise exception if index is out of range #if defined(G_RANGE_CHECK) - if (index < 0 || index >= size()) + if (index < 0 || index >= size()) { throw GException::out_of_range(G_NAME, index, 0, size()-1); + } #endif // Return name @@ -246,6 +253,8 @@ std::string GModelSpectralRegistry::name(const int& index) const /***********************************************************************//** * @brief Print registry information + * + * @return Registry content. ***************************************************************************/ std::string GModelSpectralRegistry::print(void) const { @@ -302,41 +311,3 @@ void GModelSpectralRegistry::free_members(void) // Return return; } - - -/*========================================================================== - = = - = Friends = - = = - ==========================================================================*/ - -/***********************************************************************//** - * @brief Output operator - * - * @param[in] os Output stream. - * @param[in] registry Spectral model registry. - ***************************************************************************/ -std::ostream& operator<< (std::ostream& os, const GModelSpectralRegistry& registry) -{ - // Write registry in output stream - os << registry.print(); - - // Return output stream - return os; -} - - -/***********************************************************************//** - * @brief Log operator - * - * @param[in] log Logger. - * @param[in] registry Spectral model registry. - ***************************************************************************/ -GLog& operator<< (GLog& log, const GModelSpectralRegistry& registry) -{ - // Write registry into logger - log << registry.print(); - - // Return logger - return log; -} diff --git a/src/model/GModelTemporalRegistry.cpp b/src/model/GModelTemporalRegistry.cpp index 9213b32..e6e5d74 100644 --- a/src/model/GModelTemporalRegistry.cpp +++ b/src/model/GModelTemporalRegistry.cpp @@ -1,7 +1,7 @@ /*************************************************************************** - * GModelTemporalRegistry.cpp - Temporal model registry class * + * GModelTemporalRegistry.cpp - Temporal model registry class * * ----------------------------------------------------------------------- * - * copyright (C) 2011 by Jurgen Knodlseder * + * copyright (C) 2011-2012 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -20,8 +20,8 @@ ***************************************************************************/ /** * @file GModelTemporalRegistry.cpp - * @brief GModelTemporalRegistry class interface definition - * @author J. Knodlseder + * @brief Temporal model registry class implementation + * @author Juergen Knoedlseder */ /* __ Includes ___________________________________________________________ */ @@ -77,6 +77,8 @@ GModelTemporalRegistry::GModelTemporalRegistry(void) /***********************************************************************//** * @brief Model constructor + * + * @param[in] model Model. ***************************************************************************/ GModelTemporalRegistry::GModelTemporalRegistry(const GModelTemporal* model) { @@ -117,8 +119,9 @@ GModelTemporalRegistry::GModelTemporalRegistry(const GModelTemporal* model) // Debug option: Show actual registry #if G_DEBUG_REGISTRY std::cout << "GModelTemporalRegistry(const GModelTemporal*): "; - for (int i = 0; i < m_number; ++i) + for (int i = 0; i < m_number; ++i) { std::cout << "\"" << m_names[i] << "\" "; + } std::cout << std::endl; #endif @@ -168,6 +171,7 @@ GModelTemporalRegistry::~GModelTemporalRegistry(void) * @brief Assignment operator * * @param[in] registry Registry. + * @return Reference to registry. ***************************************************************************/ GModelTemporalRegistry& GModelTemporalRegistry::operator= (const GModelTemporalRegistry& registry) { @@ -197,22 +201,23 @@ GModelTemporalRegistry& GModelTemporalRegistry::operator= (const GModelTemporalR ==========================================================================*/ /***********************************************************************//** - * @brief Allocate temporal model of given type + * @brief Allocate temporal model of given name * - * @param[in] type Temporal model type. + * @param[in] name Temporal model name. + * @return Pointer to temporal model (NULL if name is not registered). * - * Returns a pointer to a void temporal model instance of the specified - * type. If the type has not been found in the registry, a NULL pointer is + * Returns a pointer to a temporal model instance of the specified name. + * If the name has not been found in the registry, a NULL pointer is * returned. ***************************************************************************/ -GModelTemporal* GModelTemporalRegistry::alloc(const std::string& type) const +GModelTemporal* GModelTemporalRegistry::alloc(const std::string& name) const { // Initialise temporal model GModelTemporal* model = NULL; // Search for model in registry for (int i = 0; i < m_number; ++i) { - if (m_names[i] == type) { + if (m_names[i] == name) { model = m_models[i]->clone(); break; } @@ -227,6 +232,7 @@ GModelTemporal* GModelTemporalRegistry::alloc(const std::string& type) const * @brief Returns model name * * @param[in] index Model index [0,...,size()-1]. + * @return Model name. * * @exception GException::out_of_range * Model index is out of range. @@ -235,8 +241,9 @@ std::string GModelTemporalRegistry::name(const int& index) const { // Compile option: raise exception if index is out of range #if defined(G_RANGE_CHECK) - if (index < 0 || index >= size()) + if (index < 0 || index >= size()) { throw GException::out_of_range(G_NAME, index, 0, size()-1); + } #endif // Return name @@ -246,6 +253,8 @@ std::string GModelTemporalRegistry::name(const int& index) const /***********************************************************************//** * @brief Print registry information + * + * @return Registry content. ***************************************************************************/ std::string GModelTemporalRegistry::print(void) const { @@ -302,41 +311,3 @@ void GModelTemporalRegistry::free_members(void) // Return return; } - - -/*========================================================================== - = = - = Friends = - = = - ==========================================================================*/ - -/***********************************************************************//** - * @brief Output operator - * - * @param[in] os Output stream. - * @param[in] registry Temporal model registry. - ***************************************************************************/ -std::ostream& operator<< (std::ostream& os, const GModelTemporalRegistry& registry) -{ - // Write registry in output stream - os << registry.print(); - - // Return output stream - return os; -} - - -/***********************************************************************//** - * @brief Log operator - * - * @param[in] log Logger. - * @param[in] registry Temporal model registry. - ***************************************************************************/ -GLog& operator<< (GLog& log, const GModelTemporalRegistry& registry) -{ - // Write registry into logger - log << registry.print(); - - // Return logger - return log; -} diff --git a/src/obs/GException_obs.cpp b/src/obs/GException_obs.cpp index f932454..8ef499e 100644 --- a/src/obs/GException_obs.cpp +++ b/src/obs/GException_obs.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * GException_obs.cpp - observations exception handlers * * ----------------------------------------------------------------------- * - * copyright (C) 2010-2011 by Juergen Knoedlseder * + * copyright (C) 2010-2012 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -21,7 +21,7 @@ /** * @file GException_obs.cpp * @brief Observation exception handler interface implementation - * @author J. Knoedlseder + * @author Juergen Knoedlseder */ /* __ Includes ___________________________________________________________ */ @@ -320,7 +320,7 @@ GException::invalid_instrument::invalid_instrument(std::string origin, if (i > 0) { m_message += ", "; } - m_message += "\"" + registry.instrument(i) + "\""; + m_message += "\"" + registry.name(i) + "\""; } m_message += "."; } diff --git a/src/obs/GObservationRegistry.cpp b/src/obs/GObservationRegistry.cpp index 8c5e511..748e815 100644 --- a/src/obs/GObservationRegistry.cpp +++ b/src/obs/GObservationRegistry.cpp @@ -1,7 +1,7 @@ /*************************************************************************** - * GObservationRegistry.cpp - Observation registry class * + * GObservationRegistry.cpp - Observation registry class * * ----------------------------------------------------------------------- * - * copyright (C) 2011 by Juergen Knoedlseder * + * copyright (C) 2011-2012 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -20,8 +20,8 @@ ***************************************************************************/ /** * @file GObservationRegistry.cpp - * @brief GObservationRegistry class interface implementation - * @author J. Knoedlseder + * @brief Observation registry class definition + * @author Juergen Knoedlseder */ /* __ Includes ___________________________________________________________ */ @@ -77,6 +77,8 @@ GObservationRegistry::GObservationRegistry(void) /***********************************************************************//** * @brief Observation constructor + * + * @param[in] obs Observation. ***************************************************************************/ GObservationRegistry::GObservationRegistry(const GObservation* obs) { @@ -169,6 +171,7 @@ GObservationRegistry::~GObservationRegistry(void) * @brief Assignment operator * * @param[in] registry Registry. + * @return Reference to registry. ***************************************************************************/ GObservationRegistry& GObservationRegistry::operator= (const GObservationRegistry& registry) { @@ -198,22 +201,23 @@ GObservationRegistry& GObservationRegistry::operator= (const GObservationRegistr ==========================================================================*/ /***********************************************************************//** - * @brief Allocate observation of given type + * @brief Allocate observation of given name * - * @param[in] instrument Instrument name. + * @param[in] name Instrument name. + * @return Pointer to observation (NULL if name is not registered). * - * Returns a pointer to a void observation instance for a specific - * instrument. If the instrument has not been found in the registry, a NULL + * 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. ***************************************************************************/ -GObservation* GObservationRegistry::alloc(const std::string& instrument) const +GObservation* GObservationRegistry::alloc(const std::string& name) const { // Initialise observation GObservation* obs = NULL; // Search for observation in registry for (int i = 0; i < m_number; ++i) { - if (m_names[i] == instrument) { + if (m_names[i] == name) { obs = m_obs[i]->clone(); break; } @@ -228,11 +232,12 @@ GObservation* GObservationRegistry::alloc(const std::string& instrument) const * @brief Returns instrument name for a specific registered observation * * @param[in] index Observation index [0,...,size()-1]. + * @return Instrument name. * * @exception GException::out_of_range * Observation index is out of range. ***************************************************************************/ -std::string GObservationRegistry::instrument(const int& index) const +std::string GObservationRegistry::name(const int& index) const { // Compile option: raise exception if index is out of range #if defined(G_RANGE_CHECK) @@ -248,6 +253,8 @@ std::string GObservationRegistry::instrument(const int& index) const /***********************************************************************//** * @brief Print registry information + * + * @return Registry content. ***************************************************************************/ std::string GObservationRegistry::print(void) const { @@ -304,41 +311,3 @@ void GObservationRegistry::free_members(void) // Return return; } - - -/*========================================================================== - = = - = Friends = - = = - ==========================================================================*/ - -/***********************************************************************//** - * @brief Output operator - * - * @param[in] os Output stream. - * @param[in] registry Observation registry. - ***************************************************************************/ -std::ostream& operator<< (std::ostream& os, const GObservationRegistry& registry) -{ - // Write registry in output stream - os << registry.print(); - - // Return output stream - return os; -} - - -/***********************************************************************//** - * @brief Log operator - * - * @param[in] log Logger. - * @param[in] registry Observation registry. - ***************************************************************************/ -GLog& operator<< (GLog& log, const GObservationRegistry& registry) -{ - // Write registry into logger - log << registry.print(); - - // Return logger - return log; -} diff --git a/src/sky/GWcsRegistry.cpp b/src/sky/GWcsRegistry.cpp index 2e831dd..5ccb37b 100644 --- a/src/sky/GWcsRegistry.cpp +++ b/src/sky/GWcsRegistry.cpp @@ -1,7 +1,7 @@ /*************************************************************************** - * GWcsRegistry.cpp - World Coordinate Projection registry class * + * GWcsRegistry.cpp - World Coordinate Projection registry class * * ----------------------------------------------------------------------- * - * copyright (C) 2011 by Jurgen Knodlseder * + * copyright (C) 2011-2012 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -21,7 +21,7 @@ /** * @file GWcsRegistry.cpp * @brief World Coordinate Projection registry class interface implementation - * @author J. Knodlseder + * @author Juergen Knoedlseder */ /* __ Includes ___________________________________________________________ */ @@ -125,8 +125,9 @@ GWcsRegistry::GWcsRegistry(const GWcs* prj) // Debug option: Show actual registry #if G_DEBUG_REGISTRY std::cout << "GWcsRegistry(const GWcs*): "; - for (int i = 0; i < m_number; ++i) + for (int i = 0; i < m_number; ++i) { std::cout << "\"" << m_codes[i] << "\" "; + } std::cout << std::endl; #endif @@ -176,6 +177,7 @@ GWcsRegistry::~GWcsRegistry(void) * @brief Assignment operator * * @param[in] registry Registry. + * @return Reference to registry. ***************************************************************************/ GWcsRegistry& GWcsRegistry::operator= (const GWcsRegistry& registry) { @@ -208,9 +210,10 @@ GWcsRegistry& GWcsRegistry::operator= (const GWcsRegistry& registry) * @brief Allocate World Coordinate projection of given code * * @param[in] code World Coordinate System code. + * @return Pointer to WCS (NULL if code is not registered). * - * Returns a pointer to a void WCS instance of the specified code. If the - * code has not been found in the registry, a NULL pointer is returned. + * Returns a pointer to a WCS instance of the specified code. If the code has + * not been found in the registry, a NULL pointer is returned. ***************************************************************************/ GWcs* GWcsRegistry::alloc(const std::string& code) const { @@ -234,6 +237,7 @@ GWcs* GWcsRegistry::alloc(const std::string& code) const * @brief Returns projection code * * @param[in] index Projection index [0,...,size()-1]. + * @return Projection code. * * @exception GException::out_of_range * Projection index is out of range. @@ -242,8 +246,9 @@ std::string GWcsRegistry::code(const int& index) const { // Compile option: raise exception if index is out of range #if defined(G_RANGE_CHECK) - if (index < 0 || index >= size()) + if (index < 0 || index >= size()) { throw GException::out_of_range(G_CODE, index, 0, size()-1); + } #endif // Return code @@ -255,6 +260,7 @@ std::string GWcsRegistry::code(const int& index) const * @brief Returns projection name * * @param[in] index Projection index [0,...,size()-1]. + * @return Projection name. * * @exception GException::out_of_range * Projection index is out of range. @@ -263,8 +269,9 @@ std::string GWcsRegistry::name(const int& index) const { // Compile option: raise exception if index is out of range #if defined(G_RANGE_CHECK) - if (index < 0 || index >= size()) + if (index < 0 || index >= size()) { throw GException::out_of_range(G_NAME, index, 0, size()-1); + } #endif // Return name @@ -275,6 +282,8 @@ std::string GWcsRegistry::name(const int& index) const /***********************************************************************//** * @brief Return list string of projection codes * + * @return Projection code list. + * * Returns a list of the projection codes in the format 'xxx/yyy/zzz'. ***************************************************************************/ std::string GWcsRegistry::list(void) const @@ -284,8 +293,9 @@ std::string GWcsRegistry::list(void) const // Append projections for (int i = 0; i < m_number; ++i) { - if (i > 0) + if (i > 0) { result.append("/"); + } result.append(m_codes[i]); } @@ -296,6 +306,8 @@ std::string GWcsRegistry::list(void) const /***********************************************************************//** * @brief Print registry information + * + * @return Registry content. ***************************************************************************/ std::string GWcsRegistry::print(void) const { @@ -353,41 +365,3 @@ void GWcsRegistry::free_members(void) // Return return; } - - -/*========================================================================== - = = - = Friends = - = = - ==========================================================================*/ - -/***********************************************************************//** - * @brief Output operator - * - * @param[in] os Output stream. - * @param[in] registry WCS projection registry. - ***************************************************************************/ -std::ostream& operator<< (std::ostream& os, const GWcsRegistry& registry) -{ - // Write registry in output stream - os << registry.print(); - - // Return output stream - return os; -} - - -/***********************************************************************//** - * @brief Log operator - * - * @param[in] log Logger. - * @param[in] registry WCS projection registry. - ***************************************************************************/ -GLog& operator<< (GLog& log, const GWcsRegistry& registry) -{ - // Write registry into logger - log << registry.print(); - - // Return logger - return log; -} -- libgit2 0.21.4