GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GModelData.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GModelData.hpp - Abstract virtual data model class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2011-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 GModelData.hpp
23  * @brief Abstract data model base class interface definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GMODELDATA_HPP
28 #define GMODELDATA_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <vector>
32 #include <string>
33 #include "GModel.hpp"
34 
35 /* __ Forward declarations _______________________________________________ */
36 class GEnergy;
37 class GTime;
38 class GEvent;
39 class GEvents;
40 class GObservation;
41 class GRan;
42 class GXmlElement;
43 
44 
45 /***********************************************************************//**
46  * @class GModelData
47  *
48  * @brief Abstract data model class
49  *
50  * This abstract base class implements a model of the event distribution in
51  * the instrument's data space.
52  ***************************************************************************/
53 class GModelData : public GModel {
54 
55 public:
56  // Constructors and destructors
57  GModelData(void);
58  explicit GModelData(const GXmlElement& xml);
59  GModelData(const GModelData& model);
60  virtual ~GModelData(void);
61 
62  // Operators
63  virtual GModelData& operator=(const GModelData& model);
64 
65  // Pure virtual methods
66  virtual void clear(void) = 0;
67  virtual GModelData* clone(void) const = 0;
68  virtual std::string classname(void) const = 0;
69  virtual std::string type(void) const = 0;
70  virtual bool is_constant(void) const = 0;
71  virtual double eval(const GEvent& event,
72  const GObservation& obs,
73  const bool& gradients = false) const = 0;
74  virtual double npred(const GEnergy& obsEng, const GTime& obsTime,
75  const GObservation& obs) const = 0;
76  virtual GEvents* mc(const GObservation& obs, GRan& ran) const = 0;
77  virtual void read(const GXmlElement& xml) = 0;
78  virtual void write(GXmlElement& xml) const = 0;
79  virtual std::string print(const GChatter& chatter = NORMAL) const = 0;
80 
81 protected:
82  // Protected methods
83  void init_members(void);
84  void copy_members(const GModelData& model);
85  void free_members(void);
86 };
87 
88 #endif /* GMODELDATA_HPP */
Abstract model class.
Definition: GModel.hpp:97
Abstract model base class interface definition.
virtual bool is_constant(void) const =0
Abstract interface for the event classes.
Definition: GEvent.hpp:71
XML element node class.
Definition: GXmlElement.hpp:47
void free_members(void)
Delete class members.
Definition: GModelData.cpp:181
Random number generator class.
Definition: GRan.hpp:44
Time class.
Definition: GTime.hpp:54
virtual GModelData * clone(void) const =0
Clones object.
virtual void clear(void)=0
Clear object.
virtual std::string print(const GChatter &chatter=NORMAL) const =0
Print content of object.
GModelData(void)
Void constructor.
Definition: GModelData.cpp:53
Abstract data model class.
Definition: GModelData.hpp:53
virtual GModelData & operator=(const GModelData &model)
Assignment operator.
Definition: GModelData.cpp:120
virtual void read(const GXmlElement &xml)=0
GChatter
Definition: GTypemaps.hpp:33
virtual double npred(const GEnergy &obsEng, const GTime &obsTime, const GObservation &obs) const =0
Abstract observation base class.
virtual GEvents * mc(const GObservation &obs, GRan &ran) const =0
virtual ~GModelData(void)
Destructor.
Definition: GModelData.cpp:99
void copy_members(const GModelData &model)
Copy class members.
Definition: GModelData.cpp:171
virtual void write(GXmlElement &xml) const =0
Abstract event container class.
Definition: GEvents.hpp:66
virtual std::string type(void) const =0
virtual std::string classname(void) const =0
Return class name.
virtual double eval(const GEvent &event, const GObservation &obs, const bool &gradients=false) const =0
void init_members(void)
Initialise class members.
Definition: GModelData.cpp:159
Class that handles energies in a unit independent way.
Definition: GEnergy.hpp:48