GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GMWLObservation.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GMWLObservation.hpp - Multi-wavelength observation class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2010-2016 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 GMWLObservation.hpp
23  * @brief Multi-wavelength observation class interface definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GMWLOBSERVATION_HPP
28 #define GMWLOBSERVATION_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include "GTime.hpp"
33 #include "GFilename.hpp"
34 #include "GObservation.hpp"
35 #include "GMWLResponse.hpp"
36 
37 /* __ Forward declarations _______________________________________________ */
38 class GResponse;
39 class GXmlElement;
40 
41 
42 /***********************************************************************//**
43  * @class GMWLObservation
44  *
45  * @brief Interface class for multi-wavelength observations
46  *
47  * This class implements a multi-wavelength observation. A multi-wavelength
48  * observation contains spectral points obtained with an unspecified
49  * instrument. The spectral points are given in physical units.
50  ***************************************************************************/
51 class GMWLObservation : public GObservation {
52 
53 public:
54  // Constructors and destructors
55  GMWLObservation(void);
56  explicit GMWLObservation(const GFilename& filename);
57  GMWLObservation(const GMWLObservation& obs);
58  virtual ~GMWLObservation(void);
59 
60  // Operators
61  virtual GMWLObservation& operator= (const GMWLObservation& obs);
62 
63  // Implement pure virtual methods
64  virtual void clear(void);
65  virtual GMWLObservation* clone(void) const;
66  virtual std::string classname(void) const;
67  virtual void response(const GResponse& rsp);
68  virtual const GMWLResponse* response(void) const;
69  virtual std::string instrument(void) const;
70  virtual double ontime(void) const;
71  virtual double livetime(void) const;
72  virtual double deadc(const GTime& time = GTime()) const;
73  virtual void read(const GXmlElement& xml);
74  virtual void write(GXmlElement& xml) const;
75  virtual std::string print(const GChatter& chatter = NORMAL) const;
76 
77  // Other methods
78  void load(const GFilename& filename);
79  const GFilename& filename(void) const;
80  void filename(const GFilename& filename);
81 
82 protected:
83  // Protected methods
84  void init_members(void);
85  void copy_members(const GMWLObservation& obs);
86  void free_members(void);
87 
88  // Protected members
89  std::string m_instrument; //!< Instrument name
90  GFilename m_filename; //!< Filename
91  GMWLResponse m_response; //!< Response function
92 };
93 
94 
95 /***********************************************************************//**
96  * @brief Return class name
97  *
98  * @return String containing the class name ("GMWLObservation").
99  ***************************************************************************/
100 inline
101 std::string GMWLObservation::classname(void) const
102 {
103  return ("GMWLObservation");
104 }
105 
106 
107 /***********************************************************************//**
108  * @brief Return response
109  *
110  * @return Response.
111  ***************************************************************************/
112 inline
114 {
115  return &m_response;
116 }
117 
118 
119 /***********************************************************************//**
120  * @brief Return instrument name
121  *
122  * @return Instrument name.
123  ***************************************************************************/
124 inline
125 std::string GMWLObservation::instrument(void) const
126 {
127  return "MWL";
128 }
129 
130 
131 /***********************************************************************//**
132  * @brief Return ontime
133  *
134  * @return Ontime (always 1).
135  ***************************************************************************/
136 inline
137 double GMWLObservation::ontime(void) const
138 {
139  return 1.0;
140 }
141 
142 
143 /***********************************************************************//**
144  * @brief Return livetime
145  *
146  * @return Livetime (always 1).
147  ***************************************************************************/
148 inline
149 double GMWLObservation::livetime(void) const
150 {
151  return 1.0;
152 }
153 
154 
155 /***********************************************************************//**
156  * @brief Return deadtime correction factor
157  *
158  * @return Deadtime correction factor (always 1).
159  ***************************************************************************/
160 inline
161 double GMWLObservation::deadc(const GTime& time) const
162 {
163  return 1.0;
164 }
165 
166 
167 /***********************************************************************//**
168  * @brief Return filename
169  *
170  * @return Filename.
171  ***************************************************************************/
172 inline
174 {
175  return (m_filename);
176 }
177 
178 
179 /***********************************************************************//**
180  * @brief Set filename
181  *
182  * @param[in] filename Filename.
183  ***************************************************************************/
184 inline
186 {
188  return;
189 }
190 
191 #endif /* GMWLOBSERVATION_HPP */
const GFilename & filename(void) const
Return filename.
Multi-wavelength response class.
virtual GMWLObservation * clone(void) const
Clone instance.
std::string m_instrument
Instrument name.
XML element node class.
Definition: GXmlElement.hpp:48
Time class.
Definition: GTime.hpp:55
virtual double deadc(const GTime &time=GTime()) const
Return deadtime correction factor.
virtual ~GMWLObservation(void)
Destructor.
Multi-wavelength response class interface definition.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print multi-wavelength information.
Filename class.
Definition: GFilename.hpp:62
void copy_members(const GMWLObservation &obs)
Copy class members.
Interface class for multi-wavelength observations.
virtual std::string classname(void) const
Return class name.
GChatter
Definition: GTypemaps.hpp:33
Abstract observation base class.
GMWLResponse m_response
Response function.
virtual void read(const GXmlElement &xml)
Read observation from XML element.
Abstract observation base class interface definition.
virtual double livetime(void) const
Return livetime.
GFilename m_filename
Filename.
virtual GMWLObservation & operator=(const GMWLObservation &obs)
Assignment operator.
virtual double ontime(void) const
Return ontime.
virtual std::string instrument(void) const
Return instrument name.
void init_members(void)
Initialise class members.
virtual const GMWLResponse * response(void) const
Return response.
virtual void write(GXmlElement &xml) const
Write observation into XML element.
virtual void clear(void)
Clear instance.
Abstract instrument response base class.
Definition: GResponse.hpp:77
GMWLObservation(void)
Void constructor.
void load(const GFilename &filename)
Load observation.
Time class interface definition.
Filename class interface definition.
void free_members(void)
Delete class members.