Commit f43228e4c3886568efb5d3cbd5849f94906b07cf

Authored by Jürgen Knödlseder
1 parent 85f272a6

Derive from GBase class.

All classes now derive from GBase. ostream and GLog friends are removed since they are now implement at the GBase level.
include/GMatrix.hpp
... ... @@ -29,8 +29,6 @@
29 29  
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
32   -#include <iostream>
33   -#include "GLog.hpp"
34 32 #include "GMatrixBase.hpp"
35 33  
36 34 /* __ Forward declarations _______________________________________________ */
... ... @@ -49,10 +47,6 @@ class GSparseMatrix;
49 47 ***************************************************************************/
50 48 class GMatrix : public GMatrixBase {
51 49  
52   - // I/O friends
53   - friend std::ostream& operator<<(std::ostream& os, const GMatrix& matrix);
54   - friend GLog& operator<<(GLog& log, const GMatrix& matrix);
55   -
56 50 // Binary operator friends
57 51 friend GMatrix operator*(const double& a, const GMatrix& b);
58 52 friend GMatrix operator*(const GMatrix& a, const double& b);
... ... @@ -91,6 +85,7 @@ public:
91 85  
92 86 // Implemented pure virtual base class methods
93 87 void clear(void);
  88 + GMatrix* clone(void) const;
94 89 void transpose(void);
95 90 void invert(void);
96 91 void add_col(const GVector& vector, const int& col);
... ... @@ -179,7 +174,6 @@ GMatrix GMatrix::operator-(void) const
179 174 /***************************************************************************
180 175 * Inline methods *
181 176 ***************************************************************************/
182   -inline void GMatrix::clear(void) { set_all_elements(0.0); }
183 177 inline double GMatrix::min(void) const { return get_min_element(); }
184 178 inline double GMatrix::max(void) const { return get_max_element(); }
185 179 inline double GMatrix::sum(void) const { return get_element_sum(); }
... ...
include/GMatrixBase.hpp
... ... @@ -29,6 +29,7 @@
29 29  
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
  32 +#include "GBase.hpp"
32 33 #include "GVector.hpp"
33 34  
34 35  
... ... @@ -41,7 +42,7 @@
41 42 * common interface of the matrix objects and provides some common services
42 43 * to the derived classes.
43 44 ***************************************************************************/
44   -class GMatrixBase {
  45 +class GMatrixBase : public GBase {
45 46  
46 47 public:
47 48 // Constructors and destructors
... ... @@ -60,22 +61,23 @@ public:
60 61 virtual bool operator!=(const GMatrixBase& matrix) const;
61 62  
62 63 // Pure virtual methods
63   - virtual void clear() = 0;
64   - virtual void transpose() = 0;
65   - virtual void invert() = 0;
66   - virtual void add_col(const GVector& vector, const int& col) = 0;
67   - virtual void insert_col(const GVector& vector, const int& col) = 0;
68   - virtual GVector extract_row(const int& row) const = 0;
69   - virtual GVector extract_col(const int& col) const = 0;
70   - virtual double fill(void) const = 0;
71   - virtual double min(void) const = 0;
72   - virtual double max(void) const = 0;
73   - virtual double sum(void) const = 0;
74   - virtual std::string print(void) const = 0;
  64 + virtual void clear(void) = 0;
  65 + virtual GMatrixBase* clone(void) const = 0;
  66 + virtual void transpose(void) = 0;
  67 + virtual void invert(void) = 0;
  68 + virtual void add_col(const GVector& vector, const int& col) = 0;
  69 + virtual void insert_col(const GVector& vector, const int& col) = 0;
  70 + virtual GVector extract_row(const int& row) const = 0;
  71 + virtual GVector extract_col(const int& col) const = 0;
  72 + virtual double fill(void) const = 0;
  73 + virtual double min(void) const = 0;
  74 + virtual double max(void) const = 0;
  75 + virtual double sum(void) const = 0;
  76 + virtual std::string print(void) const = 0;
75 77  
76 78 // Implemented base class methods
77   - virtual int cols(void) const { return m_cols; }
78   - virtual int rows(void) const { return m_rows; }
  79 + virtual int cols(void) const { return m_cols; }
  80 + virtual int rows(void) const { return m_rows; }
79 81  
80 82 protected:
81 83 // Protected methods
... ...
include/GModels.hpp
... ... @@ -28,8 +28,6 @@
28 28 #define GMODELS_HPP
29 29  
30 30 /* __ Includes ___________________________________________________________ */
31   -#include <iostream>
32   -#include "GLog.hpp"
33 31 #include "GOptimizerPars.hpp"
34 32 #include "GModel.hpp"
35 33 #include "GXml.hpp"
... ... @@ -54,10 +52,6 @@ class GObservation;
54 52 ***************************************************************************/
55 53 class GModels : public GOptimizerPars {
56 54  
57   - // I/O friends
58   - friend std::ostream& operator<<(std::ostream& os, const GModels& models);
59   - friend GLog& operator<<(GLog& log, const GModels& models);
60   -
61 55 public:
62 56 // Constructors and destructors
63 57 GModels(void);
... ...
include/GObservations.hpp
1 1 /***************************************************************************
2 2 * GObservations.hpp - Observation container class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2009-2011 by Jurgen Knodlseder *
  4 + * copyright (C) 2009-2012 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -21,7 +21,7 @@
21 21 /**
22 22 * @file GObservations.hpp
23 23 * @brief Observations container class interface definition
24   - * @author J. Knodlseder
  24 + * @author Juergen Knoedlseder
25 25 */
26 26  
27 27 #ifndef GOBSERVATIONS_HPP
... ... @@ -30,8 +30,7 @@
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
32 32 #include <vector>
33   -#include <iostream>
34   -#include "GLog.hpp"
  33 +#include "GBase.hpp"
35 34 #include "GObservation.hpp"
36 35 #include "GEvent.hpp"
37 36 #include "GOptimizer.hpp"
... ... @@ -61,11 +60,7 @@
61 60 * @todo Use std::vector for building a list of pointers to observations
62 61 * instead of a proper memory handling implementation.
63 62 ***************************************************************************/
64   -class GObservations {
65   -
66   - // I/O friends
67   - friend std::ostream& operator<<(std::ostream& os, const GObservations& obs);
68   - friend GLog& operator<<(GLog& log, const GObservations& obs);
  63 +class GObservations : public GBase {
69 64  
70 65 public:
71 66 // Constructors and destructors
... ... @@ -80,19 +75,20 @@ public:
80 75 const GObservation& operator[](const int& index) const;
81 76  
82 77 // Methods
83   - void clear(void);
84   - int size(void) const { return m_obs.size(); }
85   - void append(GObservation& obs);
86   - void load(const std::string& filename);
87   - void save(const std::string& filename) const;
88   - void read(const GXml& xml);
89   - void write(GXml& xml) const;
90   - void models(const GModels& models) { m_models=models;}
91   - void models(const std::string& filename);
92   - GModels& models(void) { return m_models; }
93   - void optimize(GOptimizer& opt);
94   - double npred(void) const { return m_npred; }
95   - std::string print(void) const;
  78 + void clear(void);
  79 + GObservations* clone(void) const;
  80 + int size(void) const { return m_obs.size(); }
  81 + void append(GObservation& obs);
  82 + void load(const std::string& filename);
  83 + void save(const std::string& filename) const;
  84 + void read(const GXml& xml);
  85 + void write(GXml& xml) const;
  86 + void models(const GModels& models) { m_models=models;}
  87 + void models(const std::string& filename);
  88 + GModels& models(void) { return m_models; }
  89 + void optimize(GOptimizer& opt);
  90 + double npred(void) const { return m_npred; }
  91 + std::string print(void) const;
96 92  
97 93 // Event iterator
98 94 class iterator {
... ... @@ -165,9 +161,9 @@ public:
165 161  
166 162 protected:
167 163 // Protected methods
168   - void init_members(void);
169   - void copy_members(const GObservations& obs);
170   - void free_members(void);
  164 + void init_members(void);
  165 + void copy_members(const GObservations& obs);
  166 + void free_members(void);
171 167  
172 168 // Protected members
173 169 std::vector<GObservation*> m_obs; //!< List of observations
... ...
include/GOptimizerPars.hpp
1 1 /***************************************************************************
2   - * GOptimizerPars.hpp - Optimizer parameter container class *
  2 + * GOptimizerPars.hpp - Optimizer parameters abstract base class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2009-2011 by Jurgen Knodlseder *
  4 + * copyright (C) 2009-2012 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -20,8 +20,8 @@
20 20 ***************************************************************************/
21 21 /**
22 22 * @file GOptimizerPars.hpp
23   - * @brief Optimizer parameter container class interface definition
24   - * @author J. Knodlseder
  23 + * @brief Optimizer parameters abstract base class definition
  24 + * @author Juergen Knoedlseder
25 25 */
26 26  
27 27 #ifndef GOPTIMIZERPARS_HPP
... ... @@ -29,8 +29,7 @@
29 29  
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
32   -#include <iostream>
33   -#include "GLog.hpp"
  32 +#include "GBase.hpp"
34 33 #include "GModelPar.hpp"
35 34  
36 35  
... ... @@ -53,11 +52,7 @@
53 52 * very clean. We should think about how we can make this a clean
54 53 * thing ...
55 54 ***************************************************************************/
56   -class GOptimizerPars {
57   -
58   - // I/O friends
59   - friend std::ostream& operator<<(std::ostream& os, const GOptimizerPars& pars);
60   - friend GLog& operator<<(GLog& log, const GOptimizerPars& pars);
  55 +class GOptimizerPars : public GBase {
61 56  
62 57 public:
63 58 // Constructors and destructors
... ... @@ -69,11 +64,13 @@ public:
69 64 virtual GOptimizerPars& operator=(const GOptimizerPars& pars);
70 65  
71 66 // Methods
72   - int npars(void) const { return m_pars.size(); }
73   - int nfree(void) const;
74   - GModelPar& par(const int& index);
75   - const GModelPar& par(const int& index) const;
76   - std::string print(void) const;
  67 + virtual void clear(void);
  68 + virtual GOptimizerPars* clone(void) const;
  69 + virtual int npars(void) const { return m_pars.size(); }
  70 + virtual int nfree(void) const;
  71 + virtual GModelPar& par(const int& index);
  72 + virtual const GModelPar& par(const int& index) const;
  73 + virtual std::string print(void) const;
77 74  
78 75 protected:
79 76 // Protected methods
... ...
include/GPhoton.hpp
1 1 /***************************************************************************
2 2 * GPhoton.hpp - Photon class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2011 by Jurgen Knodlseder *
  4 + * copyright (C) 2011-2012 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -21,7 +21,7 @@
21 21 /**
22 22 * @file GPhoton.hpp
23 23 * @brief Photon class definition.
24   - * @author J. Knodlseder
  24 + * @author Juergen Knoedlseder
25 25 */
26 26  
27 27 #ifndef GPHOTON_HPP
... ... @@ -30,8 +30,7 @@
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <vector>
32 32 #include <string>
33   -#include <iostream>
34   -#include "GLog.hpp"
  33 +#include "GBase.hpp"
35 34 #include "GSkyDir.hpp"
36 35 #include "GEnergy.hpp"
37 36 #include "GTime.hpp"
... ... @@ -46,11 +45,7 @@
46 45 * photon arrival direction, its energy and its arrival time. This class is
47 46 * mainly used for Monte Carlo simulations.
48 47 ***************************************************************************/
49   -class GPhoton {
50   -
51   - // I/O friends
52   - friend std::ostream& operator<< (std::ostream& os, const GPhoton& ph);
53   - friend GLog& operator<< (GLog& log, const GPhoton& ph);
  48 +class GPhoton : public GBase {
54 49  
55 50 // Operator friends
56 51 friend bool operator== (const GPhoton &a, const GPhoton &b);
... ... @@ -67,6 +62,7 @@ public:
67 62  
68 63 // Methods
69 64 void clear(void);
  65 + GPhoton* clone(void) const;
70 66 const GSkyDir& dir(void) const { return m_dir; }
71 67 const GEnergy& energy(void) const { return m_energy; }
72 68 const GTime& time(void) const { return m_time; }
... ...
include/GSkyDir.hpp
1 1 /***************************************************************************
2 2 * GSkyDir.hpp - Class that implements a sky direction *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2008-2011 by Jurgen Knodlseder *
  4 + * copyright (C) 2008-2012 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -21,7 +21,7 @@
21 21 /**
22 22 * @file GSkyDir.hpp
23 23 * @brief Sky direction class interface definition
24   - * @author J. Knodlseder
  24 + * @author Juergen Knoedlseder
25 25 */
26 26  
27 27 #ifndef GSKYDIR_HPP
... ... @@ -29,10 +29,8 @@
29 29  
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
32   -#include <iostream>
33   -#include "GLog.hpp"
  32 +#include "GBase.hpp"
34 33 #include "GVector.hpp"
35   -#include "GMatrix.hpp"
36 34  
37 35  
38 36 /***********************************************************************//**
... ... @@ -49,11 +47,7 @@
49 47 * if requested. Coordinates can be given and returned in radians or in
50 48 * degrees. Note that the epoch for celestial coordinates is fixed to J2000.
51 49 ***************************************************************************/
52   -class GSkyDir {
53   -
54   - // I/O friends
55   - friend std::ostream& operator<<(std::ostream& os, const GSkyDir& dir);
56   - friend GLog& operator<<(GLog& log, const GSkyDir& dir);
  50 +class GSkyDir : public GBase {
57 51  
58 52 // Operator friends
59 53 friend bool operator==(const GSkyDir &a, const GSkyDir &b);
... ... @@ -70,6 +64,7 @@ public:
70 64  
71 65 // Methods
72 66 void clear(void);
  67 + GSkyDir* clone(void) const;
73 68 void radec(const double& ra, const double& dec);
74 69 void radec_deg(const double& ra, const double& dec);
75 70 void lb(const double& l, const double& b);
... ...
include/GSkyPixel.hpp
1 1 /***************************************************************************
2 2 * GSkyPixel.cpp - Class that implements a 2D sky pixel index *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2010-2012 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -20,8 +20,8 @@
20 20 ***************************************************************************/
21 21 /**
22 22 * @file GSkyPixel.hpp
23   - * @brief GSkyPixel class definition.
24   - * @author J. Knodlseder
  23 + * @brief Sky pixel class definition
  24 + * @author Juergen Knoedlseder
25 25 */
26 26  
27 27 #ifndef GSKYPIXEL_HPP
... ... @@ -29,8 +29,7 @@
29 29  
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
32   -#include <iostream>
33   -#include "GLog.hpp"
  32 +#include "GBase.hpp"
34 33  
35 34  
36 35 /***********************************************************************//**
... ... @@ -38,11 +37,7 @@
38 37 *
39 38 * @brief GSkyPixel class interface defintion
40 39 ***************************************************************************/
41   -class GSkyPixel {
42   -
43   - // I/O friends
44   - friend std::ostream& operator<< (std::ostream& os, const GSkyPixel& pixel);
45   - friend GLog& operator<< (GLog& log, const GSkyPixel& pixel);
  40 +class GSkyPixel : public GBase {
46 41  
47 42 public:
48 43 // Constructors and destructors
... ... @@ -55,6 +50,8 @@ public:
55 50 GSkyPixel& operator= (const GSkyPixel& pixel);
56 51  
57 52 // Methods
  53 + void clear(void);
  54 + GSkyPixel* clone(void) const;
58 55 void x(const double& x);
59 56 void y(const double& y);
60 57 double x(void) const;
... ...
include/GSparseMatrix.hpp
... ... @@ -29,8 +29,6 @@
29 29  
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
32   -#include <iostream>
33   -#include "GLog.hpp"
34 32 #include "GMatrixBase.hpp"
35 33  
36 34 /* __ Definitions ________________________________________________________ */
... ... @@ -63,10 +61,6 @@ class GSparseMatrix : public GMatrixBase {
63 61 friend class GSparseSymbolic;
64 62 friend class GSparseNumeric;
65 63  
66   - // I/O friends
67   - friend std::ostream& operator<<(std::ostream& os, const GSparseMatrix& matrix);
68   - friend GLog& operator<<(GLog& log, const GSparseMatrix& matrix);
69   -
70 64 // Binary operator friends
71 65 friend GSparseMatrix operator*(const double& a, const GSparseMatrix& b);
72 66 friend GSparseMatrix operator*(const GSparseMatrix& a, const double& b);
... ... @@ -119,34 +113,35 @@ public:
119 113 GSparseMatrix& operator/=(const double& scalar);
120 114  
121 115 // Implemented pure virtual base class methods
122   - void clear(void);
123   - void transpose(void);
124   - void invert(void);
125   - void add_col(const GVector& vector, const int& col);
126   - void insert_col(const GVector& vector, const int& col);
127   - GVector extract_row(const int& row) const;
128   - GVector extract_col(const int& col) const;
129   - double fill(void) const;
130   - double min(void) const;
131   - double max(void) const;
132   - double sum(void) const;
133   - std::string print(void) const;
  116 + void clear(void);
  117 + GSparseMatrix* clone(void) const;
  118 + void transpose(void);
  119 + void invert(void);
  120 + void add_col(const GVector& vector, const int& col);
  121 + void insert_col(const GVector& vector, const int& col);
  122 + GVector extract_row(const int& row) const;
  123 + GVector extract_col(const int& col) const;
  124 + double fill(void) const;
  125 + double min(void) const;
  126 + double max(void) const;
  127 + double sum(void) const;
  128 + std::string print(void) const;
134 129  
135 130 // Other methods
136   - void add_col(const double* values, const int* rows,
137   - int number, const int& col);
138   - void insert_col(const double* values, const int* rows,
139   - int number, const int& col);
140   - void cholesky_decompose(bool compress = true);
141   - GVector cholesky_solver(const GVector& vector, bool compress = true);
142   - void cholesky_invert(bool compress = true);
143   - void set_mem_block(const int& block);
144   - void stack_init(const int& size = 0, const int& entries = 0);
145   - int stack_push_column(const GVector& vector, const int& col);
146   - int stack_push_column(const double* values, const int* rows,
147   - const int& number, const int& col);
148   - void stack_flush(void);
149   - void stack_destroy(void);
  131 + void add_col(const double* values, const int* rows,
  132 + int number, const int& col);
  133 + void insert_col(const double* values, const int* rows,
  134 + int number, const int& col);
  135 + void cholesky_decompose(bool compress = true);
  136 + GVector cholesky_solver(const GVector& vector, bool compress = true);
  137 + void cholesky_invert(bool compress = true);
  138 + void set_mem_block(const int& block);
  139 + void stack_init(const int& size = 0, const int& entries = 0);
  140 + int stack_push_column(const GVector& vector, const int& col);
  141 + int stack_push_column(const double* values, const int* rows,
  142 + const int& number, const int& col);
  143 + void stack_flush(void);
  144 + void stack_destroy(void);
150 145  
151 146 private:
152 147 // Private methods
... ...
include/GSymMatrix.hpp
... ... @@ -29,8 +29,6 @@
29 29  
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
32   -#include <iostream>
33   -#include "GLog.hpp"
34 32 #include "GMatrixBase.hpp"
35 33  
36 34 /* __ Forward declarations _______________________________________________ */
... ... @@ -49,10 +47,6 @@ class GSparseMatrix;
49 47 ***************************************************************************/
50 48 class GSymMatrix : public GMatrixBase {
51 49  
52   - // I/O friends
53   - friend std::ostream& operator<<(std::ostream& os, const GSymMatrix& matrix);
54   - friend GLog& operator<<(GLog& log, const GSymMatrix& matrix);
55   -
56 50 // Binary operator friends
57 51 friend GSymMatrix operator*(const double& a, const GSymMatrix& b);
58 52 friend GSymMatrix operator*(const GSymMatrix& a, const double& b);
... ... @@ -91,6 +85,7 @@ public:
91 85  
92 86 // Implemented pure virtual base class methods
93 87 virtual void clear(void);
  88 + virtual GSymMatrix* clone(void) const;
94 89 virtual void transpose(void) { return; }
95 90 virtual void invert(void);
96 91 virtual void add_col(const GVector& vector, const int& col);
... ... @@ -175,7 +170,6 @@ GSymMatrix GSymMatrix::operator-(void) const
175 170 /***************************************************************************
176 171 * Inline methods *
177 172 ***************************************************************************/
178   -inline void GSymMatrix::clear(void) { set_all_elements(0.0); }
179 173 inline double GSymMatrix::min(void) const { return get_min_element(); }
180 174 inline double GSymMatrix::max(void) const { return get_max_element(); }
181 175  
... ...
include/GTestCase.hpp
... ... @@ -30,6 +30,7 @@
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <iostream>
32 32 #include <string>
  33 +#include "GBase.hpp"
33 34  
34 35  
35 36 /***********************************************************************//**
... ... @@ -44,7 +45,7 @@
44 45 * Furthermore, the test case knows whether the test succeeded or failed,
45 46 * and whether the test was an error or a failure test.
46 47 ***************************************************************************/
47   -class GTestCase{
  48 +class GTestCase : public GBase {
48 49  
49 50 public:
50 51 // public enumerators
... ... @@ -63,6 +64,8 @@ public:
63 64 GTestCase& operator= (const GTestCase& test);
64 65  
65 66 // Methods
  67 + void clear(void);
  68 + GTestCase* clone(void) const;
66 69 std::string name(void) const;
67 70 void name(const std::string& name);
68 71 std::string message(void) const;
... ...
include/GTestSuites.hpp
... ... @@ -30,10 +30,10 @@
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
32 32 #include <vector>
  33 +#include "GBase.hpp"
  34 +#include "GLog.hpp"
33 35 #include "GXml.hpp"
34   -#include "GTools.hpp"
35 36 #include "GTestSuite.hpp"
36   -#include "GTestCase.hpp"
37 37  
38 38  
39 39 /***********************************************************************//**
... ... @@ -45,7 +45,7 @@
45 45 *
46 46 * @todo Detailed description
47 47 ***************************************************************************/
48   -class GTestSuites {
  48 +class GTestSuites : public GBase {
49 49  
50 50 public:
51 51 // Constructors and destructors
... ... @@ -60,19 +60,20 @@ public:
60 60 const GTestSuite& operator[](const int& index) const;
61 61  
62 62 // Methods
63   - void clear(void);
64   - int size(void) const;
65   - void append(GTestSuite& suite);
66   - bool run(void);
67   - void save(const std::string& filename) const;
68   - std::string name(void) const;
69   - void name(const std::string& name);
70   - void cout(bool cout);
71   - int errors(void) const;
72   - int failures(void) const;
73   - int tests(void) const;
74   - time_t timestamp(void) const;
75   - std::string print(void) const;
  63 + void clear(void);
  64 + GTestSuites* clone(void) const;
  65 + int size(void) const;
  66 + void append(GTestSuite& suite);
  67 + bool run(void);
  68 + void save(const std::string& filename) const;
  69 + std::string name(void) const;
  70 + void name(const std::string& name);
  71 + void cout(bool cout);
  72 + int errors(void) const;
  73 + int failures(void) const;
  74 + int tests(void) const;
  75 + time_t timestamp(void) const;
  76 + std::string print(void) const;
76 77  
77 78 protected:
78 79 // Protected methods
... ...
include/GTime.hpp
1 1 /***************************************************************************
2 2 * GTime.hpp - Time class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2011 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2012 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -21,7 +21,7 @@
21 21 /**
22 22 * @file GTime.hpp
23 23 * @brief Time class interface definition
24   - * @author J. Knoedlseder
  24 + * @author Juergen Knoedlseder
25 25 */
26 26  
27 27 #ifndef GTIME_HPP
... ... @@ -30,8 +30,7 @@
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <vector>
32 32 #include <string>
33   -#include <iostream>
34   -#include "GLog.hpp"
  33 +#include "GBase.hpp"
35 34  
36 35  
37 36 /***********************************************************************//**
... ... @@ -44,11 +43,7 @@
44 43 *
45 44 * @todo Make use of MJD reference in operators.
46 45 ***************************************************************************/
47   -class GTime {
48   -
49   - // I/O friends
50   - friend GLog& operator<< (GLog& log, const GTime& time);
51   - friend std::ostream& operator<< (std::ostream& os, const GTime& time);
  46 +class GTime : public GBase {
52 47  
53 48 // Operator friends
54 49 friend GTime operator+ (const GTime &a, const GTime &b);
... ... @@ -85,6 +80,7 @@ public:
85 80  
86 81 // Methods
87 82 void clear(void);
  83 + GTime* clone(void) const;
88 84 double jd(void) const;
89 85 double mjd(void) const;
90 86 double met(void) const;
... ...
include/GVector.hpp
1 1 /***************************************************************************
2 2 * GVector.hpp - Vector class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2006-2011 by Jurgen Knodlseder *
  4 + * copyright (C) 2006-2012 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -21,7 +21,7 @@
21 21 /**
22 22 * @file GVector.hpp
23 23 * @brief Vector class interface definition
24   - * @author J. Knodlseder
  24 + * @author Juergen Knoedlseder
25 25 */
26 26  
27 27 #ifndef GVECTOR_HPP
... ... @@ -30,8 +30,7 @@
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <cmath>
32 32 #include <string>
33   -#include <iostream>
34   -#include "GLog.hpp"
  33 +#include "GBase.hpp"
35 34 #include "GException.hpp"
36 35  
37 36  
... ... @@ -44,11 +43,7 @@
44 43 * is intended to be used for numerical computation (it is not ment to
45 44 * replace the std::vector template class).
46 45 ***************************************************************************/
47   -class GVector {
48   -
49   - // I/O friends
50   - friend std::ostream& operator<<(std::ostream& os, const GVector& v);
51   - friend GLog& operator<<(GLog& log, const GVector& v);
  46 +class GVector : public GBase {
52 47  
53 48 // Operator friends
54 49 friend GVector operator+(const GVector &a, const GVector &b);
... ... @@ -118,6 +113,7 @@ public:
118 113  
119 114 // Vector methods
120 115 void clear(void);
  116 + GVector* clone(void) const;
121 117 int size(void) const;
122 118 int non_zeros(void) const;
123 119 std::string print(void) const;
... ...
include/GXml.hpp
1 1 /***************************************************************************
2 2 * GXml.hpp - XML class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2011 by Jurgen Knodlseder *
  4 + * copyright (C) 2010-2012 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -21,16 +21,15 @@
21 21 /**
22 22 * @file GXml.hpp
23 23 * @brief XML class interface definition
24   - * @author J. Knodlseder
  24 + * @author Juergen Knoedlseder
25 25 */
26 26  
27 27 #ifndef GXML_HPP
28 28 #define GXML_HPP
29 29  
30 30 /* __ Includes ___________________________________________________________ */
31   -#include <iostream>
32 31 #include <string>
33   -#include "GLog.hpp"
  32 +#include "GBase.hpp"
34 33 #include "GXmlNode.hpp"
35 34 #include "GXmlDocument.hpp"
36 35 #include "GXmlElement.hpp"
... ... @@ -47,17 +46,13 @@
47 46 * This class implements an XML object. It holds the root node of the XML
48 47 * document.
49 48 ***************************************************************************/
50   -class GXml {
  49 +class GXml : public GBase {
51 50  
52 51 // Friend classes
53 52 friend class GXmlNode;
54 53 friend class GXmlDocument;
55 54 friend class GXmlText;
56 55  
57   - // I/O friends
58   - friend std::ostream& operator<<(std::ostream& os, const GXml& xml);
59   - friend GLog& operator<<(GLog& log, const GXml& xml);
60   -
61 56 public:
62 57 // Constructors and destructors
63 58 GXml(void);
... ... @@ -70,6 +65,7 @@ public:
70 65  
71 66 // Methods
72 67 void clear(void);
  68 + GXml* clone(void) const;
73 69 void append(GXmlNode* node);
74 70 void load(const std::string& filename);
75 71 void save(const std::string& filename);
... ... @@ -79,7 +75,8 @@ public:
79 75 int elements(const std::string& name) const;
80 76 GXmlElement* element(int index) const;
81 77 GXmlElement* element(const std::string& name, int index) const;
82   - std::string print(int indent = 0) const;
  78 + std::string print(void) const;
  79 + std::string print(int indent) const;
83 80  
84 81 protected:
85 82 // Protected enumerators
... ...
inst/lat/include/GLATPsfBase.hpp
... ... @@ -21,7 +21,7 @@
21 21 /**
22 22 * @file GLATPsfBase.hpp
23 23 * @brief Fermi/LAT point spread function abstract base class definition
24   - * @author J. Knoedlseder
  24 + * @author Juergen Knoedlseder
25 25 */
26 26  
27 27 #ifndef GLATPSFBASE_HPP
... ... @@ -29,8 +29,7 @@
29 29  
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
32   -#include <iostream>
33   -#include "GLog.hpp"
  32 +#include "GBase.hpp"
34 33 #include "GLATResponseTable.hpp"
35 34 #include "GFits.hpp"
36 35 #include "GFitsTable.hpp"
... ... @@ -45,7 +44,7 @@
45 44 * function (PSF). Classes that are derived from GLATPsfBase implement the
46 45 * version dependent LAT PSFs.
47 46 ***************************************************************************/
48   -class GLATPsfBase {
  47 +class GLATPsfBase : public GBase {
49 48  
50 49 public:
51 50 // Constructors and destructors
... ... @@ -64,6 +63,7 @@ public:
64 63 virtual double psf(const double& offset, const double& logE,
65 64 const double& ctheta) = 0;
66 65 virtual int version(void) const = 0;
  66 + virtual std::string print(void) const = 0;
67 67  
68 68 // Other methods
69 69 void read_scale(const GFitsTable* hdu);
... ...
inst/lat/include/GLATPsfV1.hpp
... ... @@ -55,13 +55,14 @@ public:
55 55 GLATPsfV1& operator= (const GLATPsfV1& psf);
56 56  
57 57 // Methods
58   - void clear(void);
59   - GLATPsfV1* clone(void) const;
60   - void read(const GFitsTable* hdu);
61   - void write(GFits& file) const;
62   - double psf(const double& offset, const double& logE,
63   - const double& ctheta);
64   - int version(void) const { return 1; }
  58 + void clear(void);
  59 + GLATPsfV1* clone(void) const;
  60 + void read(const GFitsTable* hdu);
  61 + void write(GFits& file) const;
  62 + double psf(const double& offset, const double& logE,
  63 + const double& ctheta);
  64 + int version(void) const { return 1; }
  65 + std::string print(void) const;
65 66  
66 67 private:
67 68 // Methods
... ...
inst/lat/include/GLATPsfV3.hpp
... ... @@ -59,13 +59,14 @@ public:
59 59 GLATPsfV3& operator= (const GLATPsfV3& psf);
60 60  
61 61 // Methods
62   - void clear(void);
63   - GLATPsfV3* clone(void) const;
64   - void read(const GFitsTable* hdu);
65   - void write(GFits& file) const;
66   - double psf(const double& offset, const double& logE,
67   - const double& ctheta);
68   - int version(void) const { return 3; }
  62 + void clear(void);
  63 + GLATPsfV3* clone(void) const;
  64 + void read(const GFitsTable* hdu);
  65 + void write(GFits& file) const;
  66 + double psf(const double& offset, const double& logE,
  67 + const double& ctheta);
  68 + int version(void) const { return 3; }
  69 + std::string print(void) const;
69 70  
70 71 private:
71 72 // Methods
... ...
inst/lat/src/GLATPsfV1.cpp
... ... @@ -21,7 +21,7 @@
21 21 /**
22 22 * @file GLATPsfV1.cpp
23 23 * @brief Fermi LAT point spread function version 1 class implementation
24   - * @author J. Knoedlseder
  24 + * @author Juergen Knoedlseder
25 25 */
26 26  
27 27 /* __ Includes ___________________________________________________________ */
... ... @@ -384,6 +384,22 @@ double GLATPsfV1::psf(const double&amp; offset, const double&amp; logE,
384 384 }
385 385  
386 386  
  387 +/***********************************************************************//**
  388 + * @brief Print PSF
  389 + ***************************************************************************/
  390 +std::string GLATPsfV1::print(void) const
  391 +{
  392 + // Initialise result string
  393 + std::string result;
  394 +
  395 + // Append header
  396 + result.append("=== GLATPsfV1 ===");
  397 +
  398 + // Return result
  399 + return result;
  400 +}
  401 +
  402 +
387 403 /*==========================================================================
388 404 = =
389 405 = Private methods =
... ...
inst/lat/src/GLATPsfV3.cpp
... ... @@ -21,7 +21,7 @@
21 21 /**
22 22 * @file GLATPsfV3.cpp
23 23 * @brief Fermi/LAT point spread function version 3 class implementation
24   - * @author J. Knoedlseder
  24 + * @author Juergen Knoedlseder
25 25 */
26 26  
27 27 /* __ Includes ___________________________________________________________ */
... ... @@ -382,6 +382,22 @@ double GLATPsfV3::psf(const double&amp; offset, const double&amp; logE,
382 382 }
383 383  
384 384  
  385 +/***********************************************************************//**
  386 + * @brief Print PSF
  387 + ***************************************************************************/
  388 +std::string GLATPsfV3::print(void) const
  389 +{
  390 + // Initialise result string
  391 + std::string result;
  392 +
  393 + // Append header
  394 + result.append("=== GLATPsfV3 ===");
  395 +
  396 + // Return result
  397 + return result;
  398 +}
  399 +
  400 +
385 401 /*==========================================================================
386 402 = =
387 403 = Private methods =
... ...
pyext/GMatrix.i
... ... @@ -67,6 +67,7 @@ public:
67 67  
68 68 // Implemented pure virtual base class methods
69 69 void clear(void);
  70 + GMatrix* clone(void) const;
70 71 void transpose(void);
71 72 void invert(void);
72 73 void add_col(const GVector& vector, const int& col);
... ...
pyext/GMatrixBase.i
... ... @@ -38,7 +38,7 @@
38 38 * common interface of the matrix objects and provides some common services
39 39 * to the derived classes.
40 40 ***************************************************************************/
41   -class GMatrixBase {
  41 +class GMatrixBase : public GBase {
42 42 public:
43 43 // Constructors and destructors
44 44 GMatrixBase(void);
... ... @@ -53,19 +53,20 @@ public:
53 53 virtual bool operator!=(const GMatrixBase& matrix) const;
54 54  
55 55 // Pure virtual methods
56   - virtual void clear() = 0;
57   - virtual void transpose() = 0;
58   - virtual void invert() = 0;
59   - virtual void add_col(const GVector& vector, const int& col) = 0;
60   - virtual void insert_col(const GVector& vector, const int& col) = 0;
61   - virtual GVector extract_row(const int& row) const = 0;
62   - virtual GVector extract_col(const int& col) const = 0;
63   - virtual double fill(void) const = 0;
64   - virtual double min(void) const = 0;
65   - virtual double max(void) const = 0;
66   - virtual double sum(void) const = 0;
  56 + virtual void clear() = 0;
  57 + virtual GMatrixBase* clone(void) const = 0;
  58 + virtual void transpose() = 0;
  59 + virtual void invert() = 0;
  60 + virtual void add_col(const GVector& vector, const int& col) = 0;
  61 + virtual void insert_col(const GVector& vector, const int& col) = 0;
  62 + virtual GVector extract_row(const int& row) const = 0;
  63 + virtual GVector extract_col(const int& col) const = 0;
  64 + virtual double fill(void) const = 0;
  65 + virtual double min(void) const = 0;
  66 + virtual double max(void) const = 0;
  67 + virtual double sum(void) const = 0;
67 68  
68 69 // Implemented base class methods
69   - virtual int cols(void) const;
70   - virtual int rows(void) const;
  70 + virtual int cols(void) const;
  71 + virtual int rows(void) const;
71 72 };
... ...
pyext/GObservations.i
1 1 /***************************************************************************
2 2 * GObservations.i - Observations container class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2008-2011 by Juergen Knoedlseder *
  4 + * copyright (C) 2008-2012 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -21,7 +21,7 @@
21 21 /**
22 22 * @file GObservations.i
23 23 * @brief Observation container class Python interface definition
24   - * @author J. Knoedlseder
  24 + * @author Juergen Knoedlseder
25 25 */
26 26 %{
27 27 /* Put headers and other declarations here that are needed for compilation */
... ... @@ -35,7 +35,7 @@
35 35 *
36 36 * @brief Observation container class
37 37 ***************************************************************************/
38   -class GObservations {
  38 +class GObservations : public GBase {
39 39 public:
40 40 // Constructors and destructors
41 41 GObservations(void);
... ... @@ -44,18 +44,19 @@ public:
44 44 virtual ~GObservations(void);
45 45  
46 46 // Methods
47   - void clear(void);
48   - int size(void) const;
49   - void append(GObservation &obs);
50   - void load(const std::string& filename);
51   - void save(const std::string& filename) const;
52   - void read(const GXml& xml);
53   - void write(GXml& xml) const;
54   - void models(const GModels& models);
55   - void models(const std::string& filename);
56   - GModels& models(void);
57   - void optimize(GOptimizer& opt);
58   - double npred(void) const;
  47 + void clear(void);
  48 + GObservations* clone(void) const;
  49 + int size(void) const;
  50 + void append(GObservation& obs);
  51 + void load(const std::string& filename);
  52 + void save(const std::string& filename) const;
  53 + void read(const GXml& xml);
  54 + void write(GXml& xml) const;
  55 + void models(const GModels& models);
  56 + void models(const std::string& filename);
  57 + GModels& models(void) { return m_models; }
  58 + void optimize(GOptimizer& opt);
  59 + double npred(void) const;
59 60 };
60 61  
61 62  
... ...
pyext/GOptimizerPars.i
1 1 /***************************************************************************
2   - * GOptimizerPars.i - Parameter container class SWIG interface *
  2 + * GOptimizerPars.i - Optimizer parameters abstract base class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2009-2011 by Jurgen Knodlseder *
  4 + * copyright (C) 2009-2012 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -20,8 +20,8 @@
20 20 ***************************************************************************/
21 21 /**
22 22 * @file GOptimizerPars.i
23   - * @brief Optimizer parameter container class Python interface
24   - * @author J. Knodlseder
  23 + * @brief Optimizer parameters abstract base class definition
  24 + * @author Juergen Knoedlseder
25 25 */
26 26 %{
27 27 /* Put headers and other declarations here that are needed for compilation */
... ... @@ -35,18 +35,23 @@
35 35 *
36 36 * @brief Optimizer parameter container class
37 37 ***************************************************************************/
38   -class GOptimizerPars {
  38 +class GOptimizerPars : public GBase {
39 39 public:
40 40 // Constructors and destructors
41 41 GOptimizerPars(void);
42 42 GOptimizerPars(const GOptimizerPars& pars);
43 43 virtual ~GOptimizerPars(void);
44 44  
  45 + // Pure virtual methods
  46 + void clear(void) = 0;
  47 + GOptimizerPars* clone(void) const = 0;
  48 +
45 49 // Methods
46   - int npars(void) const;
47   - int nfree(void) const;
48   - GModelPar& par(const int& index);
49   - //const GModelPar& par(const int& index) const; // now overloaded by SWIG
  50 + virtual void clear(void);
  51 + virtual GOptimizerPars* clone(void) const;
  52 + virtual int npars(void) const;
  53 + virtual int nfree(void) const;
  54 + virtual GModelPar& par(const int& index);
50 55 };
51 56  
52 57  
... ...
pyext/GPhoton.i
1 1 /***************************************************************************
2 2 * GPhoton.i - Photon class python I/F *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2011 by Jurgen Knodlseder *
  4 + * copyright (C) 2011-2012 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -21,7 +21,7 @@
21 21 /**
22 22 * @file GPhoton.i
23 23 * @brief GPhoton class python interface
24   - * @author J. Knodlseder
  24 + * @author Juergen Knoedlseder
25 25 */
26 26 %{
27 27 /* Put headers and other declarations here that are needed for compilation */
... ... @@ -41,7 +41,7 @@
41 41 * photon arrival direction, its energy and its arrival time. This class is
42 42 * mainly used for Monte Carlo simulations.
43 43 ***************************************************************************/
44   -class GPhoton {
  44 +class GPhoton : public GBase {
45 45 public:
46 46 // Constructors and destructors
47 47 GPhoton(void);
... ... @@ -50,12 +50,13 @@ public:
50 50  
51 51 // Methods
52 52 void clear(void);
53   - const GSkyDir& dir(void) const { return m_dir; }
54   - const GEnergy& energy(void) const { return m_energy; }
55   - const GTime& time(void) const { return m_time; }
56   - void dir(const GSkyDir& dir) { m_dir=dir; }
57   - void energy(const GEnergy& energy) { m_energy=energy; }
58   - void time(const GTime& time) { m_time=time; }
  53 + GPhoton* clone(void) const;
  54 + const GSkyDir& dir(void) const;
  55 + const GEnergy& energy(void) const;
  56 + const GTime& time(void) const;
  57 + void dir(const GSkyDir& dir);
  58 + void energy(const GEnergy& energy);
  59 + void time(const GTime& time);
59 60 };
60 61  
61 62  
... ...
pyext/GSkyDir.i
1 1 /***************************************************************************
2 2 * GSkyDir.i - Sky direction class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2008-2011 by Jurgen Knodlseder *
  4 + * copyright (C) 2008-2012 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -21,7 +21,7 @@
21 21 /**
22 22 * @file GSkyDir.i
23 23 * @brief Sky direction class Python interface definition
24   - * @author J. Knodlseder
  24 + * @author Juergen Knoedlseder
25 25 */
26 26 %{
27 27 /* Put headers and other declarations here that are needed for compilation */
... ... @@ -44,26 +44,27 @@ public:
44 44 virtual ~GSkyDir(void);
45 45  
46 46 // Methods
47   - void clear(void);
48   - void radec(const double& ra, const double& dec);
49   - void radec_deg(const double& ra, const double& dec);
50   - void lb(const double& l, const double& b);
51   - void lb_deg(const double& l, const double& b);
52   - void celvector(const GVector& vector);
53   - void rotate_deg(const double& phi, const double& theta);
54   - double l(void) const;
55   - double l_deg(void) const;
56   - double b(void) const;
57   - double b_deg(void) const;
58   - double ra(void) const;
59   - double ra_deg(void) const;
60   - double dec(void) const;
61   - double dec_deg(void) const;
62   - GVector celvector(void) const;
63   - double dist(const GSkyDir& dir) const;
64   - double dist_deg(const GSkyDir& dir) const;
65   - double posang(const GSkyDir& dir) const;
66   - double posang_deg(const GSkyDir& dir) const;
  47 + void clear(void);
  48 + GSkyDir* clone(void) const;
  49 + void radec(const double& ra, const double& dec);
  50 + void radec_deg(const double& ra, const double& dec);
  51 + void lb(const double& l, const double& b);
  52 + void lb_deg(const double& l, const double& b);
  53 + void celvector(const GVector& vector);
  54 + void rotate_deg(const double& phi, const double& theta);
  55 + double l(void) const;
  56 + double l_deg(void) const;
  57 + double b(void) const;
  58 + double b_deg(void) const;
  59 + double ra(void) const;
  60 + double ra_deg(void) const;
  61 + double dec(void) const;
  62 + double dec_deg(void) const;
  63 + GVector celvector(void) const;
  64 + double dist(const GSkyDir& dir) const;
  65 + double dist_deg(const GSkyDir& dir) const;
  66 + double posang(const GSkyDir& dir) const;
  67 + double posang_deg(const GSkyDir& dir) const;
67 68 };
68 69  
69 70  
... ...
pyext/GSkyPixel.i
1 1 /***************************************************************************
2 2 * GSkyPixel.i - 2D sky pixel index class SWIG definition *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2011 by Jurgen Knodlseder *
  4 + * copyright (C) 2010-2012 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -20,8 +20,8 @@
20 20 ***************************************************************************/
21 21 /**
22 22 * @file GSkyPixel.i
23   - * @brief GSkyPixel class SWIG file.
24   - * @author J. Knodlseder
  23 + * @brief Sky pixel class definition
  24 + * @author Juergen Knoedlseder
25 25 */
26 26 %{
27 27 /* Put headers and other declarations here that are needed for compilation */
... ... @@ -44,10 +44,12 @@ public:
44 44 virtual ~GSkyPixel(void);
45 45  
46 46 // Methods
47   - void x(const double& x);
48   - void y(const double& y);
49   - double x(void) const;
50   - double y(void) const;
  47 + void clear(void);
  48 + GSkyPixel* clone(void) const;
  49 + void x(const double& x);
  50 + void y(const double& y);
  51 + double x(void) const;
  52 + double y(void) const;
51 53 };
52 54  
53 55  
... ... @@ -58,4 +60,7 @@ public:
58 60 char *__str__() {
59 61 return tochar(self->print());
60 62 }
  63 + GSkyPixel copy() {
  64 + return (*self);
  65 + }
61 66 };
... ...
pyext/GSparseMatrix.i
... ... @@ -70,33 +70,34 @@ public:
70 70 GSparseMatrix& operator/=(const double& scalar);
71 71  
72 72 // Implemented pure virtual base class methods
73   - void clear(void);
74   - void transpose(void);
75   - void invert(void);
76   - void add_col(const GVector& vector, const int& col);
77   - void insert_col(const GVector& vector, const int& col);
78   - GVector extract_row(const int& row) const;
79   - GVector extract_col(const int& col) const;
80   - double fill(void) const;
81   - double min(void) const;
82   - double max(void) const;
83   - double sum(void) const;
  73 + void clear(void);
  74 + GSparseMatrix* clone(void) const;
  75 + void transpose(void);
  76 + void invert(void);
  77 + void add_col(const GVector& vector, const int& col);
  78 + void insert_col(const GVector& vector, const int& col);
  79 + GVector extract_row(const int& row) const;
  80 + GVector extract_col(const int& col) const;
  81 + double fill(void) const;
  82 + double min(void) const;
  83 + double max(void) const;
  84 + double sum(void) const;
84 85  
85 86 // Other methods
86   - void add_col(const double* values, const int* rows,
87   - int number, const int& col);
88   - void insert_col(const double* values, const int* rows,
89   - int number, const int& col);
90   - void cholesky_decompose(bool compress = true);
91   - GVector cholesky_solver(const GVector& vector, bool compress = true);
92   - void cholesky_invert(bool compress = true);
93   - void set_mem_block(const int& block);
94   - void stack_init(const int& size = 0, const int& entries = 0);
95   - int stack_push_column(const GVector& vector, const int& col);
96   - int stack_push_column(const double* values, const int* rows,
97   - const int& number, const int& col);
98   - void stack_flush(void);
99   - void stack_destroy(void);
  87 + void add_col(const double* values, const int* rows,
  88 + int number, const int& col);
  89 + void insert_col(const double* values, const int* rows,
  90 + int number, const int& col);
  91 + void cholesky_decompose(bool compress = true);
  92 + GVector cholesky_solver(const GVector& vector, bool compress = true);
  93 + void cholesky_invert(bool compress = true);
  94 + void set_mem_block(const int& block);
  95 + void stack_init(const int& size = 0, const int& entries = 0);
  96 + int stack_push_column(const GVector& vector, const int& col);
  97 + int stack_push_column(const double* values, const int* rows,
  98 + const int& number, const int& col);
  99 + void stack_flush(void);
  100 + void stack_destroy(void);
100 101 };
101 102  
102 103  
... ...
pyext/GSymMatrix.i
... ... @@ -66,6 +66,7 @@ public:
66 66  
67 67 // Implemented pure virtual base class methods
68 68 virtual void clear(void);
  69 + virtual GSymMatrix* clone(void) const;
69 70 virtual void transpose(void);
70 71 virtual void invert(void);
71 72 virtual void add_col(const GVector& vector, const int& col);
... ...
pyext/GTestCase.i
... ... @@ -35,7 +35,7 @@
35 35 *
36 36 * @brief Test case Python interface defintion
37 37 ***************************************************************************/
38   -class GTestCase {
  38 +class GTestCase : public GBase {
39 39  
40 40 public:
41 41 // public enumerators
... ... @@ -51,6 +51,8 @@ public:
51 51 virtual ~GTestCase(void);
52 52  
53 53 // Methods
  54 + void clear(void);
  55 + GTestCase* clone(void) const;
54 56 std::string name(void) const;
55 57 void name(const std::string& name);
56 58 std::string message(void) const;
... ...
pyext/GTestSuites.i
... ... @@ -46,18 +46,19 @@ public:
46 46 virtual ~GTestSuites(void);
47 47  
48 48 // Methods
49   - void clear(void);
50   - int size(void) const;
51   - void append(GTestSuite& suite);
52   - bool run(void);
53   - void save(std::string filename);
54   - std::string name(void) const;
55   - void name(const std::string& name);
56   - void cout(bool cout);
57   - int errors(void) const;
58   - int failures(void) const;
59   - int tests(void) const;
60   - time_t timestamp(void) const;
  49 + void clear(void);
  50 + GTestSuites* clone(void) const;
  51 + int size(void) const;
  52 + void append(GTestSuite& suite);
  53 + bool run(void);
  54 + void save(std::string filename);
  55 + std::string name(void) const;
  56 + void name(const std::string& name);
  57 + void cout(bool cout);
  58 + int errors(void) const;
  59 + int failures(void) const;
  60 + int tests(void) const;
  61 + time_t timestamp(void) const;
61 62 };
62 63  
63 64  
... ...
pyext/GTime.i
1 1 /***************************************************************************
2 2 * GTime.i - Time class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2011 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2012 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -21,7 +21,7 @@
21 21 /**
22 22 * @file GTime.i
23 23 * @brief Time class python interface definition
24   - * @author J. Knoedlseder
  24 + * @author Juergen Knoedlseder
25 25 */
26 26 %{
27 27 /* Put headers and other declarations here that are needed for compilation */
... ... @@ -60,6 +60,7 @@ public:
60 60  
61 61 // Methods
62 62 void clear(void);
  63 + GTime* clone(void) const;
63 64 double jd(void) const;
64 65 double mjd(void) const;
65 66 double met(void) const;
... ...
pyext/GVector.i
1 1 /***************************************************************************
2 2 * GVector.i - Vector class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2008-2011 by Jurgen Knodlseder *
  4 + * copyright (C) 2008-2012 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -21,7 +21,7 @@
21 21 /**
22 22 * @file GVector.i
23 23 * @brief Vector class Python interface definition
24   - * @author J. Knodlseder
  24 + * @author Juergen Knoedlseder
25 25 */
26 26  
27 27 %{
... ... @@ -36,7 +36,7 @@
36 36 *
37 37 * @brief Vector class
38 38 ***************************************************************************/
39   -class GVector {
  39 +class GVector : public GBase {
40 40 public:
41 41 // Constructors and destructors
42 42 GVector(void);
... ... @@ -57,9 +57,10 @@ public:
57 57 GVector operator- () const;
58 58  
59 59 // Vector functions
60   - void clear(void);
61   - int size() const;
62   - int non_zeros() const;
  60 + void clear(void);
  61 + GVector* clone(void) const;
  62 + int size(void) const;
  63 + int non_zeros(void) const;
63 64 };
64 65  
65 66  
... ...
pyext/GXml.i
1 1 /***************************************************************************
2 2 * GXml.i - XML class definition *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2011 by Jurgen Knodlseder *
  4 + * copyright (C) 2010-2012 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -21,7 +21,7 @@
21 21 /**
22 22 * @file GXml.i
23 23 * @brief XML class Python interface definition
24   - * @author J. Knodlseder
  24 + * @author Juergen Knoedlseder
25 25 */
26 26 %{
27 27 /* Put headers and other declarations here that are needed for compilation */
... ... @@ -35,7 +35,7 @@
35 35 *
36 36 * @brief XML class
37 37 ***************************************************************************/
38   -class GXml {
  38 +class GXml : public GBase {
39 39  
40 40 public:
41 41 // Constructors and destructors
... ... @@ -46,6 +46,7 @@ public:
46 46  
47 47 // Methods
48 48 void clear(void);
  49 + GXml* clone(void) const;
49 50 void append(GXmlNode* node);
50 51 void load(const std::string& filename);
51 52 void save(const std::string& filename);
... ... @@ -65,4 +66,7 @@ public:
65 66 char *__str__() {
66 67 return tochar(self->print());
67 68 }
  69 + GXml copy() {
  70 + return (*self);
  71 + }
68 72 };
... ...
src/linalg/GMatrix.cpp
... ... @@ -443,6 +443,32 @@ GMatrix&amp; GMatrix::operator*=(const GMatrix&amp; matrix)
443 443 ==========================================================================*/
444 444  
445 445 /***********************************************************************//**
  446 + * @brief Clear instance
  447 + ***************************************************************************/
  448 +void GMatrix::clear(void)
  449 +{
  450 + // Free members
  451 + free_members();
  452 +
  453 + // Initialise private members
  454 + init_members();
  455 +
  456 + // Return
  457 + return;
  458 +}
  459 +
  460 +
  461 +/***********************************************************************//**
  462 + * @brief Clone object
  463 + ***************************************************************************/
  464 +GMatrix* GMatrix::clone(void) const
  465 +{
  466 + // Clone this image
  467 + return new GMatrix(*this);
  468 +}
  469 +
  470 +
  471 +/***********************************************************************//**
446 472 * @brief Transpose matrix
447 473 *
448 474 * The transpose operation exchanges the number of rows against the number
... ... @@ -1011,38 +1037,6 @@ void GMatrix::alloc_members(const int&amp; rows, const int&amp; cols)
1011 1037 ==========================================================================*/
1012 1038  
1013 1039 /***********************************************************************//**
1014   - * @brief Output operator
1015   - *
1016   - * @param[in] os Output stream.
1017   - * @param[in] matrix Matrix.
1018   - ***************************************************************************/
1019   -std::ostream& operator<< (std::ostream& os, const GMatrix& matrix)
1020   -{
1021   - // Write matrix in output stream
1022   - os << matrix.print();
1023   -
1024   - // Return output stream
1025   - return os;
1026   -}
1027   -
1028   -
1029   -/***********************************************************************//**
1030   - * @brief Log operator
1031   - *
1032   - * @param[in] log Logger.
1033   - * @param[in] matrix Matrix.
1034   - ***************************************************************************/
1035   -GLog& operator<< (GLog& log, const GMatrix& matrix)
1036   -{
1037   - // Write matrix into logger
1038   - log << matrix.print();
1039   -
1040   - // Return logger
1041   - return log;
1042   -}
1043   -
1044   -
1045   -/***********************************************************************//**
1046 1040 * @brief Return matrix with absolute values of all elements
1047 1041 *
1048 1042 * @param[in] matrix Matrix.
... ...
src/linalg/GSparseMatrix.cpp
... ... @@ -590,6 +590,32 @@ GSparseMatrix&amp; GSparseMatrix::operator*=(const GSparseMatrix&amp; matrix)
590 590 ==========================================================================*/
591 591  
592 592 /***********************************************************************//**
  593 + * @brief Clear instance
  594 + ***************************************************************************/
  595 +void GSparseMatrix::clear(void)
  596 +{
  597 + // Free members
  598 + free_members();
  599 +
  600 + // Initialise private members
  601 + init_members();
  602 +
  603 + // Return
  604 + return;
  605 +}
  606 +
  607 +
  608 +/***********************************************************************//**
  609 + * @brief Clone object
  610 + ***************************************************************************/
  611 +GSparseMatrix* GSparseMatrix::clone(void) const
  612 +{
  613 + // Clone this image
  614 + return new GSparseMatrix(*this);
  615 +}
  616 +
  617 +
  618 +/***********************************************************************//**
593 619 * @brief Transpose matrix
594 620 *
595 621 * The transpose operation exchanges the number of rows against the number
... ... @@ -1587,24 +1613,6 @@ void GSparseMatrix::cholesky_invert(bool compress)
1587 1613  
1588 1614  
1589 1615 /***********************************************************************//**
1590   - * @brief Set all matrix elements to 0
1591   - ***************************************************************************/
1592   -void GSparseMatrix::clear(void)
1593   -{
1594   - // Free memory
1595   - free_elements(0, m_elements);
1596   -
1597   - // Initialise column start indices to 0
1598   - for (int col = 0; col <= m_cols; ++col) {
1599   - m_colstart[col] = 0;
1600   - }
1601   -
1602   - // Return
1603   - return;
1604   -}
1605   -
1606   -
1607   -/***********************************************************************//**
1608 1616 * @brief Returns fill of matrix
1609 1617 *
1610 1618 * The fill of a matrix is defined as the number non-zero elements devided
... ... @@ -3154,38 +3162,6 @@ void GSparseMatrix::mix_column(const double* src1_data, const int* src1_row,
3154 3162 ==========================================================================*/
3155 3163  
3156 3164 /***********************************************************************//**
3157   - * @brief Output operator
3158   - *
3159   - * @param[in] os Output stream.
3160   - * @param[in] matrix Matrix.
3161   - ***************************************************************************/
3162   -std::ostream& operator<< (std::ostream& os, const GSparseMatrix& matrix)
3163   -{
3164   - // Write matrix in output stream
3165   - os << matrix.print();
3166   -
3167   - // Return output stream
3168   - return os;
3169   -}
3170   -
3171   -
3172   -/***********************************************************************//**
3173   - * @brief Log operator
3174   - *
3175   - * @param[in] log Logger.
3176   - * @param[in] matrix Matrix.
3177   - ***************************************************************************/
3178   -GLog& operator<< (GLog& log, const GSparseMatrix& matrix)
3179   -{
3180   - // Write matrix into logger
3181   - log << matrix.print();
3182   -
3183   - // Return logger
3184   - return log;
3185   -}
3186   -
3187   -
3188   -/***********************************************************************//**
3189 3165 * @brief Return matrix with absolute values of all elements
3190 3166 *
3191 3167 * @param[in] m Matrix for which absolute values are to be returned.
... ...
src/linalg/GSymMatrix.cpp
... ... @@ -393,6 +393,32 @@ GSymMatrix&amp; GSymMatrix::operator-= (const GSymMatrix&amp; matrix)
393 393 ==========================================================================*/
394 394  
395 395 /***********************************************************************//**
  396 + * @brief Clear instance
  397 + ***************************************************************************/
  398 +void GSymMatrix::clear(void)
  399 +{
  400 + // Free members
  401 + free_members();
  402 +
  403 + // Initialise private members
  404 + init_members();
  405 +
  406 + // Return
  407 + return;
  408 +}
  409 +
  410 +
  411 +/***********************************************************************//**
  412 + * @brief Clone object
  413 + ***************************************************************************/
  414 +GSymMatrix* GSymMatrix::clone(void) const
  415 +{
  416 + // Clone this image
  417 + return new GSymMatrix(*this);
  418 +}
  419 +
  420 +
  421 +/***********************************************************************//**
396 422 * @brief Invert matrix
397 423 *
398 424 * @exception GException::feature_not_implemented
... ... @@ -1164,38 +1190,6 @@ void GSymMatrix::set_inx(void)
1164 1190 ==========================================================================*/
1165 1191  
1166 1192 /***********************************************************************//**
1167   - * @brief Output operator
1168   - *
1169   - * @param[in] os Output stream.
1170   - * @param[in] matrix Matrix.
1171   - ***************************************************************************/
1172   -std::ostream& operator<< (std::ostream& os, const GSymMatrix& matrix)
1173   -{
1174   - // Write matrix in output stream
1175   - os << matrix.print();
1176   -
1177   - // Return output stream
1178   - return os;
1179   -}
1180   -
1181   -
1182   -/***********************************************************************//**
1183   - * @brief Log operator
1184   - *
1185   - * @param[in] log Logger.
1186   - * @param[in] matrix Matrix.
1187   - ***************************************************************************/
1188   -GLog& operator<< (GLog& log, const GSymMatrix& matrix)
1189   -{
1190   - // Write matrix into logger
1191   - log << matrix.print();
1192   -
1193   - // Return logger
1194   - return log;
1195   -}
1196   -
1197   -
1198   -/***********************************************************************//**
1199 1193 * @brief Return matrix of absolute values
1200 1194 *
1201 1195 * @param[in] matrix Matrix.
... ...
src/linalg/GVector.cpp
1 1 /***************************************************************************
2 2 * GVector.cpp - Vector class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2006-2011 by Jurgen Knodlseder *
  4 + * copyright (C) 2006-2012 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -21,7 +21,7 @@
21 21 /**
22 22 * @file GVector.cpp
23 23 * @brief Vector class implementation
24   - * @author J. Knodlseder
  24 + * @author Juergen Knoedlseder
25 25 */
26 26  
27 27 /* __ Includes ___________________________________________________________ */
... ... @@ -238,8 +238,9 @@ double&amp; GVector::operator[](const int&amp; inx)
238 238 {
239 239 // Compile option: raise an exception if index is out of range
240 240 #if defined(G_RANGE_CHECK)
241   - if (inx < 0 || inx >= size())
  241 + if (inx < 0 || inx >= size()) {
242 242 throw GException::out_of_range(G_ACCESS, inx, size()-1);
  243 + }
243 244 #endif
244 245  
245 246 // Return vector element
... ... @@ -259,8 +260,9 @@ const double&amp; GVector::operator[](const int&amp; inx) const
259 260 {
260 261 // Compile option: raise an exception if index is out of range
261 262 #if defined(G_RANGE_CHECK)
262   - if (inx < 0 || inx >= size())
  263 + if (inx < 0 || inx >= size()) {
263 264 throw GException::out_of_range(G_ACCESS, inx, size()-1);
  265 + }
264 266 #endif
265 267  
266 268 // Return vector element
... ... @@ -275,16 +277,28 @@ const double&amp; GVector::operator[](const int&amp; inx) const
275 277 ==========================================================================*/
276 278  
277 279 /***********************************************************************//**
278   - * @brief Set vector elements to 0
  280 + * @brief Clear instance
279 281 ***************************************************************************/
280 282 void GVector::clear(void)
281 283 {
282   - // Set all elements to 0
283   - for (int i = 0; i < m_num; ++i)
284   - m_data[i] = 0.0;
  284 + // Free members
  285 + free_members();
285 286  
  287 + // Initialise private members
  288 + init_members();
  289 +
286 290 // Return
287   - return;
  291 + return;
  292 +}
  293 +
  294 +
  295 +/***********************************************************************//**
  296 + * @brief Clone object
  297 + ***************************************************************************/
  298 +GVector* GVector::clone(void) const
  299 +{
  300 + // Clone this image
  301 + return new GVector(*this);
288 302 }
289 303  
290 304  
... ... @@ -298,8 +312,9 @@ int GVector::non_zeros(void) const
298 312  
299 313 // Gather all non-zero elements
300 314 for (int i = 0; i < m_num; ++i) {
301   - if (m_data[i] != 0.0)
  315 + if (m_data[i] != 0.0) {
302 316 non_zeros++;
  317 + }
303 318 }
304 319  
305 320 // Return number of non-zero elements
... ... @@ -318,8 +333,9 @@ std::string GVector::print(void) const
318 333 // Put all elements in stream
319 334 for (int i = 0; i < m_num; ++i) {
320 335 result += str((*this)[i]);
321   - if (i != m_num-1)
  336 + if (i != m_num-1) {
322 337 result += ", ";
  338 + }
323 339 }
324 340  
325 341 // Append )
... ... @@ -360,8 +376,9 @@ void GVector::alloc_members(void)
360 376  
361 377 // Allocate vector and initialize elements to 0
362 378 m_data = new double[m_num];
363   - for (int i = 0; i < m_num; ++i)
  379 + for (int i = 0; i < m_num; ++i) {
364 380 m_data[i] = 0.0;
  381 + }
365 382  
366 383 } // endif: vector had non-zero length
367 384  
... ... @@ -383,8 +400,9 @@ void GVector::copy_members(const GVector&amp; v)
383 400 // Copy elements
384 401 if (m_num > 0) {
385 402 alloc_members();
386   - for (int i = 0; i < m_num; ++i)
  403 + for (int i = 0; i < m_num; ++i) {
387 404 m_data[i] = v.m_data[i];
  405 + }
388 406 }
389 407  
390 408 // Return
... ... @@ -414,37 +432,6 @@ void GVector::free_members(void)
414 432 = =
415 433 ==========================================================================*/
416 434  
417   -/***********************************************************************//**
418   - * @brief Output operator
419   - *
420   - * @param[in] os Output stream.
421   - * @param[in] v Vector.
422   - ***************************************************************************/
423   -std::ostream& operator<< (std::ostream& os, const GVector& v)
424   -{
425   - // Write vector in output stream
426   - os << v.print();
427   -
428   - // Return output stream
429   - return os;
430   -}
431   -
432   -
433   -/***********************************************************************//**
434   - * @brief Log operator
435   - *
436   - * @param[in] log Logger.
437   - * @param[in] v Vector.
438   - ***************************************************************************/
439   -GLog& operator<< (GLog& log, const GVector& v)
440   -{
441   - // Write vector into logger
442   - log << v.print();
443   -
444   - // Return logger
445   - return log;
446   -}
447   -
448 435  
449 436 /***********************************************************************//**
450 437 * @brief GVector cross product
... ... @@ -461,12 +448,14 @@ GLog&amp; operator&lt;&lt; (GLog&amp; log, const GVector&amp; v)
461 448 GVector cross(const GVector &a, const GVector &b)
462 449 {
463 450 // Verify that vectors have same dimensions
464   - if (a.m_num != b.m_num)
  451 + if (a.m_num != b.m_num) {
465 452 throw GException::vector_mismatch(G_CROSS, a.m_num, b.m_num);
  453 + }
466 454  
467 455 // Verify that vectors have 3 elements
468   - if (a.m_num != 3)
  456 + if (a.m_num != 3) {
469 457 throw GException::vector_bad_cross_dim(G_CROSS, a.m_num);
  458 + }
470 459  
471 460 // Compute cross product
472 461 GVector result(3);
... ...
src/model/GModels.cpp
... ... @@ -272,7 +272,7 @@ const GModel* GModels::operator[](const std::string&amp; name) const
272 272 = =
273 273 ==========================================================================*/
274 274  
275   - /***********************************************************************//**
  275 +/***********************************************************************//**
276 276 * @brief Clear object
277 277 *
278 278 * Removes all models from the container.
... ... @@ -709,45 +709,3 @@ int GModels::get_index(const std::string&amp; name) const
709 709 // Return index
710 710 return index;
711 711 }
712   -
713   -
714   -/*==========================================================================
715   - = =
716   - = Friends =
717   - = =
718   - ==========================================================================*/
719   -
720   -/***********************************************************************//**
721   - * @brief Output operator
722   - *
723   - * @param[in] os Output stream.
724   - * @param[in] models Model container.
725   - *
726   - * Dumps a model container into the output stream.
727   - ***************************************************************************/
728   -std::ostream& operator<< (std::ostream& os, const GModels& models)
729   -{
730   - // Write models in output stream
731   - os << models.print();
732   -
733   - // Return output stream
734   - return os;
735   -}
736   -
737   -
738   -/***********************************************************************//**
739   - * @brief Log operator
740   - *
741   - * @param[in] log Logger.
742   - * @param[in] models Model container.
743   - *
744   - * Logs a model container into a logger.
745   - ***************************************************************************/
746   -GLog& operator<< (GLog& log, const GModels& models)
747   -{
748   - // Write models into logger
749   - log << models.print();
750   -
751   - // Return logger
752   - return log;
753   -}
... ...
src/obs/GObservations.cpp
... ... @@ -21,7 +21,7 @@
21 21 /**
22 22 * @file GObservations.cpp
23 23 * @brief Observations container class implementation
24   - * @author J. Knoedlseder
  24 + * @author Juergen Knoedlseder
25 25 */
26 26  
27 27 /* __ Includes ___________________________________________________________ */
... ... @@ -210,6 +210,16 @@ void GObservations::clear(void)
210 210  
211 211  
212 212 /***********************************************************************//**
  213 + * @brief Clone object
  214 + ***************************************************************************/
  215 +GObservations* GObservations::clone(void) const
  216 +{
  217 + // Clone this image
  218 + return new GObservations(*this);
  219 +}
  220 +
  221 +
  222 +/***********************************************************************//**
213 223 * @brief Append observation to container
214 224 *
215 225 * @param[in] obs Observation.
... ... @@ -569,42 +579,3 @@ void GObservations::free_members(void)
569 579 // Return
570 580 return;
571 581 }
572   -
573   -
574   -/*==========================================================================
575   - = =
576   - = Friends =
577   - = =
578   - ==========================================================================*/
579   -
580   -
581   -/***********************************************************************//**
582   - * @brief Output operator
583   - *
584   - * @param[in] os Output stream.
585   - * @param[in] obs Observation container.
586   - ***************************************************************************/
587   -std::ostream& operator<< (std::ostream& os, const GObservations& obs)
588   -{
589   - // Write observations in output stream
590   - os << obs.print();
591   -
592   - // Return output stream
593   - return os;
594   -}
595   -
596   -
597   -/***********************************************************************//**
598   - * @brief Log operator
599   - *
600   - * @param[in] log Logger.
601   - * @param[in] obs Observation container.
602   - ***************************************************************************/
603   -GLog& operator<< (GLog& log, const GObservations& obs)
604   -{
605   - // Write observations into logger
606   - log << obs.print();
607   -
608   - // Return logger
609   - return log;
610   -}
... ...
src/obs/GPhoton.cpp
1 1 /***************************************************************************
2 2 * GPhoton.hpp - Photon class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2011 by Jurgen Knodlseder *
  4 + * copyright (C) 2011-2012 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -21,7 +21,7 @@
21 21 /**
22 22 * @file GPhoton.cpp
23 23 * @brief Photon class implementation.
24   - * @author J. Knodlseder
  24 + * @author Juergen Knodlseder
25 25 */
26 26  
27 27 /* __ Includes ___________________________________________________________ */
... ... @@ -147,6 +147,16 @@ void GPhoton::clear(void)
147 147  
148 148  
149 149 /***********************************************************************//**
  150 + * @brief Clone object
  151 + ***************************************************************************/
  152 +GPhoton* GPhoton::clone(void) const
  153 +{
  154 + // Clone this image
  155 + return new GPhoton(*this);
  156 +}
  157 +
  158 +
  159 +/***********************************************************************//**
150 160 * @brief Print photon
151 161 *
152 162 * @todo Implement print() method for GSkyDir
... ... @@ -219,41 +229,3 @@ void GPhoton::free_members(void)
219 229 // Return
220 230 return;
221 231 }
222   -
223   -
224   -/*==========================================================================
225   - = =
226   - = Friends =
227   - = =
228   - ==========================================================================*/
229   -
230   -/***********************************************************************//**
231   - * @brief Output operator
232   - *
233   - * @param[in] os Output stream.
234   - * @param[in] ph Photon.
235   - ***************************************************************************/
236   -std::ostream& operator<< (std::ostream& os, const GPhoton& ph)
237   -{
238   - // Write photon in output stream
239   - os << ph.print();
240   -
241   - // Return output stream
242   - return os;
243   -}
244   -
245   -
246   -/***********************************************************************//**
247   - * @brief Log operator
248   - *
249   - * @param[in] log Logger.
250   - * @param[in] ph Photon.
251   - ***************************************************************************/
252   -GLog& operator<< (GLog& log, const GPhoton& ph)
253   -{
254   - // Write photon into logger
255   - log << ph.print();
256   -
257   - // Return logger
258   - return log;
259   -}
... ...
src/obs/GTime.cpp
... ... @@ -21,7 +21,7 @@
21 21 /**
22 22 * @file GTime.cpp
23 23 * @brief Time class implementation
24   - * @author J. Knoedlseder
  24 + * @author Juergen Knoedlseder
25 25 */
26 26  
27 27 /* __ Includes ___________________________________________________________ */
... ... @@ -213,6 +213,17 @@ void GTime::clear(void)
213 213 return;
214 214 }
215 215  
  216 +
  217 +/***********************************************************************//**
  218 + * @brief Clone object
  219 + ***************************************************************************/
  220 +GTime* GTime::clone(void) const
  221 +{
  222 + // Clone this image
  223 + return new GTime(*this);
  224 +}
  225 +
  226 +
216 227 /***********************************************************************//**
217 228 * @brief Return time in JD (TT) (unit: days)
218 229 ***************************************************************************/
... ... @@ -507,41 +518,3 @@ void GTime::free_members(void)
507 518 // Return
508 519 return;
509 520 }
510   -
511   -
512   -/*==========================================================================
513   - = =
514   - = Friends =
515   - = =
516   - ==========================================================================*/
517   -
518   -/***********************************************************************//**
519   - * @brief Output operator
520   - *
521   - * @param[in] os Output stream.
522   - * @param[in] time Time.
523   - ***************************************************************************/
524   -std::ostream& operator<< (std::ostream& os, const GTime& time)
525   -{
526   - // Write time in output stream
527   - os << time.print();
528   -
529   - // Return output stream
530   - return os;
531   -}
532   -
533   -
534   -/***********************************************************************//**
535   - * @brief Log operator
536   - *
537   - * @param[in] log Logger.
538   - * @param[in] time Time.
539   - ***************************************************************************/
540   -GLog& operator<< (GLog& log, const GTime& time)
541   -{
542   - // Write time into logger
543   - log << time.print();
544   -
545   - // Return logger
546   - return log;
547   -}
... ...
src/opt/GOptimizerPars.cpp
... ... @@ -131,6 +131,31 @@ GOptimizerPars&amp; GOptimizerPars::operator= (const GOptimizerPars&amp; pars)
131 131 ==========================================================================*/
132 132  
133 133 /***********************************************************************//**
  134 + * @brief Clear object
  135 + ***************************************************************************/
  136 +void GOptimizerPars::clear(void)
  137 +{
  138 + // Free class members
  139 + free_members();
  140 +
  141 + // Initialise members
  142 + init_members();
  143 +
  144 + // Return
  145 + return;
  146 +}
  147 +
  148 +
  149 +/***********************************************************************//**
  150 + * @brief Clone instance
  151 + ***************************************************************************/
  152 +GOptimizerPars* GOptimizerPars::clone(void) const
  153 +{
  154 + return new GOptimizerPars(*this);
  155 +}
  156 +
  157 +
  158 +/***********************************************************************//**
134 159 * @brief Returns number of free parameters
135 160 ***************************************************************************/
136 161 int GOptimizerPars::nfree(void) const
... ... @@ -252,42 +277,3 @@ void GOptimizerPars::free_members(void)
252 277 // Return
253 278 return;
254 279 }
255   -
256   -
257   -/*==========================================================================
258   - = =
259   - = Friends =
260   - = =
261   - ==========================================================================*/
262   -
263   -
264   -/***********************************************************************//**
265   - * @brief Output operator
266   - *
267   - * @param[in] os Output stream.
268   - * @param[in] pars Parameter container.
269   - ***************************************************************************/
270   -std::ostream& operator<<(std::ostream& os, const GOptimizerPars& pars)
271   -{
272   - // Write parameters in output stream
273   - os << pars.print();
274   -
275   - // Return output stream
276   - return os;
277   -}
278   -
279   -
280   -/***********************************************************************//**
281   - * @brief Log operator
282   - *
283   - * @param[in] log Logger.
284   - * @param[in] pars Parameter container.
285   - ***************************************************************************/
286   -GLog& operator<<(GLog& log, const GOptimizerPars& pars)
287   -{
288   - // Write parameters into logger
289   - log << pars.print();
290   -
291   - // Return logger
292   - return log;
293   -}
... ...
src/sky/GSkyDir.cpp
1 1 /***************************************************************************
2 2 * GSkyDir.cpp - Class that implements a sky direction *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2008-2011 by Jurgen Knodlseder *
  4 + * copyright (C) 2008-2012 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -21,7 +21,7 @@
21 21 /**
22 22 * @file GSkyDir.cpp
23 23 * @brief Sky direction class implementation
24   - * @author J. Knodlseder
  24 + * @author Juergen Knoedlseder
25 25 */
26 26  
27 27 /* __ Includes ___________________________________________________________ */
... ... @@ -149,6 +149,15 @@ void GSkyDir::clear(void)
149 149 }
150 150  
151 151  
  152 +/***********************************************************************//**
  153 + * @brief Clone object
  154 + ***************************************************************************/
  155 +GSkyDir* GSkyDir::clone(void) const
  156 +{
  157 + // Clone this image
  158 + return new GSkyDir(*this);
  159 +}
  160 +
152 161  
153 162 /***********************************************************************//**
154 163 * @brief Set equatorial sky direction (radians)
... ... @@ -717,38 +726,6 @@ void GSkyDir::euler(const int&amp; type, const double&amp; xin, const double &amp;yin,
717 726 ==========================================================================*/
718 727  
719 728 /***********************************************************************//**
720   - * @brief Output operator
721   - *
722   - * @param[in] os Output stream.
723   - * @param[in] dir Sky direction.
724   - ***************************************************************************/
725   -std::ostream& operator<< (std::ostream& os, const GSkyDir& dir)
726   -{
727   - // Write sky direction in output stream
728   - os << dir.print();
729   -
730   - // Return output stream
731   - return os;
732   -}
733   -
734   -
735   -/***********************************************************************//**
736   - * @brief Log operator
737   - *
738   - * @param[in] log Logger.
739   - * @param[in] dir Sky direction.
740   - ***************************************************************************/
741   -GLog& operator<< (GLog& log, const GSkyDir& dir)
742   -{
743   - // Write sky direction into logger
744   - log << dir.print();
745   -
746   - // Return logger
747   - return log;
748   -}
749   -
750   -
751   -/***********************************************************************//**
752 729 * @brief Equality operator
753 730 *
754 731 * @param[in] a First sky direction.
... ...
src/sky/GSkyPixel.cpp
1 1 /***************************************************************************
2 2 * GSkyPixel.cpp - Class that implements a 2D sky pixel index *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2010-2012 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -18,6 +18,11 @@
18 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19 19 * *
20 20 ***************************************************************************/
  21 +/**
  22 + * @file GSkyPixel.hpp
  23 + * @brief Sky pixel class implementation
  24 + * @author Juergen Knoedlseder
  25 + */
21 26  
22 27 /* __ Includes ___________________________________________________________ */
23 28 #ifdef HAVE_CONFIG_H
... ... @@ -143,6 +148,32 @@ GSkyPixel&amp; GSkyPixel::operator= (const GSkyPixel&amp; pixel)
143 148 ==========================================================================*/
144 149  
145 150 /***********************************************************************//**
  151 + * @brief Clear instance
  152 + ***************************************************************************/
  153 +void GSkyPixel::clear(void)
  154 +{
  155 + // Free members
  156 + free_members();
  157 +
  158 + // Initialise private members
  159 + init_members();
  160 +
  161 + // Return
  162 + return;
  163 +}
  164 +
  165 +
  166 +/***********************************************************************//**
  167 + * @brief Clone object
  168 + ***************************************************************************/
  169 +GSkyPixel* GSkyPixel::clone(void) const
  170 +{
  171 + // Clone this image
  172 + return new GSkyPixel(*this);
  173 +}
  174 +
  175 +
  176 +/***********************************************************************//**
146 177 * @brief Set x value of sky pixel
147 178 *
148 179 * @param[in] x X value.
... ... @@ -249,42 +280,3 @@ void GSkyPixel::free_members(void)
249 280 // Return
250 281 return;
251 282 }
252   -
253   -
254   -/*==========================================================================
255   - = =
256   - = Friends =
257   - = =
258   - ==========================================================================*/
259   -
260   -
261   -/***********************************************************************//**
262   - * @brief Output operator
263   - *
264   - * @param[in] os Output stream.
265   - * @param[in] pixel Sky pixel.
266   - ***************************************************************************/
267   -std::ostream& operator<< (std::ostream& os, const GSkyPixel& pixel)
268   -{
269   - // Write pixel in output stream
270   - os << pixel.print();
271   -
272   - // Return output stream
273   - return os;
274   -}
275   -
276   -
277   -/***********************************************************************//**
278   - * @brief Log operator
279   - *
280   - * @param[in] log Logger.
281   - * @param[in] pixel Sky pixel.
282   - ***************************************************************************/
283   -GLog& operator<< (GLog& log, const GSkyPixel& pixel)
284   -{
285   - // Write pixel into logger
286   - log << pixel.print();
287   -
288   - // Return logger
289   - return log;
290   -}
... ...
src/test/GTestCase.cpp
... ... @@ -150,6 +150,32 @@ GTestCase&amp; GTestCase::operator= (const GTestCase&amp; test)
150 150 ==========================================================================*/
151 151  
152 152 /***********************************************************************//**
  153 + * @brief Clear instance
  154 + ***************************************************************************/
  155 +void GTestCase::clear(void)
  156 +{
  157 + // Free members
  158 + free_members();
  159 +
  160 + // Initialise private members
  161 + init_members();
  162 +
  163 + // Return
  164 + return;
  165 +}
  166 +
  167 +
  168 +/***********************************************************************//**
  169 + * @brief Clone object
  170 + ***************************************************************************/
  171 +GTestCase* GTestCase::clone(void) const
  172 +{
  173 + // Clone this image
  174 + return new GTestCase(*this);
  175 +}
  176 +
  177 +
  178 +/***********************************************************************//**
153 179 * @brief Return test case name
154 180 ***************************************************************************/
155 181 std::string GTestCase::name(void) const
... ...
src/test/GTestSuites.cpp
... ... @@ -28,8 +28,10 @@
28 28 #ifdef HAVE_CONFIG_H
29 29 #include <config.h>
30 30 #endif
31   -#include<ctime>
  31 +#include <ctime>
32 32 #include "GTestSuites.hpp"
  33 +#include "GTestCase.hpp"
  34 +#include "GTools.hpp"
33 35  
34 36 /* __ Method name definitions ____________________________________________ */
35 37 #define G_OP_ACCESS "GTestSuites::operator[](int&)"
... ... @@ -204,6 +206,16 @@ void GTestSuites::clear(void)
204 206  
205 207  
206 208 /***********************************************************************//**
  209 + * @brief Clone object
  210 + ***************************************************************************/
  211 +GTestSuites* GTestSuites::clone(void) const
  212 +{
  213 + // Clone object
  214 + return new GTestSuites(*this);
  215 +}
  216 +
  217 +
  218 +/***********************************************************************//**
207 219 * @brief Return number of test suite in container
208 220 ***************************************************************************/
209 221 int GTestSuites::size(void) const
... ...
src/xml/GXml.cpp
... ... @@ -21,7 +21,7 @@
21 21 /**
22 22 * @file GXml.cpp
23 23 * @brief XML class implementation
24   - * @author J. Knoedlseder
  24 + * @author Juergen Knoedlseder
25 25 */
26 26  
27 27 /* __ Includes ___________________________________________________________ */
... ... @@ -175,6 +175,16 @@ void GXml::clear(void)
175 175  
176 176  
177 177 /***********************************************************************//**
  178 + * @brief Clone object
  179 + ***************************************************************************/
  180 +GXml* GXml::clone(void) const
  181 +{
  182 + // Clone this image
  183 + return new GXml(*this);
  184 +}
  185 +
  186 +
  187 +/***********************************************************************//**
178 188 * @brief Append child node to XML document.
179 189 *
180 190 * @param[in] node Child node.
... ... @@ -346,6 +356,19 @@ std::string GXml::print(int indent) const
346 356 }
347 357  
348 358  
  359 +/***********************************************************************//**
  360 + * @brief Print XML object
  361 + ***************************************************************************/
  362 +std::string GXml::print(void) const
  363 +{
  364 + // Initialise result string
  365 + std::string result = print(0);
  366 +
  367 + // Return result
  368 + return result;
  369 +}
  370 +
  371 +
349 372 /*==========================================================================
350 373 = =
351 374 = Private methods =
... ... @@ -720,43 +743,3 @@ GXml::MarkupType GXml::get_markuptype(const std::string&amp; segment) const
720 743 // Return type
721 744 return type;
722 745 }
723   -
724   -
725   -/*==========================================================================
726   - = =
727   - = Friends =
728   - = =
729   - ==========================================================================*/
730   -
731   -/***********************************************************************//**
732   - * @brief Output operator
733   - *
734   - * @param[in] os Output stream.
735   - * @param[in] xml XML object.
736   - ***************************************************************************/
737   -std::ostream& operator<< (std::ostream& os, const GXml& xml)
738   -{
739   - // Write XML document in output stream
740   - os << "=== GXml ===" << std::endl;
741   - os << xml.m_root.print(0);
742   -
743   - // Return output stream
744   - return os;
745   -}
746   -
747   -
748   -/***********************************************************************//**
749   - * @brief Log operator
750   - *
751   - * @param[in] log Logger.
752   - * @param[in] xml XML object.
753   - ***************************************************************************/
754   -GLog& operator<< (GLog& log, const GXml& xml)
755   -{
756   - // Write XML document into logger
757   - log << "=== GXml ===" << std::endl;
758   - log << xml.m_root.print(0);
759   -
760   - // Return logger
761   - return log;
762   -}
... ...