diff --git a/NEWS b/NEWS index 93cc68d..186afee 100644 --- a/NEWS +++ b/NEWS @@ -16,9 +16,6 @@ made since the last release of GammaLib. The following methods have been added to the public interface: - GObservation::events() (non-const variant) -The following methods have been removed from the public interface: -- GCTAObservation::dispose_events() - The return value has been changed for the following methods: - GFits::filename() returns now GFilename instead of std::string - GCTAObservation::eventtype() returns now std::string instead of const std::string& diff --git a/inst/cta/include/GCTAObservation.hpp b/inst/cta/include/GCTAObservation.hpp index fe27830..750af0f 100644 --- a/inst/cta/include/GCTAObservation.hpp +++ b/inst/cta/include/GCTAObservation.hpp @@ -125,6 +125,7 @@ public: void eventfile(const std::string& filename); const std::string& eventfile(void) const; std::string eventtype(void) const; + void dispose_events(void); const double& lo_user_thres(void) const; const double& hi_user_thres(void) const; void n_tels(const int& tels); diff --git a/inst/cta/pyext/GCTAObservation.i b/inst/cta/pyext/GCTAObservation.i index c3487a1..ab21a44 100644 --- a/inst/cta/pyext/GCTAObservation.i +++ b/inst/cta/pyext/GCTAObservation.i @@ -97,6 +97,7 @@ public: void eventfile(const std::string& filename); const std::string& eventfile(void) const; std::string eventtype(void) const; + void dispose_events(void); const double& lo_user_thres(void) const; const double& hi_user_thres(void) const; void n_tels(const int& tels); diff --git a/inst/cta/src/GCTAObservation.cpp b/inst/cta/src/GCTAObservation.cpp index 89d63fd..1c93d21 100644 --- a/inst/cta/src/GCTAObservation.cpp +++ b/inst/cta/src/GCTAObservation.cpp @@ -28,6 +28,7 @@ #ifdef HAVE_CONFIG_H #include #endif +#include #include "GObservationRegistry.hpp" #include "GException.hpp" #include "GFits.hpp" @@ -1212,6 +1213,28 @@ std::string GCTAObservation::eventtype(void) const /***********************************************************************//** + * @brief Dispose events + * + * Disposes the events to save memory. The method only applies to event + * lists. If does nothing in case that the observation does not contain an + * event list. + ***************************************************************************/ +void GCTAObservation::dispose_events(void) +{ + // Get pointer to event list + GCTAEventList* list = dynamic_cast(m_events); + + // Dispose event list if pointer is valid + if (list != NULL) { + list->dispose(); + } + + // Return + return; +} + + +/***********************************************************************//** * @brief Print CTA observation information * * @param[in] chatter Chattiness (defaults to NORMAL).