GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCOMStatus.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GCOMStatus.hpp - COMPTEL instrument status class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2017 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 GCOMStatus.hpp
23  * @brief COMPTEL instrument status class definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GCOMSTATUS_HPP
28 #define GCOMSTATUS_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include <vector>
33 #include "GBase.hpp"
34 
35 /* __ Forward declarations _______________________________________________ */
36 
37 /* __ Constants __________________________________________________________ */
38 
39 
40 /***********************************************************************//**
41  * @class GCOMStatus
42  *
43  * @brief COMPTEL instrument status class
44  *
45  * The class implements a database of the COMPTEL instrument status. For the
46  * time being the database contains the status of the D1 and D2 modules for
47  * all days that are covered by the CGRO mission.
48  ***************************************************************************/
49 class GCOMStatus : public GBase {
50 
51 public:
52  // Constructors and destructors
53  GCOMStatus(void);
54  GCOMStatus(const GCOMStatus& status);
55  virtual ~GCOMStatus(void);
56 
57  // Operators
58  GCOMStatus& operator=(const GCOMStatus& status);
59 
60  // Implemented pure virtual base class methods
61  virtual void clear(void);
62  virtual GCOMStatus* clone(void) const;
63  virtual std::string classname(void) const;
64  virtual std::string print(const GChatter& chatter = NORMAL) const;
65 
66  // Other methods
67  void load(void) const;
68  int d1status(const int& tjd, const int& module) const;
69  int d2status(const int& tjd, const int& module) const;
70 
71 protected:
72  // Protected methods
73  void init_members(void);
74  void copy_members(const GCOMStatus& status);
75  void free_members(void);
76  void update_cache(const int& tjd) const;
77  void load_status(void) const;
78 
79  // Protected members
80  mutable std::vector<int> m_tjds; //!< TJD for status
81  mutable std::vector<std::vector<int> > m_d1status; //!< D1 module status
82  mutable std::vector<std::vector<int> > m_d2status; //!< D2 module status
83 
84  // Cache for last module status
85  mutable int m_last_tjd; //!< Last TJD
86  mutable std::vector<int> m_last_d1status; //!< Last D1 module status
87  mutable std::vector<int> m_last_d2status; //!< Last D2 module status
88 };
89 
90 
91 /***********************************************************************//**
92  * @brief Return class name
93  *
94  * @return String containing the class name ("GCOMStatus").
95  ***************************************************************************/
96 inline
97 std::string GCOMStatus::classname(void) const
98 {
99  return ("GCOMStatus");
100 }
101 
102 #endif /* GCOMSTATUS_HPP */
COMPTEL instrument status class.
Definition: GCOMStatus.hpp:49
std::vector< int > m_last_d2status
Last D2 module status.
Definition: GCOMStatus.hpp:87
virtual void clear(void)
Clear COMPTEL instrument status.
Definition: GCOMStatus.cpp:144
void free_members(void)
Delete class members.
Definition: GCOMStatus.cpp:330
void load_status(void) const
Load status information from database.
Definition: GCOMStatus.cpp:383
Definition of interface for all GammaLib classes.
virtual ~GCOMStatus(void)
Destructor.
Definition: GCOMStatus.cpp:92
std::vector< int > m_tjds
TJD for status.
Definition: GCOMStatus.hpp:80
virtual GCOMStatus * clone(void) const
Clone COMPTEL instrument status.
Definition: GCOMStatus.cpp:162
GCOMStatus & operator=(const GCOMStatus &status)
Assignment operator.
Definition: GCOMStatus.cpp:114
void copy_members(const GCOMStatus &status)
Copy class members.
Definition: GCOMStatus.cpp:310
Interface class for all GammaLib classes.
Definition: GBase.hpp:52
GChatter
Definition: GTypemaps.hpp:33
GCOMStatus(void)
Void constructor.
Definition: GCOMStatus.cpp:61
std::vector< std::vector< int > > m_d1status
D1 module status.
Definition: GCOMStatus.hpp:81
int d1status(const int &tjd, const int &module) const
Return D1 module status.
Definition: GCOMStatus.cpp:188
int d2status(const int &tjd, const int &module) const
Return D2 module status.
Definition: GCOMStatus.cpp:217
virtual std::string classname(void) const
Return class name.
Definition: GCOMStatus.hpp:97
int m_last_tjd
Last TJD.
Definition: GCOMStatus.hpp:85
std::vector< std::vector< int > > m_d2status
D2 module status.
Definition: GCOMStatus.hpp:82
std::vector< int > m_last_d1status
Last D1 module status.
Definition: GCOMStatus.hpp:86
void init_members(void)
Initialise class members.
Definition: GCOMStatus.cpp:288
void load(void) const
Load COMPTEL instrument status database.
Definition: GCOMStatus.cpp:171
void update_cache(const int &tjd) const
Update module status cache.
Definition: GCOMStatus.cpp:342
virtual std::string print(const GChatter &chatter=NORMAL) const
Print COMPTEL instrument status.
Definition: GCOMStatus.cpp:245