Commit 8ca83c24cbdb46654ebccc7badfc87804469f185

Authored by knodlseder
1 parent f17271b0

add GTI access methods

include/GGti.hpp
... ... @@ -56,6 +56,8 @@ public:
56 56 int size(void) const { return m_num; }
57 57 GTime tstart(void) const { return m_tstart; }
58 58 GTime tstop(void) const { return m_tstop; }
  59 + GTime tstart(int inx) const;
  60 + GTime tstop(int inx) const;
59 61 double telapse(void) const { return m_telapse; }
60 62 double ontime(void) const { return m_ontime; }
61 63  
... ...
src/obs/GGti.cpp
... ... @@ -26,6 +26,8 @@
26 26 #include "GFits.hpp"
27 27  
28 28 /* __ Method name definitions ____________________________________________ */
  29 +#define G_TSTART "GGti::tstart(int)"
  30 +#define G_TSTOP "GGti::tstop(int)"
29 31  
30 32 /* __ Macros _____________________________________________________________ */
31 33  
... ... @@ -224,6 +226,44 @@ void GGti::load(const std::string& filename)
224 226 }
225 227  
226 228  
  229 +/***********************************************************************//**
  230 + * @brief Returns start time of specific GTI
  231 + *
  232 + * @param[in] inx Index of GTI in array.
  233 + *
  234 + * @exception GException::out_of_range
  235 + * Specified index is out of range.
  236 + ***************************************************************************/
  237 +GTime GGti::tstart(int inx) const
  238 +{
  239 + // If index is outside boundary then throw an error
  240 + if (inx < 0 || inx >= m_num)
  241 + throw GException::out_of_range(G_TSTART, inx, 0, m_num-1);
  242 +
  243 + // Return
  244 + return (m_start[inx]);
  245 +}
  246 +
  247 +
  248 +/***********************************************************************//**
  249 + * @brief Returns stop time of specific GTI
  250 + *
  251 + * @param[in] inx Index of GTI in array.
  252 + *
  253 + * @exception GException::out_of_range
  254 + * Specified index is out of range.
  255 + ***************************************************************************/
  256 +GTime GGti::tstop(int inx) const
  257 +{
  258 + // If index is outside boundary then throw an error
  259 + if (inx < 0 || inx >= m_num)
  260 + throw GException::out_of_range(G_TSTOP, inx, 0, m_num-1);
  261 +
  262 + // Return
  263 + return (m_stop[inx]);
  264 +}
  265 +
  266 +
227 267 /*==========================================================================
228 268 = =
229 269 = Private methods =
... ...