GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GSkyRegion.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GSkyRegion.cpp - Abstract virtual sky region base class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2013-2020 by Pierrick Martin *
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 GSkyRegion.cpp
23  * @brief Abstract sky region base class interface definition
24  * @author Pierrick Martin
25  */
26 
27 /* __ Includes ___________________________________________________________ */
28 #ifdef HAVE_CONFIG_H
29 #include <config.h>
30 #endif
31 #include <vector>
32 #include <string>
33 #include "GSkyRegion.hpp"
34 
35 /* __ Method name definitions ____________________________________________ */
36 
37 /* __ Macros _____________________________________________________________ */
38 
39 /* __ Coding definitions _________________________________________________ */
40 
41 /* __ Debug definitions __________________________________________________ */
42 
43 
44 /*==========================================================================
45  = =
46  = Constructors/destructors =
47  = =
48  ==========================================================================*/
49 
50 /***********************************************************************//**
51  * @brief Void constructor
52  ***************************************************************************/
54 {
55  // Initialise members
56  init_members();
57 
58  // Return
59  return;
60 }
61 
62 
63 /***********************************************************************//**
64  * @brief Copy constructor
65  *
66  * @param[in] region sky region.
67  ***************************************************************************/
69 {
70  // Initialise members
71  init_members();
72 
73  // Copy members
74  copy_members(region);
75 
76  // Return
77  return;
78 }
79 
80 
81 /***********************************************************************//**
82  * @brief Destructor
83  ***************************************************************************/
85 {
86  // Free members
87  free_members();
88 
89  // Return
90  return;
91 }
92 
93 
94 /*==========================================================================
95  = =
96  = Operators =
97  = =
98  ==========================================================================*/
99 
100 /***********************************************************************//**
101  * @brief Assignment operator
102  *
103  * @param[in] region sky region.
104  * @return sky region.
105  ***************************************************************************/
107 {
108  // Execute only if object is not identical
109  if (this != &region) {
110 
111  // Free members
112  free_members();
113 
114  // Initialise private members for clean destruction
115  init_members();
116 
117  // Copy members
118  copy_members(region);
119 
120  } // endif: object was not identical
121 
122  // Return
123  return *this;
124 }
125 
126 
127 /*==========================================================================
128  = =
129  = Private methods =
130  = =
131  ==========================================================================*/
132 
133 /***********************************************************************//**
134  * @brief Initialise class members
135  ***************************************************************************/
137 {
138  // Initialise members
139  m_type.clear();
140  m_name.clear();
141  m_solid = 0.0;
142 
143  // Return
144  return;
145 }
146 
147 
148 /***********************************************************************//**
149  * @brief Copy class members
150  *
151  * @param[in] region sky region.
152  ***************************************************************************/
154 {
155  // Copy members
156  m_type = region.m_type;
157  m_name = region.m_name;
158  m_solid = region.m_solid;
159 
160  // Return
161  return;
162 }
163 
164 
165 /***********************************************************************//**
166  * @brief Delete class members
167  ***************************************************************************/
169 {
170  // Return
171  return;
172 }
double m_solid
Solid angle subtended by the region (sr)
Definition: GSkyRegion.hpp:96
void copy_members(const GSkyRegion &region)
Copy class members.
Definition: GSkyRegion.cpp:153
virtual ~GSkyRegion(void)
Destructor.
Definition: GSkyRegion.cpp:84
void free_members(void)
Delete class members.
Definition: GSkyRegion.cpp:168
void init_members(void)
Initialise class members.
Definition: GSkyRegion.cpp:136
std::string m_type
Type of the region (circle, rectangle,...)
Definition: GSkyRegion.hpp:94
Abstract interface for the sky region class.
Definition: GSkyRegion.hpp:57
std::string m_name
Name of the region.
Definition: GSkyRegion.hpp:95
virtual GSkyRegion & operator=(const GSkyRegion &region)
Assignment operator.
Definition: GSkyRegion.cpp:106
GSkyRegion(void)
Void constructor.
Definition: GSkyRegion.cpp:53
Abstract sky region base class interface definition.