NCBI C++ ToolKit
Color_prop_.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id$
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  */
27 
28 /// @file Color_prop_.hpp
29 /// Data storage class.
30 ///
31 /// This file was generated by application DATATOOL
32 /// using the following specifications:
33 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/mmdb3/mmdb3.asn">mmdb3.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/mmdb3/mmdb3.def">mmdb3.def</a>
36 ///
37 /// ATTENTION:
38 /// Don't edit or commit this file into CVS as this file will
39 /// be overridden (by DATATOOL) without warning!
40 
41 #ifndef OBJECTS_MMDB3_COLOR_PROP_BASE_HPP
42 #define OBJECTS_MMDB3_COLOR_PROP_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
46 
47 // generated includes
48 #include <string>
49 
51 
52 #ifndef BEGIN_objects_SCOPE
53 # define BEGIN_objects_SCOPE BEGIN_SCOPE(objects)
54 # define END_objects_SCOPE END_SCOPE(objects)
55 #endif
56 BEGIN_objects_SCOPE // namespace ncbi::objects::
57 
58 
59 // generated classes
60 
61 
62 /** @addtogroup dataspec_MMDB_Features
63  *
64  * @{
65  */
66 
67 /////////////////////////////////////////////////////////////////////////////
68 ///
69 /// CColor_prop_Base --
70 ///
71 
73 {
75 public:
76  // constructor
77  CColor_prop_Base(void);
78  // destructor
79  virtual ~CColor_prop_Base(void);
80 
81  // type info
83 
84  // types
85  typedef int TR;
86  typedef int TG;
87  typedef int TB;
88  typedef string TName;
89 
90  // member index
91  enum class E_memberIndex {
92  e__allMandatory = 0,
93  e_r,
94  e_g,
95  e_b,
96  e_name
97  };
99 
100  // getters
101  // setters
102 
103  /// Check if a value has been assigned to R data member.
104  ///
105  /// Data member R is optional;
106  /// its type is defined as 'typedef int TR'
107  /// @return
108  /// - true, if a value has been assigned.
109  /// - false, otherwise.
110  bool IsSetR(void) const;
111 
112  /// Check if it is safe to call GetR method.
113  ///
114  /// @return
115  /// - true, if the data member is getatable.
116  /// - false, otherwise.
117  bool CanGetR(void) const;
118 
119  /// Reset R data member.
120  void ResetR(void);
121 
122  /// Get the R member data.
123  ///
124  /// @return
125  /// Copy of the member data.
126  TR GetR(void) const;
127 
128  /// Assign a value to R data member.
129  ///
130  /// @param value
131  /// Value to assign
132  void SetR(TR value);
133 
134  /// Assign a value to R data member.
135  ///
136  /// @return
137  /// Reference to the data value.
138  TR& SetR(void);
139 
140  /// Check if a value has been assigned to G data member.
141  ///
142  /// Data member G is optional;
143  /// its type is defined as 'typedef int TG'
144  /// @return
145  /// - true, if a value has been assigned.
146  /// - false, otherwise.
147  bool IsSetG(void) const;
148 
149  /// Check if it is safe to call GetG method.
150  ///
151  /// @return
152  /// - true, if the data member is getatable.
153  /// - false, otherwise.
154  bool CanGetG(void) const;
155 
156  /// Reset G data member.
157  void ResetG(void);
158 
159  /// Get the G member data.
160  ///
161  /// @return
162  /// Copy of the member data.
163  TG GetG(void) const;
164 
165  /// Assign a value to G data member.
166  ///
167  /// @param value
168  /// Value to assign
169  void SetG(TG value);
170 
171  /// Assign a value to G data member.
172  ///
173  /// @return
174  /// Reference to the data value.
175  TG& SetG(void);
176 
177  /// Check if a value has been assigned to B data member.
178  ///
179  /// Data member B is optional;
180  /// its type is defined as 'typedef int TB'
181  /// @return
182  /// - true, if a value has been assigned.
183  /// - false, otherwise.
184  bool IsSetB(void) const;
185 
186  /// Check if it is safe to call GetB method.
187  ///
188  /// @return
189  /// - true, if the data member is getatable.
190  /// - false, otherwise.
191  bool CanGetB(void) const;
192 
193  /// Reset B data member.
194  void ResetB(void);
195 
196  /// Get the B member data.
197  ///
198  /// @return
199  /// Copy of the member data.
200  TB GetB(void) const;
201 
202  /// Assign a value to B data member.
203  ///
204  /// @param value
205  /// Value to assign
206  void SetB(TB value);
207 
208  /// Assign a value to B data member.
209  ///
210  /// @return
211  /// Reference to the data value.
212  TB& SetB(void);
213 
214  /// Check if a value has been assigned to Name data member.
215  ///
216  /// Data member Name is optional;
217  /// its type is defined as 'typedef string TName'
218  /// @return
219  /// - true, if a value has been assigned.
220  /// - false, otherwise.
221  bool IsSetName(void) const;
222 
223  /// Check if it is safe to call GetName method.
224  ///
225  /// @return
226  /// - true, if the data member is getatable.
227  /// - false, otherwise.
228  bool CanGetName(void) const;
229 
230  /// Reset Name data member.
231  void ResetName(void);
232 
233  /// Get the Name member data.
234  ///
235  /// @return
236  /// Reference to the member data.
237  const TName& GetName(void) const;
238 
239  /// Assign a value to Name data member.
240  ///
241  /// @param value
242  /// Value to assign
243  void SetName(const TName& value);
244  void SetName(TName&& value);
245 
246  /// Assign a value to Name data member.
247  ///
248  /// @return
249  /// Reference to the data value.
250  TName& SetName(void);
251 
252  /// Reset the whole object
253  virtual void Reset(void);
254 
255 
256 private:
257  // Prohibit copy constructor and assignment operator
260 
261  // data
262  Uint4 m_set_State[1];
263  int m_R;
264  int m_G;
265  int m_B;
266  string m_Name;
267 };
268 
269 /* @} */
270 
271 
272 
273 
274 
275 ///////////////////////////////////////////////////////////
276 ///////////////////// inline methods //////////////////////
277 ///////////////////////////////////////////////////////////
278 inline
279 bool CColor_prop_Base::IsSetR(void) const
280 {
281  return ((m_set_State[0] & 0x3) != 0);
282 }
283 
284 inline
286 {
287  return IsSetR();
288 }
289 
290 inline
292 {
293  m_R = 0;
294  m_set_State[0] &= ~0x3;
295 }
296 
297 inline
299 {
300  if (!CanGetR()) {
301  ThrowUnassigned(0);
302  }
303  return m_R;
304 }
305 
306 inline
308 {
309  m_R = value;
310  m_set_State[0] |= 0x3;
311 }
312 
313 inline
315 {
316 #ifdef _DEBUG
317  if (!IsSetR()) {
318  memset(&m_R,UnassignedByte(),sizeof(m_R));
319  }
320 #endif
321  m_set_State[0] |= 0x1;
322  return m_R;
323 }
324 
325 inline
326 bool CColor_prop_Base::IsSetG(void) const
327 {
328  return ((m_set_State[0] & 0xc) != 0);
329 }
330 
331 inline
333 {
334  return IsSetG();
335 }
336 
337 inline
339 {
340  m_G = 0;
341  m_set_State[0] &= ~0xc;
342 }
343 
344 inline
346 {
347  if (!CanGetG()) {
348  ThrowUnassigned(1);
349  }
350  return m_G;
351 }
352 
353 inline
355 {
356  m_G = value;
357  m_set_State[0] |= 0xc;
358 }
359 
360 inline
362 {
363 #ifdef _DEBUG
364  if (!IsSetG()) {
365  memset(&m_G,UnassignedByte(),sizeof(m_G));
366  }
367 #endif
368  m_set_State[0] |= 0x4;
369  return m_G;
370 }
371 
372 inline
373 bool CColor_prop_Base::IsSetB(void) const
374 {
375  return ((m_set_State[0] & 0x30) != 0);
376 }
377 
378 inline
380 {
381  return IsSetB();
382 }
383 
384 inline
386 {
387  m_B = 0;
388  m_set_State[0] &= ~0x30;
389 }
390 
391 inline
393 {
394  if (!CanGetB()) {
395  ThrowUnassigned(2);
396  }
397  return m_B;
398 }
399 
400 inline
402 {
403  m_B = value;
404  m_set_State[0] |= 0x30;
405 }
406 
407 inline
409 {
410 #ifdef _DEBUG
411  if (!IsSetB()) {
412  memset(&m_B,UnassignedByte(),sizeof(m_B));
413  }
414 #endif
415  m_set_State[0] |= 0x10;
416  return m_B;
417 }
418 
419 inline
421 {
422  return ((m_set_State[0] & 0xc0) != 0);
423 }
424 
425 inline
427 {
428  return IsSetName();
429 }
430 
431 inline
433 {
434  if (!CanGetName()) {
435  ThrowUnassigned(3);
436  }
437  return m_Name;
438 }
439 
440 inline
442 {
443  m_Name = value;
444  m_set_State[0] |= 0xc0;
445 }
446 
447 inline
449 {
450  m_Name = std::forward<CColor_prop_Base::TName>(value);
451  m_set_State[0] |= 0xc0;
452 }
453 
454 inline
456 {
457 #ifdef _DEBUG
458  if (!IsSetName()) {
460  }
461 #endif
462  m_set_State[0] |= 0x40;
463  return m_Name;
464 }
465 
466 ///////////////////////////////////////////////////////////
467 ////////////////// end of inline methods //////////////////
468 ///////////////////////////////////////////////////////////
469 
470 
471 
472 
473 
474 END_objects_SCOPE // namespace ncbi::objects::
475 
477 
478 
479 #endif // OBJECTS_MMDB3_COLOR_PROP_BASE_HPP
CColor_prop_Base –.
Definition: Color_prop_.hpp:73
Base class for all serializable objects.
Definition: serialbase.hpp:150
char value[7]
Definition: config.c:431
static char UnassignedByte(void)
Definition: serialbase.hpp:181
void ThrowUnassigned(TMemberIndex index) const
static string UnassignedString(void)
Definition: serialbase.hpp:175
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define NCBI_MMDB3_EXPORT
Definition: ncbi_export.h:640
Tparent::CMemberIndex< E_memberIndex, 5 > TmemberIndex
Definition: Color_prop_.hpp:98
TB & SetB(void)
Assign a value to B data member.
void ResetR(void)
Reset R data member.
const TName & GetName(void) const
Get the Name member data.
bool IsSetB(void) const
Check if a value has been assigned to B data member.
bool IsSetName(void) const
Check if a value has been assigned to Name data member.
bool IsSetG(void) const
Check if a value has been assigned to G data member.
bool CanGetB(void) const
Check if it is safe to call GetB method.
TB GetB(void) const
Get the B member data.
TR & SetR(void)
Assign a value to R data member.
CColor_prop_Base & operator=(const CColor_prop_Base &)
TR GetR(void) const
Get the R member data.
TName & SetName(void)
Assign a value to Name data member.
bool CanGetR(void) const
Check if it is safe to call GetR method.
CSerialObject Tparent
Definition: Color_prop_.hpp:74
bool IsSetR(void) const
Check if a value has been assigned to R data member.
CColor_prop_Base(const CColor_prop_Base &)
void ResetB(void)
Reset B data member.
Uint4 m_set_State[1]
TG GetG(void) const
Get the G member data.
bool CanGetName(void) const
Check if it is safe to call GetName method.
bool CanGetG(void) const
Check if it is safe to call GetG method.
void ResetG(void)
Reset G data member.
TG & SetG(void)
Assign a value to G data member.
Modified on Sat Dec 02 09:21:28 2023 by modify_doxy.py rev. 669887