GammaLib 2.2.0.dev
Loading...
Searching...
No Matches
GCOMTim.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GCOMTim.hpp - COMPTEL Good Time Intervals class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2017-2026 by Juergen Knodlseder *
5 * ----------------------------------------------------------------------- *
6 * *
7 * This program is free software: you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation, either version 3 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19 * *
20 ***************************************************************************/
21/**
22 * @file GCOMTim.hpp
23 * @brief COMPTEL Good Time Intervals class definition
24 * @author Juergen Knodlseder
25 */
26
27#ifndef GCOMTIM_HPP
28#define GCOMTIM_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
32#include "GBase.hpp"
33#include "GGti.hpp"
34
35/* __ Forward declarations _______________________________________________ */
36class GFilename;
37class GFitsTable;
38class GFitsBinTable;
39
40/* __ Constants __________________________________________________________ */
41
42
43/***********************************************************************//**
44 * @class GCOMTim
45 *
46 * @brief COMPTEL Good Time Intervals class
47 *
48 * @todo Add class description.
49 ***************************************************************************/
50class GCOMTim : public GBase {
51
52public:
53 // Constructors and destructors
54 GCOMTim(void);
55 explicit GCOMTim(const GGti& gti);
56 GCOMTim(const GCOMTim& tim);
57 GCOMTim(const GFilename& filename, const std::string& usage = "YES",
58 const std::string& mode = "NORMAL|SOLAR80|LOW");
59 virtual ~GCOMTim(void);
60
61 // Operators
62 GCOMTim& operator=(const GCOMTim& tim);
63
64 // Implemented pure virtual base class methods
65 virtual void clear(void);
66 virtual GCOMTim* clone(void) const;
67 virtual std::string classname(void) const;
68 virtual std::string print(const GChatter& chatter = NORMAL) const;
69
70 // Other methods
71 bool contains(const GTime& time) const;
72 void reduce(const GGti& gti);
73 const GGti& gti(void) const;
74 void gti(const GGti& gti);
75 void load(const GFilename& filename, const std::string& usage = "YES",
76 const std::string& mode = "NORMAL|SOLAR80|LOW");
77 void save(const GFilename& filename, const bool& clobber = false) const;
78 void read(const GFitsTable& table, const std::string& usage = "YES",
79 const std::string& mode = "NORMAL|SOLAR80|LOW");
80 void write(GFitsBinTable& table) const;
81
82protected:
83 // Protected methods
84 void init_members(void);
85 void copy_members(const GCOMTim& tim);
86 void free_members(void);
87
88 // Protected members
89 GGti m_gti; //!< Good Time intervals
90 std::vector<std::string> m_usage; //!< Usage string
91 std::vector<std::string> m_mode; //!< Mode string
92 std::vector<std::string> m_subkey; //!< Subkey string
93 std::vector<std::string> m_descrip; //!< Description string
94};
95
96
97/***********************************************************************//**
98 * @brief Return class name
99 *
100 * @return String containing the class name ("GCOMTim").
101 ***************************************************************************/
102inline
103std::string GCOMTim::classname(void) const
104{
105 return ("GCOMTim");
106}
107
108
109/***********************************************************************//**
110 * @brief Check if time is comprised in the Good Time Intervals
111 *
112 * @param[in] time Time.
113 * @return True if time is within Good Time Intervals, false otherwise.
114 *
115 * Checks if a time is comprised in the Good Time Intervals.
116 ***************************************************************************/
117inline
118bool GCOMTim::contains(const GTime& time) const
119{
120 return (m_gti.contains(time));
121}
122
123
124/***********************************************************************//**
125 * @brief Reduces Good Time Intervals to intersection with intervals
126 *
127 * @param[in] gti Good Time Intervals.
128 *
129 * Reduces the Good Time Intervals to the intersection with the specified
130 * list of Good Time Intervals.
131 ***************************************************************************/
132inline
133void GCOMTim::reduce(const GGti& gti)
134{
136 return;
137}
138
139
140/***********************************************************************//**
141 * @brief Return Good Time Intervals
142 *
143 * @return Good Time Intervals.
144 *
145 * Returns the Good Time Intervals.
146 ***************************************************************************/
147inline
148const GGti& GCOMTim::gti(void) const
149{
150 return m_gti;
151}
152
153
154/***********************************************************************//**
155 * @brief Set Good Time Intervals
156 *
157 * @param[in] gti Good Time Intervals.
158 *
159 * Sets the Good Time Intervals.
160 ***************************************************************************/
161inline
162void GCOMTim::gti(const GGti& gti)
163{
164 m_gti = gti;
165 return;
166}
167
168#endif /* GCOMTIM_HPP */
Definition of interface for all GammaLib classes.
Good time interval class interface definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
Interface class for all GammaLib classes.
Definition GBase.hpp:52
COMPTEL Good Time Intervals class.
Definition GCOMTim.hpp:50
GGti m_gti
Good Time intervals.
Definition GCOMTim.hpp:89
const GGti & gti(void) const
Return Good Time Intervals.
Definition GCOMTim.hpp:148
void write(GFitsBinTable &table) const
Write COMPTEL Good Time Intervals into FITS binary table.
Definition GCOMTim.cpp:377
std::vector< std::string > m_usage
Usage string.
Definition GCOMTim.hpp:90
void reduce(const GGti &gti)
Reduces Good Time Intervals to intersection with intervals.
Definition GCOMTim.hpp:133
bool contains(const GTime &time) const
Check if time is comprised in the Good Time Intervals.
Definition GCOMTim.hpp:118
std::vector< std::string > m_subkey
Subkey string.
Definition GCOMTim.hpp:92
GCOMTim(void)
Void constructor.
Definition GCOMTim.cpp:59
virtual void clear(void)
Clear COMPTEL good time intervals.
Definition GCOMTim.cpp:185
virtual std::string print(const GChatter &chatter=NORMAL) const
Print COMPTEL Good Time Intervals.
Definition GCOMTim.cpp:442
virtual std::string classname(void) const
Return class name.
Definition GCOMTim.hpp:103
void init_members(void)
Initialise class members.
Definition GCOMTim.cpp:532
virtual ~GCOMTim(void)
Destructor.
Definition GCOMTim.cpp:133
void read(const GFitsTable &table, const std::string &usage="YES", const std::string &mode="NORMAL|SOLAR80|LOW")
Read COMPTEL Good Time Intervals from FITS table.
Definition GCOMTim.cpp:281
GCOMTim & operator=(const GCOMTim &tim)
Assignment operator.
Definition GCOMTim.cpp:155
std::vector< std::string > m_descrip
Description string.
Definition GCOMTim.hpp:93
void free_members(void)
Delete class members.
Definition GCOMTim.cpp:568
void copy_members(const GCOMTim &tim)
Copy class members.
Definition GCOMTim.cpp:551
void save(const GFilename &filename, const bool &clobber=false) const
Save Good Time Intervals into FITS file.
Definition GCOMTim.cpp:247
void load(const GFilename &filename, const std::string &usage="YES", const std::string &mode="NORMAL|SOLAR80|LOW")
Load COMPTEL Good Time Intervals from FITS file.
Definition GCOMTim.cpp:218
virtual GCOMTim * clone(void) const
Clone COMPTEL good time intervals.
Definition GCOMTim.cpp:203
std::vector< std::string > m_mode
Mode string.
Definition GCOMTim.hpp:91
Filename class.
Definition GFilename.hpp:62
FITS binary table class.
Abstract interface for FITS table.
Good Time Interval class.
Definition GGti.hpp:63
bool contains(const GTime &time) const
Checks whether Good Time Intervals contains time.
Definition GGti.cpp:1089
void reduce(const GTime &tstart, const GTime &tstop)
Reduce Good Time Intervals to specified interval.
Definition GGti.cpp:420
Time class.
Definition GTime.hpp:55