GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GEvents.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GEvents.hpp - Abstract event container class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2009-2013 by Juergen Knoedlseder *
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 GEvents.cpp
23  * @brief Abstract event container class implementation
24  * @author Juergen Knoedlseder
25  */
26 
27 /* __ Includes ___________________________________________________________ */
28 #ifdef HAVE_CONFIG_H
29 #include <config.h>
30 #endif
31 #include "GEvents.hpp"
32 
33 /* __ Method name definitions ____________________________________________ */
34 
35 /* __ Macros _____________________________________________________________ */
36 
37 /* __ Coding definitions _________________________________________________ */
38 
39 /* __ Debug definitions __________________________________________________ */
40 
41 
42 /*==========================================================================
43  = =
44  = Constructors/destructors =
45  = =
46  ==========================================================================*/
47 
48 /***********************************************************************//**
49  * @brief Void constructor
50  ***************************************************************************/
52 {
53  // Initialise members
54  init_members();
55 
56  // Return
57  return;
58 }
59 
60 
61 /***********************************************************************//**
62  * @brief Copy constructor
63  *
64  * @param[in] events Event container.
65  ***************************************************************************/
66 GEvents::GEvents(const GEvents& events)
67 {
68  // Initialise members
69  init_members();
70 
71  // Copy members
72  copy_members(events);
73 
74  // Return
75  return;
76 }
77 
78 
79 /***********************************************************************//**
80  * @brief Destructor
81  ***************************************************************************/
83 {
84  // Free members
85  free_members();
86 
87  // Return
88  return;
89 }
90 
91 
92 /*==========================================================================
93  = =
94  = Operators =
95  = =
96  ==========================================================================*/
97 
98 /***********************************************************************//**
99  * @brief Assignment operator
100  *
101  * @param[in] events Event container.
102  * @return Event container.
103  ***************************************************************************/
105 {
106  // Execute only if object is not identical
107  if (this != &events) {
108 
109  // Free members
110  free_members();
111 
112  // Initialise members
113  init_members();
114 
115  // Copy members
116  copy_members(events);
117 
118  } // endif: object was not identical
119 
120  // Return this object
121  return *this;
122 }
123 
124 
125 /*==========================================================================
126  = =
127  = Public methods =
128  = =
129  ==========================================================================*/
130 
131 /***********************************************************************//**
132  * @brief Set energy boundaries
133  *
134  * @param[in] ebounds Energy boundaries.
135  ***************************************************************************/
136 void GEvents::ebounds(const GEbounds& ebounds)
137 {
138  // Store energy boundaries
139  m_ebounds = ebounds;
140 
141  // Call (abstract) energy boundary update method
142  set_energies();
143 
144  // Return
145  return;
146 }
147 
148 
149 /***********************************************************************//**
150  * @brief Set Good Time Intervals
151  *
152  * @param[in] gti Good Time Intervals.
153  ***************************************************************************/
154 void GEvents::gti(const GGti& gti)
155 {
156  // Store Good Time Intervals
157  m_gti = gti;
158 
159  // Call (abstract) good time interval update method
160  set_times();
161 
162  // Return
163  return;
164 }
165 
166 
167 /*==========================================================================
168  = =
169  = Private methods =
170  = =
171  ==========================================================================*/
172 
173 /***********************************************************************//**
174  * @brief Initialise class members
175  ***************************************************************************/
177 {
178  // Initialise members
179  m_ebounds.clear();
180  m_gti.clear();
181 
182  // Return
183  return;
184 }
185 
186 
187 /***********************************************************************//**
188  * @brief Copy class members
189  *
190  * @param[in] events Event container.
191  ***************************************************************************/
192 void GEvents::copy_members(const GEvents& events)
193 {
194  // Copy members
195  m_ebounds = events.m_ebounds;
196  m_gti = events.m_gti;
197 
198  // Return
199  return;
200 }
201 
202 
203 /***********************************************************************//**
204  * @brief Delete class members
205  ***************************************************************************/
207 {
208  // Return
209  return;
210 }
const GGti & gti(void) const
Return Good Time Intervals.
Definition: GEvents.hpp:134
void init_members(void)
Initialise class members.
Definition: GEvents.cpp:176
GEbounds m_ebounds
Energy boundaries covered by events.
Definition: GEvents.hpp:111
virtual GEvents & operator=(const GEvents &events)
Assignment operator.
Definition: GEvents.cpp:104
void clear(void)
Clear Good Time Intervals.
Definition: GGti.cpp:237
Energy boundaries container class.
Definition: GEbounds.hpp:60
virtual void set_times(void)=0
void copy_members(const GEvents &events)
Copy class members.
Definition: GEvents.cpp:192
void free_members(void)
Delete class members.
Definition: GEvents.cpp:206
virtual ~GEvents(void)
Destructor.
Definition: GEvents.cpp:82
GGti m_gti
Good time intervals covered by events.
Definition: GEvents.hpp:112
Good Time Interval class.
Definition: GGti.hpp:62
void clear(void)
Clear energy boundaries.
Definition: GEbounds.cpp:268
Abstract event container class.
Definition: GEvents.hpp:66
GEvents(void)
Void constructor.
Definition: GEvents.cpp:51
const GEbounds & ebounds(void) const
Return energy boundaries.
Definition: GEvents.hpp:122
virtual void set_energies(void)=0
Abstract event container class interface definition.