From 125e1bfb4da6d15aeeaddff8a05db2b9f7345dab Mon Sep 17 00:00:00 2001 From: knodlseder <> Date: Tue, 8 Nov 2011 00:34:38 +0000 Subject: [PATCH] add observation ID --- include/GObservation.hpp | 9 +++++++-- pyext/GObservation.i | 8 ++++++-- src/obs/GObservation.cpp | 21 ++++++++++++++++++++- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/include/GObservation.hpp b/include/GObservation.hpp index c42de23..4f3a992 100644 --- a/include/GObservation.hpp +++ b/include/GObservation.hpp @@ -1,7 +1,7 @@ /*************************************************************************** * GObservation.hpp - Abstract observation base class * * ----------------------------------------------------------------------- * - * copyright (C) 2008-2011 by Jurgen Knodlseder * + * copyright (C) 2008-2011 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -21,7 +21,7 @@ /** * @file GObservation.hpp * @brief Abstract observation base class interface definition - * @author J. Knodlseder + * @author J. Knoedlseder */ #ifndef GOBSERVATION_HPP @@ -84,6 +84,8 @@ public: virtual GResponse* response(void) const = 0; virtual GPointing* pointing(const GTime& time) const = 0; virtual std::string instrument(void) const = 0; + virtual void read(const GXmlElement& xml) = 0; + virtual void write(GXmlElement& xml) const = 0; virtual std::string print(void) const = 0; // Virtual methods @@ -93,9 +95,11 @@ public: // Implemented methods void name(const std::string& name); + void id(const std::string& id); void events(const GEvents* events); void statistics(const std::string& statistics); const std::string& name(void) const { return m_name; } + const std::string& id(void) const { return m_id; } const GEvents* events(void) const; const std::string& statistics(void) const { return m_statistics; } @@ -179,6 +183,7 @@ protected: // Protected data area std::string m_name; //!< Name of observation + std::string m_id; //!< Observation identifier std::string m_statistics; //!< Optimizer statistics (default=poisson) GEvents* m_events; //!< Pointer to event container }; diff --git a/pyext/GObservation.i b/pyext/GObservation.i index 35cad1d..2b9ca8c 100644 --- a/pyext/GObservation.i +++ b/pyext/GObservation.i @@ -1,7 +1,7 @@ /*************************************************************************** * GObservation.i - Abstract observation abstract base class * * ----------------------------------------------------------------------- * - * copyright (C) 2008-2011 by Jurgen Knodlseder * + * copyright (C) 2008-2011 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -21,7 +21,7 @@ /** * @file GObservation.i * @brief Abstract observation base class Python interface definition - * @author J. Knodlseder + * @author J. Knoedlseder */ %{ /* Put headers and other declarations here that are needed for compilation */ @@ -49,6 +49,8 @@ public: virtual GResponse* response(void) const = 0; virtual GPointing* pointing(const GTime& time) const = 0; virtual std::string instrument(void) const = 0; + virtual void read(const GXmlElement& xml) = 0; + virtual void write(GXmlElement& xml) const = 0; // Virtual methods virtual double model(const GModels& models, const GEvent& event, @@ -57,9 +59,11 @@ public: // Implemented methods void name(const std::string& name); + void id(const std::string& id); void events(const GEvents* events); void statistics(const std::string& statistics); const std::string& name(void) const; + const std::string& id(void) const; const GEvents* events(void) const; const std::string& statistics(void) const; diff --git a/src/obs/GObservation.cpp b/src/obs/GObservation.cpp index 4de1164..d9ae5fe 100644 --- a/src/obs/GObservation.cpp +++ b/src/obs/GObservation.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * GObservation.cpp - Abstract observation base class * * ----------------------------------------------------------------------- * - * copyright (C) 2008-2011 by Jurgen Knodlseder * + * copyright (C) 2008-2011 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -302,6 +302,23 @@ void GObservation::name(const std::string& name) /***********************************************************************//** + * @brief Set observation identifier + * + * @param[in] id Observation identifier. + * + * Set identifier of the observation. + ***************************************************************************/ +void GObservation::id(const std::string& id) +{ + // Set identifier + m_id = id; + + // Return + return; +} + + +/***********************************************************************//** * @brief Set event container * * @param[in] events Event container pointer. @@ -376,6 +393,7 @@ void GObservation::init_members(void) { // Initialise members m_name.clear(); + m_id.clear(); m_statistics = "Poisson"; m_events = NULL; @@ -395,6 +413,7 @@ void GObservation::copy_members(const GObservation& obs) { // Copy members m_name = obs.m_name; + m_id = obs.m_id; m_statistics = obs.m_statistics; // Clone members -- libgit2 0.21.4