Commit 18a7660882a2097fd5fdffab4b10546c9af4f4a0
1 parent
531134d1
Put back GCTAObservation::dispose_events() method.
It is still convenient to control the event disposal from the observation class, although the actual event disposal is now handled by the event list class.
Showing
4 changed files
with
25 additions
and
3 deletions
NEWS
| ... | ... | @@ -16,9 +16,6 @@ made since the last release of GammaLib. |
| 16 | 16 | The following methods have been added to the public interface: |
| 17 | 17 | - GObservation::events() (non-const variant) |
| 18 | 18 | |
| 19 | -The following methods have been removed from the public interface: | |
| 20 | -- GCTAObservation::dispose_events() | |
| 21 | - | |
| 22 | 19 | The return value has been changed for the following methods: |
| 23 | 20 | - GFits::filename() returns now GFilename instead of std::string |
| 24 | 21 | - GCTAObservation::eventtype() returns now std::string instead of const std::string& | ... | ... |
inst/cta/include/GCTAObservation.hpp
| ... | ... | @@ -125,6 +125,7 @@ public: |
| 125 | 125 | void eventfile(const std::string& filename); |
| 126 | 126 | const std::string& eventfile(void) const; |
| 127 | 127 | std::string eventtype(void) const; |
| 128 | + void dispose_events(void); | |
| 128 | 129 | const double& lo_user_thres(void) const; |
| 129 | 130 | const double& hi_user_thres(void) const; |
| 130 | 131 | void n_tels(const int& tels); | ... | ... |
inst/cta/pyext/GCTAObservation.i
| ... | ... | @@ -97,6 +97,7 @@ public: |
| 97 | 97 | void eventfile(const std::string& filename); |
| 98 | 98 | const std::string& eventfile(void) const; |
| 99 | 99 | std::string eventtype(void) const; |
| 100 | + void dispose_events(void); | |
| 100 | 101 | const double& lo_user_thres(void) const; |
| 101 | 102 | const double& hi_user_thres(void) const; |
| 102 | 103 | void n_tels(const int& tels); | ... | ... |
inst/cta/src/GCTAObservation.cpp
| ... | ... | @@ -28,6 +28,7 @@ |
| 28 | 28 | #ifdef HAVE_CONFIG_H |
| 29 | 29 | #include <config.h> |
| 30 | 30 | #endif |
| 31 | +#include <typeinfo> | |
| 31 | 32 | #include "GObservationRegistry.hpp" |
| 32 | 33 | #include "GException.hpp" |
| 33 | 34 | #include "GFits.hpp" |
| ... | ... | @@ -1212,6 +1213,28 @@ std::string GCTAObservation::eventtype(void) const |
| 1212 | 1213 | |
| 1213 | 1214 | |
| 1214 | 1215 | /***********************************************************************//** |
| 1216 | + * @brief Dispose events | |
| 1217 | + * | |
| 1218 | + * Disposes the events to save memory. The method only applies to event | |
| 1219 | + * lists. If does nothing in case that the observation does not contain an | |
| 1220 | + * event list. | |
| 1221 | + ***************************************************************************/ | |
| 1222 | +void GCTAObservation::dispose_events(void) | |
| 1223 | +{ | |
| 1224 | + // Get pointer to event list | |
| 1225 | + GCTAEventList* list = dynamic_cast<GCTAEventList*>(m_events); | |
| 1226 | + | |
| 1227 | + // Dispose event list if pointer is valid | |
| 1228 | + if (list != NULL) { | |
| 1229 | + list->dispose(); | |
| 1230 | + } | |
| 1231 | + | |
| 1232 | + // Return | |
| 1233 | + return; | |
| 1234 | +} | |
| 1235 | + | |
| 1236 | + | |
| 1237 | +/***********************************************************************//** | |
| 1215 | 1238 | * @brief Print CTA observation information |
| 1216 | 1239 | * |
| 1217 | 1240 | * @param[in] chatter Chattiness (defaults to NORMAL). | ... | ... |