Commit 125e1bfb4da6d15aeeaddff8a05db2b9f7345dab
1 parent
d65e0558
add observation ID
Showing
3 changed files
with
33 additions
and
5 deletions
include/GObservation.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GObservation.hpp - Abstract observation base class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2008-2011 by Jurgen Knodlseder * | |
| 4 | + * copyright (C) 2008-2011 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -21,7 +21,7 @@ |
| 21 | 21 | /** |
| 22 | 22 | * @file GObservation.hpp |
| 23 | 23 | * @brief Abstract observation base class interface definition |
| 24 | - * @author J. Knodlseder | |
| 24 | + * @author J. Knoedlseder | |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | 27 | #ifndef GOBSERVATION_HPP |
| ... | ... | @@ -84,6 +84,8 @@ public: |
| 84 | 84 | virtual GResponse* response(void) const = 0; |
| 85 | 85 | virtual GPointing* pointing(const GTime& time) const = 0; |
| 86 | 86 | virtual std::string instrument(void) const = 0; |
| 87 | + virtual void read(const GXmlElement& xml) = 0; | |
| 88 | + virtual void write(GXmlElement& xml) const = 0; | |
| 87 | 89 | virtual std::string print(void) const = 0; |
| 88 | 90 | |
| 89 | 91 | // Virtual methods |
| ... | ... | @@ -93,9 +95,11 @@ public: |
| 93 | 95 | |
| 94 | 96 | // Implemented methods |
| 95 | 97 | void name(const std::string& name); |
| 98 | + void id(const std::string& id); | |
| 96 | 99 | void events(const GEvents* events); |
| 97 | 100 | void statistics(const std::string& statistics); |
| 98 | 101 | const std::string& name(void) const { return m_name; } |
| 102 | + const std::string& id(void) const { return m_id; } | |
| 99 | 103 | const GEvents* events(void) const; |
| 100 | 104 | const std::string& statistics(void) const { return m_statistics; } |
| 101 | 105 | |
| ... | ... | @@ -179,6 +183,7 @@ protected: |
| 179 | 183 | |
| 180 | 184 | // Protected data area |
| 181 | 185 | std::string m_name; //!< Name of observation |
| 186 | + std::string m_id; //!< Observation identifier | |
| 182 | 187 | std::string m_statistics; //!< Optimizer statistics (default=poisson) |
| 183 | 188 | GEvents* m_events; //!< Pointer to event container |
| 184 | 189 | }; | ... | ... |
pyext/GObservation.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GObservation.i - Abstract observation abstract base class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2008-2011 by Jurgen Knodlseder * | |
| 4 | + * copyright (C) 2008-2011 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -21,7 +21,7 @@ |
| 21 | 21 | /** |
| 22 | 22 | * @file GObservation.i |
| 23 | 23 | * @brief Abstract observation base class Python interface definition |
| 24 | - * @author J. Knodlseder | |
| 24 | + * @author J. Knoedlseder | |
| 25 | 25 | */ |
| 26 | 26 | %{ |
| 27 | 27 | /* Put headers and other declarations here that are needed for compilation */ |
| ... | ... | @@ -49,6 +49,8 @@ public: |
| 49 | 49 | virtual GResponse* response(void) const = 0; |
| 50 | 50 | virtual GPointing* pointing(const GTime& time) const = 0; |
| 51 | 51 | virtual std::string instrument(void) const = 0; |
| 52 | + virtual void read(const GXmlElement& xml) = 0; | |
| 53 | + virtual void write(GXmlElement& xml) const = 0; | |
| 52 | 54 | |
| 53 | 55 | // Virtual methods |
| 54 | 56 | virtual double model(const GModels& models, const GEvent& event, |
| ... | ... | @@ -57,9 +59,11 @@ public: |
| 57 | 59 | |
| 58 | 60 | // Implemented methods |
| 59 | 61 | void name(const std::string& name); |
| 62 | + void id(const std::string& id); | |
| 60 | 63 | void events(const GEvents* events); |
| 61 | 64 | void statistics(const std::string& statistics); |
| 62 | 65 | const std::string& name(void) const; |
| 66 | + const std::string& id(void) const; | |
| 63 | 67 | const GEvents* events(void) const; |
| 64 | 68 | const std::string& statistics(void) const; |
| 65 | 69 | ... | ... |
src/obs/GObservation.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GObservation.cpp - Abstract observation base class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2008-2011 by Jurgen Knodlseder * | |
| 4 | + * copyright (C) 2008-2011 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -302,6 +302,23 @@ void GObservation::name(const std::string& name) |
| 302 | 302 | |
| 303 | 303 | |
| 304 | 304 | /***********************************************************************//** |
| 305 | + * @brief Set observation identifier | |
| 306 | + * | |
| 307 | + * @param[in] id Observation identifier. | |
| 308 | + * | |
| 309 | + * Set identifier of the observation. | |
| 310 | + ***************************************************************************/ | |
| 311 | +void GObservation::id(const std::string& id) | |
| 312 | +{ | |
| 313 | + // Set identifier | |
| 314 | + m_id = id; | |
| 315 | + | |
| 316 | + // Return | |
| 317 | + return; | |
| 318 | +} | |
| 319 | + | |
| 320 | + | |
| 321 | +/***********************************************************************//** | |
| 305 | 322 | * @brief Set event container |
| 306 | 323 | * |
| 307 | 324 | * @param[in] events Event container pointer. |
| ... | ... | @@ -376,6 +393,7 @@ void GObservation::init_members(void) |
| 376 | 393 | { |
| 377 | 394 | // Initialise members |
| 378 | 395 | m_name.clear(); |
| 396 | + m_id.clear(); | |
| 379 | 397 | m_statistics = "Poisson"; |
| 380 | 398 | m_events = NULL; |
| 381 | 399 | |
| ... | ... | @@ -395,6 +413,7 @@ void GObservation::copy_members(const GObservation& obs) |
| 395 | 413 | { |
| 396 | 414 | // Copy members |
| 397 | 415 | m_name = obs.m_name; |
| 416 | + m_id = obs.m_id; | |
| 398 | 417 | m_statistics = obs.m_statistics; |
| 399 | 418 | |
| 400 | 419 | // Clone members | ... | ... |