GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCOMBvcs.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GCOMBvcs.hpp - COMPTEL Solar System Barycentre Data container class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2022 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 GCOMBvcs.hpp
23  * @brief COMPTEL Solar System Barycentre Data container class definition
24  * @author Juergen Knodlseder
25  */
26 
27 #ifndef GCOMBVCS_HPP
28 #define GCOMBVCS_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include <vector>
33 #include "GCOMBvc.hpp"
34 #include "GContainer.hpp"
35 
36 /* __ Forward declarations _______________________________________________ */
37 class GFilename;
38 class GFitsTable;
39 class GTime;
40 class GCOMOad;
41 
42 /* __ Constants __________________________________________________________ */
43 
44 
45 /***********************************************************************//**
46  * @class GCOMBvcs
47  *
48  * @brief COMPTEL Solar System Barycentre Data container class
49  *
50  * The COMPTEL Solar System Barycentre Data container class holds records
51  * of Solar System Barycentre data that were extracted from one COMPTEL BVC
52  * FITS file.
53  ***************************************************************************/
54 class GCOMBvcs : public GContainer {
55 
56 public:
57  // Constructors and destructors
58  GCOMBvcs(void);
59  explicit GCOMBvcs(const GFilename& filename);
60  GCOMBvcs(const GCOMBvcs& bvcs);
61  virtual ~GCOMBvcs(void);
62 
63  // Operators
64  GCOMBvcs& operator=(const GCOMBvcs& bvcs);
65  GCOMBvc& operator[](const int& index);
66  const GCOMBvc& operator[](const int& index) const;
67 
68  // Methods
69  void clear(void);
70  GCOMBvcs* clone(void) const;
71  std::string classname(void) const;
72  GCOMBvc& at(const int& index);
73  const GCOMBvc& at(const int& index) const;
74  int size(void) const;
75  bool is_empty(void) const;
76  GCOMBvc& append(const GCOMBvc& bvc);
77  GCOMBvc& insert(const int& index, const GCOMBvc& bvc);
78  void remove(const int& index);
79  void reserve(const int& num);
80  void extend(const GCOMBvcs& bvcs);
81  void load(const GFilename& filename);
82  void read(const GFitsTable& table);
83  const GCOMBvc* find(const GCOMOad& oad) const;
84  double tdelta(const GSkyDir& dir, const GTime& time) const;
85  std::string print(const GChatter& chatter = NORMAL) const;
86 
87 protected:
88  // Protected methods
89  void init_members(void);
90  void copy_members(const GCOMBvcs& bvcs);
91  void free_members(void);
92 
93  // Protected data members
94  std::vector<GCOMBvc> m_bvcs; //!< Solar System Barycentre Data records
95 };
96 
97 
98 /***********************************************************************//**
99  * @brief Return class name
100  *
101  * @return String containing the class name ("GCOMBvcs").
102  ***************************************************************************/
103 inline
104 std::string GCOMBvcs::classname(void) const
105 {
106  return ("GCOMBvcs");
107 }
108 
109 
110 /***********************************************************************//**
111  * @brief Return reference to Solar System Barycentre Data
112  *
113  * @param[in] index Solar System Barycentre Data index [0,...,size()-1].
114  *
115  * Returns a reference to the Solar System Barycentre Data with the
116  * specified @p index.
117  ***************************************************************************/
118 inline
119 GCOMBvc& GCOMBvcs::operator[](const int& index)
120 {
121  return (m_bvcs[index]);
122 }
123 
124 
125 /***********************************************************************//**
126  * @brief Return reference to Solar System Barycentre Data (const version)
127  *
128  * @param[in] index Solar System Barycentre Data index [0,...,size()-1].
129  *
130  * Returns a reference to the Solar System Barycentre Data with the specified
131  * @p index.
132  ***************************************************************************/
133 inline
134 const GCOMBvc& GCOMBvcs::operator[](const int& index) const
135 {
136  return (m_bvcs[index]);
137 }
138 
139 
140 /***********************************************************************//**
141  * @brief Return number of Solar System Barycentre Data in container
142  *
143  * @return Number of Solar System Barycentre Data in container.
144  *
145  * Returns the number of Solar System Barycentre Data in the container.
146  ***************************************************************************/
147 inline
148 int GCOMBvcs::size(void) const
149 {
150  return (int)m_bvcs.size();
151 }
152 
153 
154 /***********************************************************************//**
155  * @brief Signals if there are no Solar System Barycentre Data in container
156  *
157  * @return True if container is empty, false otherwise.
158  *
159  * Signals if the Solar System Barycentre Data container does not contain
160  * any Solar System Barycentre Data.
161  ***************************************************************************/
162 inline
163 bool GCOMBvcs::is_empty(void) const
164 {
165  return (m_bvcs.empty());
166 }
167 
168 
169 /***********************************************************************//**
170  * @brief Reserves space for Solar System Barycentre Data in container
171  *
172  * @param[in] num Number of Solar System Barycentre Data.
173  *
174  * Reserves space for @p num Solar System Barycentre Data in the container.
175  ***************************************************************************/
176 inline
177 void GCOMBvcs::reserve(const int& num)
178 {
179  m_bvcs.reserve(num);
180  return;
181 }
182 
183 #endif /* GCOMBVCS_HPP */
GCOMBvcs(void)
Void constructor.
Definition: GCOMBvcs.cpp:66
GCOMBvc & insert(const int &index, const GCOMBvc &bvc)
Insert Solar System Barycentre Data into container.
Definition: GCOMBvcs.cpp:274
COMPTEL Solar System Barycentre Data class.
Definition: GCOMBvc.hpp:49
GCOMBvcs & operator=(const GCOMBvcs &bvcs)
Assignment operator.
Definition: GCOMBvcs.cpp:140
void extend(const GCOMBvcs &bvcs)
Append Solar System Barycentre Data container.
Definition: GCOMBvcs.cpp:338
virtual ~GCOMBvcs(void)
Destructor.
Definition: GCOMBvcs.cpp:118
Time class.
Definition: GTime.hpp:55
COMPTEL Solar System Barycentre Data class definition.
bool is_empty(void) const
Signals if there are no Solar System Barycentre Data in container.
Definition: GCOMBvcs.hpp:163
COMPTEL Orbit Aspect Data class.
Definition: GCOMOad.hpp:49
void init_members(void)
Initialise class members.
Definition: GCOMBvcs.cpp:772
double tdelta(const GSkyDir &dir, const GTime &time) const
Return time difference between photon arrival time at CGRO and the Solar System Barycentre (SSB) ...
Definition: GCOMBvcs.cpp:564
void read(const GFitsTable &table)
Read COMPTEL Solar System Barycentre Data FITS table.
Definition: GCOMBvcs.cpp:396
Filename class.
Definition: GFilename.hpp:62
GCOMBvcs * clone(void) const
Clone COMPTEL Solar System Barycentre Data container.
Definition: GCOMBvcs.cpp:189
const GCOMBvc * find(const GCOMOad &oad) const
Find Solar System Barycentre Data for Orbit Aspect Data.
Definition: GCOMBvcs.cpp:473
Abstract interface for FITS table.
Definition: GFitsTable.hpp:44
int size(void) const
Return number of Solar System Barycentre Data in container.
Definition: GCOMBvcs.hpp:148
GChatter
Definition: GTypemaps.hpp:33
void copy_members(const GCOMBvcs &bvcs)
Copy class members.
Definition: GCOMBvcs.cpp:787
std::string classname(void) const
Return class name.
Definition: GCOMBvcs.hpp:104
std::string print(const GChatter &chatter=NORMAL) const
Print COMPTEL Solar System Barycentre Data container.
Definition: GCOMBvcs.cpp:692
void reserve(const int &num)
Reserves space for Solar System Barycentre Data in container.
Definition: GCOMBvcs.hpp:177
GCOMBvc & append(const GCOMBvc &bvc)
Append Solar System Barycentre Data to container.
Definition: GCOMBvcs.cpp:252
void clear(void)
Clear COMPTEL Solar System Barycentre Data container.
Definition: GCOMBvcs.cpp:170
GCOMBvc & at(const int &index)
Return reference to Solar System Barycentre Data.
Definition: GCOMBvcs.cpp:206
Definition of interface for container classes.
COMPTEL Solar System Barycentre Data container class.
Definition: GCOMBvcs.hpp:54
void free_members(void)
Delete class members.
Definition: GCOMBvcs.cpp:800
Sky direction class.
Definition: GSkyDir.hpp:62
void load(const GFilename &filename)
Load COMPTEL Solar System Barycentre Data FITS file.
Definition: GCOMBvcs.cpp:370
std::vector< GCOMBvc > m_bvcs
Solar System Barycentre Data records.
Definition: GCOMBvcs.hpp:94
Interface class for container classes.
Definition: GContainer.hpp:52
GCOMBvc & operator[](const int &index)
Return reference to Solar System Barycentre Data.
Definition: GCOMBvcs.hpp:119