Commit bb659b369a7d51308ed2e33e13d49c05dd253b68
1 parent
c8d276fe
initial version
Showing
7 changed files
with
745 additions
and
8 deletions
include/GData.hpp
| ... | ... | @@ -50,6 +50,7 @@ public: |
| 50 | 50 | class iterator { |
| 51 | 51 | friend class GData; |
| 52 | 52 | public: |
| 53 | + iterator(); | |
| 53 | 54 | iterator(GData *data); |
| 54 | 55 | ~iterator(); |
| 55 | 56 | iterator& operator++(void); // Prefix |
| ... | ... | @@ -57,13 +58,12 @@ public: |
| 57 | 58 | bool operator==(const iterator& it) const; |
| 58 | 59 | bool operator!=(const iterator& it) const; |
| 59 | 60 | GEvent& operator*(void); |
| 60 | - GEvent* operator->(void); | |
| 61 | 61 | protected: |
| 62 | - int m_obs_index; //!< Actual observation index [0,m_num-1] | |
| 63 | - int m_event_index; //!< Actual event index | |
| 64 | - int m_num_events; //!< Total number of events in actual observation | |
| 65 | - GObservation *m_obs; //!< Pointer to actual observation | |
| 66 | - GData *m_data; //!< Pointer to GData object | |
| 62 | + int m_index; //!< Actual observation index [0,m_num-1] | |
| 63 | + GEvents::iterator m_event; //!< Iterator on actual event | |
| 64 | + GEvents::iterator m_end; //!< Iterator on observation end | |
| 65 | + GObservation* m_obs; //!< Pointer to actual observation | |
| 66 | + GData* m_data; //!< Pointer to GData object | |
| 67 | 67 | }; |
| 68 | 68 | iterator begin(void); |
| 69 | 69 | iterator end(void); |
| ... | ... | @@ -75,8 +75,8 @@ protected: |
| 75 | 75 | void free_members(void); |
| 76 | 76 | |
| 77 | 77 | // Protected data area |
| 78 | - int m_num; //!< Number of observations | |
| 79 | - GObservation **m_obs; //!< Pointers to observations | |
| 78 | + int m_num; //!< Number of observations | |
| 79 | + GObservation **m_obs; //!< Pointers to observations | |
| 80 | 80 | |
| 81 | 81 | private: |
| 82 | 82 | }; | ... | ... |
include/GEventCube.hpp
0 → 100644
| 1 | +/*************************************************************************** | |
| 2 | + * GEventCube.hpp - Abstract event cube container class * | |
| 3 | + * ----------------------------------------------------------------------- * | |
| 4 | + * copyright : (C) 2009 by Jurgen Knodlseder * | |
| 5 | + * ----------------------------------------------------------------------- * | |
| 6 | + * * | |
| 7 | + * This program is free software; you can redistribute it and/or modify * | |
| 8 | + * it under the terms of the GNU General Public License as published by * | |
| 9 | + * the Free Software Foundation; either version 2 of the License, or * | |
| 10 | + * (at your option) any later version. * | |
| 11 | + * * | |
| 12 | + ***************************************************************************/ | |
| 13 | +/** | |
| 14 | + * @file GEventCube.hpp | |
| 15 | + * @brief GEventCube container class interface definition. | |
| 16 | + * @author J. Knodlseder | |
| 17 | + */ | |
| 18 | + | |
| 19 | +#ifndef GEVENTCUBE_HPP | |
| 20 | +#define GEVENTCUBE_HPP | |
| 21 | + | |
| 22 | +/* __ Includes ___________________________________________________________ */ | |
| 23 | +#include "GEvents.hpp" | |
| 24 | +#include "GFits.hpp" | |
| 25 | + | |
| 26 | + | |
| 27 | +/***********************************************************************//** | |
| 28 | + * @class GEventCube | |
| 29 | + * | |
| 30 | + * @brief GEventCube container class interface defintion. | |
| 31 | + ***************************************************************************/ | |
| 32 | +class GEventCube : public GEvents { | |
| 33 | + | |
| 34 | + // Friend classes | |
| 35 | + friend class GData; | |
| 36 | + friend class GObservation; | |
| 37 | + | |
| 38 | + // I/O friends | |
| 39 | + friend std::ostream& operator<< (std::ostream& os, const GEventCube& cube); | |
| 40 | + | |
| 41 | +public: | |
| 42 | + // Constructors and destructors | |
| 43 | + GEventCube(); | |
| 44 | + GEventCube(const GEventCube& cube); | |
| 45 | + virtual ~GEventCube(); | |
| 46 | + | |
| 47 | + // Operators | |
| 48 | + virtual GEventCube& operator= (const GEventCube& cube); | |
| 49 | + | |
| 50 | + // Virtual methods | |
| 51 | + virtual void load(const std::string& filename) = 0; | |
| 52 | + virtual void load(GFitsHDU* hdu) = 0; | |
| 53 | + virtual GEvent* pointer(int index) const = 0; | |
| 54 | + | |
| 55 | + // Implemented methods | |
| 56 | + int number(void) const; | |
| 57 | + int dim(void) const; | |
| 58 | + int naxis(int axis) const; | |
| 59 | + | |
| 60 | +protected: | |
| 61 | + // Protected methods | |
| 62 | + void init_members(void); | |
| 63 | + void copy_members(const GEventCube& cube); | |
| 64 | + void free_members(void); | |
| 65 | + virtual GEventCube* clone(void) const = 0; | |
| 66 | + | |
| 67 | + // Protected data area | |
| 68 | + int m_dim; //!< Cube dimension | |
| 69 | + int* m_naxis; //!< Number of bins in each axis | |
| 70 | + | |
| 71 | +private: | |
| 72 | +}; | |
| 73 | + | |
| 74 | +#endif /* GEVENTCUBE_HPP */ | ... | ... |
include/GEventList.hpp
0 → 100644
| 1 | +/*************************************************************************** | |
| 2 | + * GEventList.hpp - Abstract event list container class * | |
| 3 | + * ----------------------------------------------------------------------- * | |
| 4 | + * copyright : (C) 2009 by Jurgen Knodlseder * | |
| 5 | + * ----------------------------------------------------------------------- * | |
| 6 | + * * | |
| 7 | + * This program is free software; you can redistribute it and/or modify * | |
| 8 | + * it under the terms of the GNU General Public License as published by * | |
| 9 | + * the Free Software Foundation; either version 2 of the License, or * | |
| 10 | + * (at your option) any later version. * | |
| 11 | + * * | |
| 12 | + ***************************************************************************/ | |
| 13 | +/** | |
| 14 | + * @file GEventList.hpp | |
| 15 | + * @brief GEventList container class interface definition. | |
| 16 | + * @author J. Knodlseder | |
| 17 | + */ | |
| 18 | + | |
| 19 | +#ifndef GEVENTLIST_HPP | |
| 20 | +#define GEVENTLIST_HPP | |
| 21 | + | |
| 22 | +/* __ Includes ___________________________________________________________ */ | |
| 23 | +#include "GEvents.hpp" | |
| 24 | +#include "GFits.hpp" | |
| 25 | + | |
| 26 | + | |
| 27 | +/***********************************************************************//** | |
| 28 | + * @class GEventList | |
| 29 | + * | |
| 30 | + * @brief GEventList container class interface defintion. | |
| 31 | + ***************************************************************************/ | |
| 32 | +class GEventList : public GEvents { | |
| 33 | + | |
| 34 | + // Friend classes | |
| 35 | + friend class GData; | |
| 36 | + friend class GObservation; | |
| 37 | + | |
| 38 | + // I/O friends | |
| 39 | + friend std::ostream& operator<< (std::ostream& os, const GEventList& list); | |
| 40 | + | |
| 41 | +public: | |
| 42 | + // Constructors and destructors | |
| 43 | + GEventList(); | |
| 44 | + GEventList(const GEventList& list); | |
| 45 | + virtual ~GEventList(); | |
| 46 | + | |
| 47 | + // Operators | |
| 48 | + virtual GEventList& operator= (const GEventList& list); | |
| 49 | + | |
| 50 | + // Virtual methods | |
| 51 | + virtual void load(const std::string& filename) = 0; | |
| 52 | + virtual void load(GFitsHDU* hdu) = 0; | |
| 53 | + virtual GEvent* pointer(int index) const = 0; | |
| 54 | + | |
| 55 | + // Implemented methods | |
| 56 | + int number(void) const; | |
| 57 | +// int num(void) const; | |
| 58 | + | |
| 59 | +protected: | |
| 60 | + // Protected methods | |
| 61 | + void init_members(void); | |
| 62 | + void copy_members(const GEventList& list); | |
| 63 | + void free_members(void); | |
| 64 | + virtual GEventList* clone(void) const = 0; | |
| 65 | + | |
| 66 | + // Protected data area | |
| 67 | +// int m_num; //!< Number of events | |
| 68 | +// GEvent* m_events; //!< Pointer to events | |
| 69 | + | |
| 70 | +private: | |
| 71 | +}; | |
| 72 | + | |
| 73 | +#endif /* GEVENTLIST_HPP */ | ... | ... |
include/GLATEventCube.hpp
0 → 100644
| 1 | +/*************************************************************************** | |
| 2 | + * GLATEventCube.hpp - LAT event cube class * | |
| 3 | + * ----------------------------------------------------------------------- * | |
| 4 | + * copyright : (C) 2009 by Jurgen Knodlseder * | |
| 5 | + * ----------------------------------------------------------------------- * | |
| 6 | + * * | |
| 7 | + * This program is free software; you can redistribute it and/or modify * | |
| 8 | + * it under the terms of the GNU General Public License as published by * | |
| 9 | + * the Free Software Foundation; either version 2 of the License, or * | |
| 10 | + * (at your option) any later version. * | |
| 11 | + * * | |
| 12 | + ***************************************************************************/ | |
| 13 | +/** | |
| 14 | + * @file GLATEventCube.hpp | |
| 15 | + * @brief GLATEventCube class interface definition. | |
| 16 | + * @author J. Knodlseder | |
| 17 | + */ | |
| 18 | + | |
| 19 | +#ifndef GLATEVENTCUBE_HPP | |
| 20 | +#define GLATEVENTCUBE_HPP | |
| 21 | + | |
| 22 | +/* __ Includes ___________________________________________________________ */ | |
| 23 | +#include "GEventCube.hpp" | |
| 24 | +#include "GLATEvent.hpp" | |
| 25 | +#include "GFits.hpp" | |
| 26 | + | |
| 27 | + | |
| 28 | +/***********************************************************************//** | |
| 29 | + * @class GLATEventCube | |
| 30 | + * | |
| 31 | + * @brief GLATEventCube class interface defintion. | |
| 32 | + ***************************************************************************/ | |
| 33 | +class GLATEventCube : public GEventCube { | |
| 34 | + | |
| 35 | +public: | |
| 36 | + // Constructors and destructors | |
| 37 | + GLATEventCube(); | |
| 38 | + GLATEventCube(const GLATEventCube& cube); | |
| 39 | + virtual ~GLATEventCube(); | |
| 40 | + | |
| 41 | + // Operators | |
| 42 | + GLATEventCube& operator= (const GLATEventCube& cube); | |
| 43 | + | |
| 44 | + // Methods | |
| 45 | + void load(const std::string& filename); | |
| 46 | + void load(GFitsHDU* hdu); | |
| 47 | + GLATEvent* pointer(int index) const; | |
| 48 | + | |
| 49 | +protected: | |
| 50 | + // Protected methods | |
| 51 | + void init_members(void); | |
| 52 | + void copy_members(const GLATEventCube& cube); | |
| 53 | + void free_members(void); | |
| 54 | + GLATEventCube* clone(void) const; | |
| 55 | + | |
| 56 | + // Protected data area | |
| 57 | + | |
| 58 | +private: | |
| 59 | +}; | |
| 60 | + | |
| 61 | +#endif /* GLATEVENTCUBE_HPP */ | ... | ... |
include/GLATEventList.hpp
0 → 100644
| 1 | +/*************************************************************************** | |
| 2 | + * GLATEventList.hpp - LAT Event list class * | |
| 3 | + * ----------------------------------------------------------------------- * | |
| 4 | + * copyright : (C) 2009 by Jurgen Knodlseder * | |
| 5 | + * ----------------------------------------------------------------------- * | |
| 6 | + * * | |
| 7 | + * This program is free software; you can redistribute it and/or modify * | |
| 8 | + * it under the terms of the GNU General Public License as published by * | |
| 9 | + * the Free Software Foundation; either version 2 of the License, or * | |
| 10 | + * (at your option) any later version. * | |
| 11 | + * * | |
| 12 | + ***************************************************************************/ | |
| 13 | +/** | |
| 14 | + * @file GLATEventList.hpp | |
| 15 | + * @brief GLATEventList class interface definition. | |
| 16 | + * @author J. Knodlseder | |
| 17 | + */ | |
| 18 | + | |
| 19 | +#ifndef GLATEVENTLIST_HPP | |
| 20 | +#define GLATEVENTLIST_HPP | |
| 21 | + | |
| 22 | +/* __ Includes ___________________________________________________________ */ | |
| 23 | +#include "GEventList.hpp" | |
| 24 | +#include "GLATEvent.hpp" | |
| 25 | +#include "GFits.hpp" | |
| 26 | + | |
| 27 | + | |
| 28 | +/***********************************************************************//** | |
| 29 | + * @class GLATEventList | |
| 30 | + * | |
| 31 | + * @brief GLATEventList class interface defintion. | |
| 32 | + ***************************************************************************/ | |
| 33 | +class GLATEventList : public GEventList { | |
| 34 | + | |
| 35 | + // I/O friends | |
| 36 | + friend std::ostream& operator<< (std::ostream& os, const GLATEventList& list); | |
| 37 | + | |
| 38 | +public: | |
| 39 | + // Constructors and destructors | |
| 40 | + GLATEventList(); | |
| 41 | + GLATEventList(const GLATEventList& list); | |
| 42 | + virtual ~GLATEventList(); | |
| 43 | + | |
| 44 | + // Operators | |
| 45 | + GLATEventList& operator= (const GLATEventList& list); | |
| 46 | + | |
| 47 | + // Methods | |
| 48 | + void load(const std::string& filename); | |
| 49 | + void load(GFitsHDU* hdu); | |
| 50 | + GLATEvent* pointer(int index) const; | |
| 51 | + | |
| 52 | +protected: | |
| 53 | + // Protected methods | |
| 54 | + void init_members(void); | |
| 55 | + void copy_members(const GLATEventList& list); | |
| 56 | + void free_members(void); | |
| 57 | + GLATEventList* clone(void) const; | |
| 58 | + | |
| 59 | + // Protected data area | |
| 60 | + | |
| 61 | +private: | |
| 62 | +}; | |
| 63 | + | |
| 64 | +#endif /* GLATEVENTLIST_HPP */ | ... | ... |
src/obs/GEventCube.cpp
0 → 100644
| 1 | +/*************************************************************************** | |
| 2 | + * GEventCube.cpp - Abstract event cube container class * | |
| 3 | + * ----------------------------------------------------------------------- * | |
| 4 | + * copyright : (C) 2009 by Jurgen Knodlseder * | |
| 5 | + * ----------------------------------------------------------------------- * | |
| 6 | + * * | |
| 7 | + * This program is free software; you can redistribute it and/or modify * | |
| 8 | + * it under the terms of the GNU General Public License as published by * | |
| 9 | + * the Free Software Foundation; either version 2 of the License, or * | |
| 10 | + * (at your option) any later version. * | |
| 11 | + * * | |
| 12 | + * ----------------------------------------------------------------------- * | |
| 13 | + ***************************************************************************/ | |
| 14 | +/** | |
| 15 | + * @file GEventCube.cpp | |
| 16 | + * @brief GEventCube container class implementation. | |
| 17 | + * @author J. Knodlseder | |
| 18 | + */ | |
| 19 | + | |
| 20 | +/* __ Includes ___________________________________________________________ */ | |
| 21 | +#include <iostream> | |
| 22 | +#include "GException.hpp" | |
| 23 | +#include "GEventCube.hpp" | |
| 24 | + | |
| 25 | +/* __ Method name definitions ____________________________________________ */ | |
| 26 | +#define G_COPY_MEMBERS "GEventCube::copy_members(const GEventCube&)" | |
| 27 | + | |
| 28 | +/* __ Macros _____________________________________________________________ */ | |
| 29 | + | |
| 30 | +/* __ Coding definitions _________________________________________________ */ | |
| 31 | + | |
| 32 | +/* __ Debug definitions __________________________________________________ */ | |
| 33 | + | |
| 34 | + | |
| 35 | +/*========================================================================== | |
| 36 | + = = | |
| 37 | + = GEventCube constructors/destructors = | |
| 38 | + = = | |
| 39 | + ==========================================================================*/ | |
| 40 | + | |
| 41 | +/***********************************************************************//** | |
| 42 | + * @brief Constructor | |
| 43 | + ***************************************************************************/ | |
| 44 | +GEventCube::GEventCube() : GEvents() | |
| 45 | +{ | |
| 46 | + // Initialise class members for clean destruction | |
| 47 | + init_members(); | |
| 48 | + | |
| 49 | + // Return | |
| 50 | + return; | |
| 51 | +} | |
| 52 | + | |
| 53 | + | |
| 54 | +/***********************************************************************//** | |
| 55 | + * @brief Copy constructor | |
| 56 | + * | |
| 57 | + * @param[in] cube Event cube from which the instance should be built. | |
| 58 | + ***************************************************************************/ | |
| 59 | +GEventCube::GEventCube(const GEventCube& cube) : GEvents(cube) | |
| 60 | +{ | |
| 61 | + // Initialise class members for clean destruction | |
| 62 | + init_members(); | |
| 63 | + | |
| 64 | + // Copy members | |
| 65 | + copy_members(cube); | |
| 66 | + | |
| 67 | + // Return | |
| 68 | + return; | |
| 69 | +} | |
| 70 | + | |
| 71 | + | |
| 72 | +/***********************************************************************//** | |
| 73 | + * @brief Destructor | |
| 74 | + ***************************************************************************/ | |
| 75 | +GEventCube::~GEventCube() | |
| 76 | +{ | |
| 77 | + // Free members | |
| 78 | + free_members(); | |
| 79 | + | |
| 80 | + // Return | |
| 81 | + return; | |
| 82 | +} | |
| 83 | + | |
| 84 | + | |
| 85 | +/*========================================================================== | |
| 86 | + = = | |
| 87 | + = GEventCube operators = | |
| 88 | + = = | |
| 89 | + ==========================================================================*/ | |
| 90 | + | |
| 91 | +/***********************************************************************//** | |
| 92 | + * @brief Assignment operator | |
| 93 | + * | |
| 94 | + * @param[in] cube Event cube to be assigned. | |
| 95 | + ***************************************************************************/ | |
| 96 | +GEventCube& GEventCube::operator= (const GEventCube& cube) | |
| 97 | +{ | |
| 98 | + // Execute only if object is not identical | |
| 99 | + if (this != &cube) { | |
| 100 | + | |
| 101 | + // Copy base class members | |
| 102 | + this->GEvents::operator=(cube); | |
| 103 | + | |
| 104 | + // Free members | |
| 105 | + free_members(); | |
| 106 | + | |
| 107 | + // Initialise private members for clean destruction | |
| 108 | + init_members(); | |
| 109 | + | |
| 110 | + // Copy members | |
| 111 | + copy_members(cube); | |
| 112 | + | |
| 113 | + } // endif: object was not identical | |
| 114 | + | |
| 115 | + // Return this object | |
| 116 | + return *this; | |
| 117 | +} | |
| 118 | + | |
| 119 | + | |
| 120 | +/*========================================================================== | |
| 121 | + = = | |
| 122 | + = GEventCube public methods = | |
| 123 | + = = | |
| 124 | + ==========================================================================*/ | |
| 125 | + | |
| 126 | +/***********************************************************************//** | |
| 127 | + * @brief Return number of events in cube | |
| 128 | + ***************************************************************************/ | |
| 129 | +int GEventCube::number(void) const | |
| 130 | +{ | |
| 131 | + // Return | |
| 132 | + return 0; // DUMMY DUMMY | |
| 133 | +} | |
| 134 | + | |
| 135 | + | |
| 136 | +/***********************************************************************//** | |
| 137 | + * @brief Return event cube dimension | |
| 138 | + ***************************************************************************/ | |
| 139 | +int GEventCube::dim(void) const | |
| 140 | +{ | |
| 141 | + // Return | |
| 142 | + return m_dim; | |
| 143 | +} | |
| 144 | + | |
| 145 | + | |
| 146 | +/***********************************************************************//** | |
| 147 | + * @brief Return event cube axis dimension | |
| 148 | + * | |
| 149 | + * @param[in] axis Cube axis number (starting from 0). | |
| 150 | + ***************************************************************************/ | |
| 151 | +int GEventCube::naxis(int axis) const | |
| 152 | +{ | |
| 153 | + // Throw error if index is out of range | |
| 154 | + #if defined(G_RANGE_CHECK) | |
| 155 | + if (m_naxis == NULL || axis < 0 || axis >= m_dim) | |
| 156 | + throw GException::out_of_range(G_NAXIS, axis, 0, m_dim-1); | |
| 157 | + #endif | |
| 158 | + | |
| 159 | + // Return axis dimension | |
| 160 | + return m_naxis[axis]; | |
| 161 | +} | |
| 162 | + | |
| 163 | + | |
| 164 | +/*========================================================================== | |
| 165 | + = = | |
| 166 | + = GEventCube private methods = | |
| 167 | + = = | |
| 168 | + ==========================================================================*/ | |
| 169 | + | |
| 170 | +/***********************************************************************//** | |
| 171 | + * @brief Initialise class members | |
| 172 | + ***************************************************************************/ | |
| 173 | +void GEventCube::init_members(void) | |
| 174 | +{ | |
| 175 | + // Initialise members | |
| 176 | + m_dim = 0; | |
| 177 | + m_naxis = NULL; | |
| 178 | + | |
| 179 | + // Return | |
| 180 | + return; | |
| 181 | +} | |
| 182 | + | |
| 183 | + | |
| 184 | +/***********************************************************************//** | |
| 185 | + * @brief Copy class members | |
| 186 | + * | |
| 187 | + * @param[in] cube GEventCube members to be copied. | |
| 188 | + ***************************************************************************/ | |
| 189 | +void GEventCube::copy_members(const GEventCube& cube) | |
| 190 | +{ | |
| 191 | + // Copy attributes | |
| 192 | + m_dim = cube.m_dim; | |
| 193 | + | |
| 194 | + // If the cube is not empty then copy it | |
| 195 | + if (m_dim > 0 && cube.m_naxis != NULL) { | |
| 196 | + | |
| 197 | + // Allocate memory | |
| 198 | + m_naxis = new int[m_dim]; | |
| 199 | + if (m_naxis == NULL) | |
| 200 | + throw GException::mem_alloc(G_COPY_MEMBERS, m_dim); | |
| 201 | + | |
| 202 | + // Copy axis dimensions | |
| 203 | + for (int i = 0; i < m_dim; ++i) | |
| 204 | + m_naxis[i] = cube.m_naxis[i]; | |
| 205 | + | |
| 206 | + } | |
| 207 | + | |
| 208 | + // Return | |
| 209 | + return; | |
| 210 | +} | |
| 211 | + | |
| 212 | + | |
| 213 | +/***********************************************************************//** | |
| 214 | + * @brief Delete class members | |
| 215 | + ***************************************************************************/ | |
| 216 | +void GEventCube::free_members(void) | |
| 217 | +{ | |
| 218 | + // Free memory | |
| 219 | + if (m_naxis != NULL) delete [] m_naxis; | |
| 220 | + | |
| 221 | + // Signal free pointers | |
| 222 | + m_naxis = NULL; | |
| 223 | + | |
| 224 | + // Return | |
| 225 | + return; | |
| 226 | +} | |
| 227 | + | |
| 228 | + | |
| 229 | +/*========================================================================== | |
| 230 | + = = | |
| 231 | + = GEventCube friends = | |
| 232 | + = = | |
| 233 | + ==========================================================================*/ | |
| 234 | + | |
| 235 | +/***********************************************************************//** | |
| 236 | + * @brief Output operator | |
| 237 | + * | |
| 238 | + * @param[in] os Output stream into which the event cube will be dumped | |
| 239 | + * @param[in] cube Event cube to be dumped | |
| 240 | + ***************************************************************************/ | |
| 241 | +std::ostream& operator<< (std::ostream& os, const GEventCube& cube) | |
| 242 | +{ | |
| 243 | + // Put event cube in stream | |
| 244 | + os << "=== GEventCube ===" << std::endl; | |
| 245 | + if (cube.m_naxis != NULL) { | |
| 246 | + os << " Cube is undefined" << std::endl; | |
| 247 | + } | |
| 248 | + else { | |
| 249 | + os << " Cube dimension ............: " << cube.dim() << std::endl; | |
| 250 | + for (int axis = 0; axis < cube.m_dim; ++axis) { | |
| 251 | + os << " Axis " << axis+1 << " dimension ..........: " | |
| 252 | + << cube.naxis(axis) << std::endl; | |
| 253 | + } | |
| 254 | + } | |
| 255 | + | |
| 256 | + // Return output stream | |
| 257 | + return os; | |
| 258 | +} | |
| 259 | + | |
| 260 | + | |
| 261 | +/*========================================================================== | |
| 262 | + = = | |
| 263 | + = Other functions used by GEventList = | |
| 264 | + = = | |
| 265 | + ==========================================================================*/ | ... | ... |
src/obs/GEventList.cpp
0 → 100644
| 1 | +/*************************************************************************** | |
| 2 | + * GEventList.cpp - Abstract event container class * | |
| 3 | + * ----------------------------------------------------------------------- * | |
| 4 | + * copyright : (C) 2009 by Jurgen Knodlseder * | |
| 5 | + * ----------------------------------------------------------------------- * | |
| 6 | + * * | |
| 7 | + * This program is free software; you can redistribute it and/or modify * | |
| 8 | + * it under the terms of the GNU General Public License as published by * | |
| 9 | + * the Free Software Foundation; either version 2 of the License, or * | |
| 10 | + * (at your option) any later version. * | |
| 11 | + * * | |
| 12 | + * ----------------------------------------------------------------------- * | |
| 13 | + ***************************************************************************/ | |
| 14 | +/** | |
| 15 | + * @file GEventList.cpp | |
| 16 | + * @brief GEventList container class implementation. | |
| 17 | + * @author J. Knodlseder | |
| 18 | + */ | |
| 19 | + | |
| 20 | +/* __ Includes ___________________________________________________________ */ | |
| 21 | +#include <iostream> | |
| 22 | +#include "GException.hpp" | |
| 23 | +#include "GEventList.hpp" | |
| 24 | + | |
| 25 | +/* __ Method name definitions ____________________________________________ */ | |
| 26 | + | |
| 27 | +/* __ Macros _____________________________________________________________ */ | |
| 28 | + | |
| 29 | +/* __ Coding definitions _________________________________________________ */ | |
| 30 | + | |
| 31 | +/* __ Debug definitions __________________________________________________ */ | |
| 32 | + | |
| 33 | + | |
| 34 | +/*========================================================================== | |
| 35 | + = = | |
| 36 | + = GEventList constructors/destructors = | |
| 37 | + = = | |
| 38 | + ==========================================================================*/ | |
| 39 | + | |
| 40 | +/***********************************************************************//** | |
| 41 | + * @brief Constructor | |
| 42 | + ***************************************************************************/ | |
| 43 | +GEventList::GEventList() : GEvents() | |
| 44 | +{ | |
| 45 | + // Initialise class members for clean destruction | |
| 46 | + init_members(); | |
| 47 | + | |
| 48 | + // Return | |
| 49 | + return; | |
| 50 | +} | |
| 51 | + | |
| 52 | + | |
| 53 | +/***********************************************************************//** | |
| 54 | + * @brief Copy constructor | |
| 55 | + * | |
| 56 | + * @param[in] list Event list from which the instance should be built. | |
| 57 | + ***************************************************************************/ | |
| 58 | +GEventList::GEventList(const GEventList& list) : GEvents(list) | |
| 59 | +{ | |
| 60 | + // Initialise class members for clean destruction | |
| 61 | + init_members(); | |
| 62 | + | |
| 63 | + // Copy members | |
| 64 | + copy_members(list); | |
| 65 | + | |
| 66 | + // Return | |
| 67 | + return; | |
| 68 | +} | |
| 69 | + | |
| 70 | + | |
| 71 | +/***********************************************************************//** | |
| 72 | + * @brief Destructor | |
| 73 | + ***************************************************************************/ | |
| 74 | +GEventList::~GEventList() | |
| 75 | +{ | |
| 76 | + // Free members | |
| 77 | + free_members(); | |
| 78 | + | |
| 79 | + // Return | |
| 80 | + return; | |
| 81 | +} | |
| 82 | + | |
| 83 | + | |
| 84 | +/*========================================================================== | |
| 85 | + = = | |
| 86 | + = GEventList operators = | |
| 87 | + = = | |
| 88 | + ==========================================================================*/ | |
| 89 | + | |
| 90 | +/***********************************************************************//** | |
| 91 | + * @brief Assignment operator | |
| 92 | + * | |
| 93 | + * @param[in] list Event list to be assigned. | |
| 94 | + ***************************************************************************/ | |
| 95 | +GEventList& GEventList::operator= (const GEventList& list) | |
| 96 | +{ | |
| 97 | + // Execute only if object is not identical | |
| 98 | + if (this != &list) { | |
| 99 | + | |
| 100 | + // Copy base class members | |
| 101 | + this->GEvents::operator=(list); | |
| 102 | + | |
| 103 | + // Free members | |
| 104 | + free_members(); | |
| 105 | + | |
| 106 | + // Initialise private members for clean destruction | |
| 107 | + init_members(); | |
| 108 | + | |
| 109 | + // Copy members | |
| 110 | + copy_members(list); | |
| 111 | + | |
| 112 | + } // endif: object was not identical | |
| 113 | + | |
| 114 | + // Return this object | |
| 115 | + return *this; | |
| 116 | +} | |
| 117 | + | |
| 118 | + | |
| 119 | +/*========================================================================== | |
| 120 | + = = | |
| 121 | + = GEventList public methods = | |
| 122 | + = = | |
| 123 | + ==========================================================================*/ | |
| 124 | + | |
| 125 | +/***********************************************************************//** | |
| 126 | + * @brief Return number of events in list | |
| 127 | + ***************************************************************************/ | |
| 128 | +int GEventList::number(void) const | |
| 129 | +{ | |
| 130 | + // Return | |
| 131 | + return m_num; | |
| 132 | +} | |
| 133 | + | |
| 134 | + | |
| 135 | +/*========================================================================== | |
| 136 | + = = | |
| 137 | + = GEventList private methods = | |
| 138 | + = = | |
| 139 | + ==========================================================================*/ | |
| 140 | + | |
| 141 | +/***********************************************************************//** | |
| 142 | + * @brief Initialise class members | |
| 143 | + ***************************************************************************/ | |
| 144 | +void GEventList::init_members(void) | |
| 145 | +{ | |
| 146 | + // Return | |
| 147 | + return; | |
| 148 | +} | |
| 149 | + | |
| 150 | + | |
| 151 | +/***********************************************************************//** | |
| 152 | + * @brief Copy class members | |
| 153 | + * | |
| 154 | + * @param[in] list GEventList members to be copied. | |
| 155 | + ***************************************************************************/ | |
| 156 | +void GEventList::copy_members(const GEventList& list) | |
| 157 | +{ | |
| 158 | + // Return | |
| 159 | + return; | |
| 160 | +} | |
| 161 | + | |
| 162 | + | |
| 163 | +/***********************************************************************//** | |
| 164 | + * @brief Delete class members | |
| 165 | + ***************************************************************************/ | |
| 166 | +void GEventList::free_members(void) | |
| 167 | +{ | |
| 168 | + // Return | |
| 169 | + return; | |
| 170 | +} | |
| 171 | + | |
| 172 | + | |
| 173 | +/*========================================================================== | |
| 174 | + = = | |
| 175 | + = GEventList friends = | |
| 176 | + = = | |
| 177 | + ==========================================================================*/ | |
| 178 | + | |
| 179 | +/***********************************************************************//** | |
| 180 | + * @brief Output operator | |
| 181 | + * | |
| 182 | + * @param[in] os Output stream into which the event list will be dumped | |
| 183 | + * @param[in] list Event list to be dumped | |
| 184 | + ***************************************************************************/ | |
| 185 | +std::ostream& operator<< (std::ostream& os, const GEventList& list) | |
| 186 | +{ | |
| 187 | + // Put header in stream | |
| 188 | + os << "=== GEventList ===" << std::endl; | |
| 189 | + os << " Number of events in list ..: " << list.number(); | |
| 190 | + | |
| 191 | + // Return output stream | |
| 192 | + return os; | |
| 193 | +} | |
| 194 | + | |
| 195 | + | |
| 196 | +/*========================================================================== | |
| 197 | + = = | |
| 198 | + = Other functions used by GEventList = | |
| 199 | + = = | |
| 200 | + ==========================================================================*/ | ... | ... |