Commit c6ea6d80f1457872df7992d532148658a4bb2bf8
1 parent
f2d0d994
add obs() methods and m_obs member
Showing
2 changed files
with
18 additions
and
2 deletions
include/GEvents.hpp
| ... | ... | @@ -28,6 +28,10 @@ |
| 28 | 28 | * @class GEvents |
| 29 | 29 | * |
| 30 | 30 | * @brief GEvents container class interface defintion. |
| 31 | + * | |
| 32 | + * This class is an abstract container base class for events. Events are | |
| 33 | + * generally associated to an observation, and the class keeps the pointer | |
| 34 | + * to an existing observations as a member. | |
| 31 | 35 | ***************************************************************************/ |
| 32 | 36 | class GEvents { |
| 33 | 37 | |
| ... | ... | @@ -55,8 +59,10 @@ public: |
| 55 | 59 | virtual bool islist(void) const = 0; |
| 56 | 60 | virtual bool iscube(void) const = 0; |
| 57 | 61 | |
| 58 | - // Implemented methods | |
| 59 | - | |
| 62 | + // Other methods | |
| 63 | + void obs(GObservation* ptr) { m_obs=ptr; return; } | |
| 64 | + GObservation* obs(void) const { return m_obs; } | |
| 65 | + | |
| 60 | 66 | // Event iterator |
| 61 | 67 | class iterator { |
| 62 | 68 | friend class GEvents; |
| ... | ... | @@ -84,6 +90,10 @@ protected: |
| 84 | 90 | void copy_members(const GEvents& events); |
| 85 | 91 | void free_members(void); |
| 86 | 92 | virtual GEvents* clone(void) const = 0; |
| 93 | + | |
| 94 | + // Protected data | |
| 95 | + GObservation* m_obs; //!< Pointer to associated observation | |
| 96 | + | |
| 87 | 97 | }; |
| 88 | 98 | |
| 89 | 99 | #endif /* GEVENTS_HPP */ | ... | ... |
src/obs/GEvents.cpp
| ... | ... | @@ -217,6 +217,9 @@ GEvents::iterator GEvents::end(void) |
| 217 | 217 | ***************************************************************************/ |
| 218 | 218 | void GEvents::init_members(void) |
| 219 | 219 | { |
| 220 | + // Initialise members | |
| 221 | + m_obs = NULL; | |
| 222 | + | |
| 220 | 223 | // Return |
| 221 | 224 | return; |
| 222 | 225 | } |
| ... | ... | @@ -229,6 +232,9 @@ void GEvents::init_members(void) |
| 229 | 232 | ***************************************************************************/ |
| 230 | 233 | void GEvents::copy_members(const GEvents& events) |
| 231 | 234 | { |
| 235 | + // Copy attributes | |
| 236 | + m_obs = events.m_obs; | |
| 237 | + | |
| 232 | 238 | // Return |
| 233 | 239 | return; |
| 234 | 240 | } | ... | ... |