Commit 90b53aeb4a30b475bb424aed6cce08cca5ede411
1 parent
cd6dffd8
rename elements() => size()
Showing
3 changed files
with
20 additions
and
24 deletions
include/GEventCube.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GEventCube.hpp - Abstract event cube container class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright : (C) 2009 by Jurgen Knodlseder * | |
| 4 | + * copyright (C) 2009-2010 by Jurgen Knodlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software; you can redistribute it and/or modify * |
| ... | ... | @@ -41,9 +41,9 @@ class GEventCube : public GEvents { |
| 41 | 41 | |
| 42 | 42 | public: |
| 43 | 43 | // Constructors and destructors |
| 44 | - GEventCube(); | |
| 44 | + GEventCube(void); | |
| 45 | 45 | GEventCube(const GEventCube& cube); |
| 46 | - virtual ~GEventCube(); | |
| 46 | + virtual ~GEventCube(void); | |
| 47 | 47 | |
| 48 | 48 | // Operators |
| 49 | 49 | virtual GEventCube& operator= (const GEventCube& cube); |
| ... | ... | @@ -54,8 +54,8 @@ public: |
| 54 | 54 | virtual int number(void) const = 0; |
| 55 | 55 | |
| 56 | 56 | // Implemented methods |
| 57 | - int elements(void) const; | |
| 58 | - int dim(void) const; | |
| 57 | + int size(void) const { return m_elements; } | |
| 58 | + int dim(void) const { return m_dim; } | |
| 59 | 59 | int naxis(int axis) const; |
| 60 | 60 | bool islist(void) const { return false; } |
| 61 | 61 | bool iscube(void) const { return true; } | ... | ... |
include/GEventList.hpp
| ... | ... | @@ -53,8 +53,8 @@ public: |
| 53 | 53 | virtual GEventAtom* pointer(int index) = 0; |
| 54 | 54 | |
| 55 | 55 | // Implemented methods |
| 56 | - int number(void) const; | |
| 57 | - int elements(void) const; | |
| 56 | + int number(void) const { return m_num; } | |
| 57 | + int size(void) const { return m_num; } | |
| 58 | 58 | bool islist(void) const { return true; } |
| 59 | 59 | bool iscube(void) const { return false; } |
| 60 | 60 | ... | ... |
src/obs/GEvents.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GEvents.cpp - Events container class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright : (C) 2008 by Jurgen Knodlseder * | |
| 4 | + * copyright (C) 2008-2010 by Jurgen Knodlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software; you can redistribute it and/or modify * |
| ... | ... | @@ -18,6 +18,9 @@ |
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | 20 | /* __ Includes ___________________________________________________________ */ |
| 21 | +#ifdef HAVE_CONFIG_H | |
| 22 | +#include <config.h> | |
| 23 | +#endif | |
| 21 | 24 | #include <iostream> |
| 22 | 25 | #include "GException.hpp" |
| 23 | 26 | #include "GEvents.hpp" |
| ... | ... | @@ -33,14 +36,14 @@ |
| 33 | 36 | |
| 34 | 37 | /*========================================================================== |
| 35 | 38 | = = |
| 36 | - = GEvents constructors/destructors = | |
| 39 | + = Constructors/destructors = | |
| 37 | 40 | = = |
| 38 | 41 | ==========================================================================*/ |
| 39 | 42 | |
| 40 | 43 | /***********************************************************************//** |
| 41 | 44 | * @brief Constructor |
| 42 | 45 | ***************************************************************************/ |
| 43 | -GEvents::GEvents() | |
| 46 | +GEvents::GEvents(void) | |
| 44 | 47 | { |
| 45 | 48 | // Initialise class members for clean destruction |
| 46 | 49 | init_members(); |
| ... | ... | @@ -71,7 +74,7 @@ GEvents::GEvents(const GEvents& events) |
| 71 | 74 | /***********************************************************************//** |
| 72 | 75 | * @brief Destructor |
| 73 | 76 | ***************************************************************************/ |
| 74 | -GEvents::~GEvents() | |
| 77 | +GEvents::~GEvents(void) | |
| 75 | 78 | { |
| 76 | 79 | // Free members |
| 77 | 80 | free_members(); |
| ... | ... | @@ -83,7 +86,7 @@ GEvents::~GEvents() |
| 83 | 86 | |
| 84 | 87 | /*========================================================================== |
| 85 | 88 | = = |
| 86 | - = GEvents operators = | |
| 89 | + = Operators = | |
| 87 | 90 | = = |
| 88 | 91 | ==========================================================================*/ |
| 89 | 92 | |
| ... | ... | @@ -140,7 +143,7 @@ GEvents::iterator::iterator() |
| 140 | 143 | GEvents::iterator::iterator(GEvents *events) |
| 141 | 144 | { |
| 142 | 145 | // Initialise iterator |
| 143 | - m_num = (events != NULL) ? events->elements() : 0; | |
| 146 | + m_num = (events != NULL) ? events->size() : 0; | |
| 144 | 147 | m_index = 0; |
| 145 | 148 | m_base = events; |
| 146 | 149 | |
| ... | ... | @@ -199,13 +202,13 @@ GEvents::iterator GEvents::end(void) |
| 199 | 202 | |
| 200 | 203 | /*========================================================================== |
| 201 | 204 | = = |
| 202 | - = GEvents public methods = | |
| 205 | + = Public methods = | |
| 203 | 206 | = = |
| 204 | 207 | ==========================================================================*/ |
| 205 | 208 | |
| 206 | 209 | /*========================================================================== |
| 207 | 210 | = = |
| 208 | - = GEvents private methods = | |
| 211 | + = Private methods = | |
| 209 | 212 | = = |
| 210 | 213 | ==========================================================================*/ |
| 211 | 214 | |
| ... | ... | @@ -243,7 +246,7 @@ void GEvents::free_members(void) |
| 243 | 246 | |
| 244 | 247 | /*========================================================================== |
| 245 | 248 | = = |
| 246 | - = GEvents friends = | |
| 249 | + = Friends = | |
| 247 | 250 | = = |
| 248 | 251 | ==========================================================================*/ |
| 249 | 252 | |
| ... | ... | @@ -257,16 +260,9 @@ std::ostream& operator<< (std::ostream& os, const GEvents& events) |
| 257 | 260 | { |
| 258 | 261 | // Put header in stream |
| 259 | 262 | os << "=== GEvents ===" << std::endl; |
| 260 | - os << " Number of elements ........: " << events.elements() << std::endl; | |
| 263 | + os << " Number of elements ........: " << events.size() << std::endl; | |
| 261 | 264 | os << " Number of events ..........: " << events.number(); |
| 262 | 265 | |
| 263 | 266 | // Return output stream |
| 264 | 267 | return os; |
| 265 | 268 | } |
| 266 | - | |
| 267 | - | |
| 268 | -/*========================================================================== | |
| 269 | - = = | |
| 270 | - = Other functions used by GEvents = | |
| 271 | - = = | |
| 272 | - ==========================================================================*/ | ... | ... |