GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GSPIInstDir.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GSPIInstDir.hpp - INTEGRAL/SPI instrument direction class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2020 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 GSPIInstDir.hpp
23  * @brief INTEGRAL/SPI instrument direction class definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GSPIINSTDIR_HPP
28 #define GSPIINSTDIR_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include <sys/types.h>
33 #if defined(__sun) && (defined(__svr4__) || defined(__SVR4)) // SOLARIS
34  typedef uint64_t u_int64_t;
35 #endif // SOLARIS
36 #include "GInstDir.hpp"
37 #include "GSkyDir.hpp"
38 
39 /* __ Forward declarations _______________________________________________ */
40 
41 /* __ Constants __________________________________________________________ */
42 
43 
44 /***********************************************************************//**
45  * @class GSPIInstDir
46  *
47  * @brief INTEGRAL/SPI instrument direction class
48  *
49  * The INTEGRAL/SPI instrument direction defines the spatial information
50  * associated to an event.
51  ***************************************************************************/
52 class GSPIInstDir : public GInstDir {
53 
54 public:
55  // Constructors and destructors
56  GSPIInstDir(void);
57  GSPIInstDir(const GSkyDir& dir, const int& detid);
58  GSPIInstDir(const GSPIInstDir& dir);
59  virtual ~GSPIInstDir(void);
60 
61  // Operators
62  GSPIInstDir& operator=(const GSPIInstDir& dir);
63 
64  // Implemented pure virtual base class methods
65  virtual void clear(void);
66  virtual GSPIInstDir* clone(void) const;
67  virtual std::string classname(void) const;
68  virtual u_int64_t hash(void) const;
69  virtual std::string print(const GChatter& chatter = NORMAL) const;
70 
71  // Other methods
72  void dir(const GSkyDir& dir);
73  const GSkyDir& dir(void) const;
74  void detid(const int& detid);
75  const int& detid(void) const;
76 
77 protected:
78  // Protected methods
79  void init_members(void);
80  void copy_members(const GSPIInstDir& dir);
81  void free_members(void);
82 
83  // Protected members
85  int m_detid;
86 };
87 
88 
89 /***********************************************************************//**
90  * @brief Return class name
91  *
92  * @return String containing the class name ("GSPIInstDir").
93  ***************************************************************************/
94 inline
95 std::string GSPIInstDir::classname(void) const
96 {
97  return ("GSPIInstDir");
98 }
99 
100 
101 /***********************************************************************//**
102  * @brief Set pointing direction
103  *
104  * @param[in] dir Pointing direction.
105  *
106  * Set the pointing direction.
107  ***************************************************************************/
108 inline
109 void GSPIInstDir::dir(const GSkyDir& dir)
110 {
111  m_dir = dir;
112  return;
113 }
114 
115 
116 /***********************************************************************//**
117  * @brief Return pointing direction
118  *
119  * @return Pointing direction.
120  *
121  * Returns the pointing direction.
122  ***************************************************************************/
123 inline
124 const GSkyDir& GSPIInstDir::dir(void) const
125 {
126  return (m_dir);
127 }
128 
129 
130 /***********************************************************************//**
131  * @brief Set detector identifier
132  *
133  * @param[in] detid Detector identifier.
134  *
135  * Set the detector identifier.
136  ***************************************************************************/
137 inline
138 void GSPIInstDir::detid(const int& detid)
139 {
140  m_detid = detid;
141  return;
142 }
143 
144 
145 /***********************************************************************//**
146  * @brief Return detector identifier
147  *
148  * @return Detector identifier.
149  *
150  * Returns the detector identifier.
151  ***************************************************************************/
152 inline
153 const int& GSPIInstDir::detid(void) const
154 {
155  return (m_detid);
156 }
157 
158 #endif /* GSPIINSTDIR_HPP */
Abstract instrument direction base class definition.
const int & detid(void) const
Return detector identifier.
Sky direction class interface definition.
virtual void clear(void)
Clear INTEGRAL/SPI instrument direction.
const GSkyDir & dir(void) const
Return pointing direction.
INTEGRAL/SPI instrument direction class.
Definition: GSPIInstDir.hpp:52
Abstract instrument direction base class.
Definition: GInstDir.hpp:51
virtual std::string print(const GChatter &chatter=NORMAL) const
Print INTEGRAL/SPI instrument direction information.
GSkyDir m_dir
Definition: GSPIInstDir.hpp:84
virtual std::string classname(void) const
Return class name.
Definition: GSPIInstDir.hpp:95
void free_members(void)
Delete class members.
void copy_members(const GSPIInstDir &dir)
Copy class members.
GChatter
Definition: GTypemaps.hpp:33
virtual GSPIInstDir * clone(void) const
Clone INTEGRAL/SPI instrument direction.
GSPIInstDir & operator=(const GSPIInstDir &dir)
Assignment operator.
virtual ~GSPIInstDir(void)
Destructor.
void init_members(void)
Initialise class members.
GSPIInstDir(void)
Void constructor.
Definition: GSPIInstDir.cpp:56
Sky direction class.
Definition: GSkyDir.hpp:62
virtual u_int64_t hash(void) const
Return instrument direction hash value.