General Purpose Geodetic Library
SgAttribute.h
Go to the documentation of this file.
1 /*
2  *
3  * This file is a part of Space Geodetic Library. The library is used by
4  * nuSolve, a part of CALC/SOLVE system, and designed to make analysis of
5  * geodetic VLBI observations.
6  * Copyright (C) 2010-2020 Sergei Bolotin.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #ifndef SG_ATTRIBUTE_H
24 #define SG_ATTRIBUTE_H
25 
26 
27 #ifdef HAVE_CONFIG_H
28 # include <config.h>
29 #endif
30 
31 
32 #include <QtCore/QString>
33 
34 
35 
36 
37 /***===================================================================================================*/
44 {
45 public:
46  //
47  // constructors/destructors:
48  //
52  inline SgAttribute();
53 
58  inline SgAttribute(const SgAttribute& a);
59 
63  inline ~SgAttribute();
64 
65 
66 
67  //
68  // Interfaces:
69  //
72  inline SgAttribute& operator=(const SgAttribute& a);
73 
76  inline unsigned int getAttributes() const;
77 
80  inline void setAttributes(unsigned int a);
81 
82 
83  //
84  // Functions:
85  //
88  static const QString className();
89 
92  inline void addAttr(uint a);
93 
96  inline void delAttr(uint a);
97 
100  inline void assignAttr(uint a, bool b) {if (b) addAttr(a); else delAttr(a);};
101 
104  inline void xorAttr(uint a);
105 
108  inline bool isAttr(uint a) const;
109 
112  inline void clearAll();
113 
114 
115  //
116  // Friends:
117  //
118 
119  //
120  // I/O:
121  //
122  // ...
123 
124 private:
125  unsigned int attributes_;
126 };
127 /*=====================================================================================================*/
128 
129 
130 
131 
132 
133 
134 
135 
136 /*=====================================================================================================*/
137 /* */
138 /* SgAttribute inline members: */
139 /* */
140 /*=====================================================================================================*/
141 //
142 //
143 // CONSTRUCTORS:
144 //
145 // An empty constructor:
147 {
148  attributes_ = 0;
149 };
150 
151 
152 
153 // A regular constructor:
155 {
157 };
158 
159 
160 
161 
162 // A destructor:
164 {
165  // nothing to do
166 };
167 
168 
169 
170 //
171 // INTERFACES:
172 //
173 //
175 {
177  return *this;
178 };
179 
180 
181 
182 //
183 inline unsigned int SgAttribute::getAttributes() const
184 {
185  return attributes_;
186 };
187 
188 
189 
190 //
191 inline void SgAttribute::setAttributes(unsigned int a)
192 {
193  attributes_ = a;
194 };
195 
196 
197 //
198 // FUNCTIONS:
199 //
200 //
201 //
202 inline void SgAttribute::addAttr(uint a)
203 {
204  attributes_ |= a;
205 };
206 
207 
208 
209 //
210 inline void SgAttribute::delAttr(uint a)
211 {
212  attributes_ &= ~a;
213 };
214 
215 
216 
217 //
218 inline void SgAttribute::xorAttr(uint a)
219 {
220  attributes_ ^= a;
221 };
222 
223 
224 
225 //
226 inline bool SgAttribute::isAttr(uint a) const
227 {
228  return attributes_ & a;
229 };
230 
231 
232 
233 //
234 inline void SgAttribute::clearAll()
235 {
236  attributes_ = 0;
237 };
238 
239 
240 
241 //
242 // FRIENDS:
243 //
244 //
245 //
246 
247 
248 /*=====================================================================================================*/
249 
250 
251 
252 
253 
254 /*=====================================================================================================*/
255 //
256 // aux functions:
257 //
258 
259 
260 /*=====================================================================================================*/
261 #endif //SG_ATTRIBUTE_H
bool isAttr(uint a) const
Definition: SgAttribute.h:226
void xorAttr(uint a)
Definition: SgAttribute.h:218
static const QString className()
Definition: SgAttribute.cpp:36
void assignAttr(uint a, bool b)
Definition: SgAttribute.h:100
void setAttributes(unsigned int a)
Definition: SgAttribute.h:191
SgAttribute & operator=(const SgAttribute &a)
Definition: SgAttribute.h:174
void clearAll()
Definition: SgAttribute.h:234
unsigned int getAttributes() const
Definition: SgAttribute.h:183
void delAttr(uint a)
Definition: SgAttribute.h:210
unsigned int attributes_
storage for 32 different attributes (is it enough?)
Definition: SgAttribute.h:125
void addAttr(uint a)
Definition: SgAttribute.h:202