NCBI C++ ToolKit
Author_.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 Author_.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/biblio/biblio.asn">biblio.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/biblio/biblio.def">biblio.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_BIBLIO_AUTHOR_BASE_HPP
42 #define OBJECTS_BIBLIO_AUTHOR_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
47 
48 #ifndef BEGIN_objects_SCOPE
49 # define BEGIN_objects_SCOPE BEGIN_SCOPE(objects)
50 # define END_objects_SCOPE END_SCOPE(objects)
51 #endif
52 BEGIN_objects_SCOPE // namespace ncbi::objects::
53 
54 
55 // forward declarations
56 class CAffil;
57 class CPerson_id;
58 
59 
60 // generated classes
61 
62 
63 /** @addtogroup dataspec_NCBI_Biblio
64  *
65  * @{
66  */
67 
68 /////////////////////////////////////////////////////////////////////////////
69 ///
70 /// CAuthor_Base --
71 ///
72 
74 {
76 public:
77  // constructor
78  CAuthor_Base(void);
79  // destructor
80  virtual ~CAuthor_Base(void);
81 
82  // type info
84 
85  enum ELevel {
86  eLevel_primary = 1,
87  eLevel_secondary = 2
88  };
89 
90  /// Access to ELevel's attributes (values, names) as defined in spec
91  static const NCBI_NS_NCBI::CEnumeratedTypeValues* ENUM_METHOD_NAME(ELevel)(void);
92 
93  /// Author Role Indicator
94  enum ERole {
95  eRole_compiler = 1,
96  eRole_editor = 2,
97  eRole_patent_assignee = 3,
98  eRole_translator = 4
99  };
100 
101  /// Access to ERole's attributes (values, names) as defined in spec
102  static const NCBI_NS_NCBI::CEnumeratedTypeValues* ENUM_METHOD_NAME(ERole)(void);
103 
104  // types
105  typedef CPerson_id TName;
106  typedef ELevel TLevel;
107  typedef ERole TRole;
108  typedef CAffil TAffil;
109  typedef bool TIs_corr;
110 
111  // member index
112  enum class E_memberIndex {
113  e__allMandatory = 0,
114  e_name,
115  e_level,
116  e_role,
117  e_affil,
118  e_is_corr
119  };
121 
122  // getters
123  // setters
124 
125  /// Author, Primary or Secondary
126  /// Check if a value has been assigned to Name data member.
127  ///
128  /// Data member Name is mandatory;
129  /// its type is defined as 'typedef CPerson_id TName'
130  /// @return
131  /// - true, if a value has been assigned.
132  /// - false, otherwise.
133  bool IsSetName(void) const;
134 
135  /// Check if it is safe to call GetName method.
136  ///
137  /// @return
138  /// - true, if the data member is getatable.
139  /// - false, otherwise.
140  bool CanGetName(void) const;
141 
142  /// Reset Name data member.
143  void ResetName(void);
144 
145  /// Get the Name member data.
146  ///
147  /// @return
148  /// Reference to the member data.
149  const TName& GetName(void) const;
150 
151  /// Assign a value to Name data member.
152  ///
153  /// @param value
154  /// Reference to value.
155  void SetName(TName& value);
156 
157  /// Assign a value to Name data member.
158  ///
159  /// @return
160  /// Reference to the data value.
161  TName& SetName(void);
162 
163  /// Check if a value has been assigned to Level data member.
164  ///
165  /// Data member Level is optional;
166  /// its type is defined as 'typedef ELevel TLevel'
167  /// @return
168  /// - true, if a value has been assigned.
169  /// - false, otherwise.
170  bool IsSetLevel(void) const;
171 
172  /// Check if it is safe to call GetLevel method.
173  ///
174  /// @return
175  /// - true, if the data member is getatable.
176  /// - false, otherwise.
177  bool CanGetLevel(void) const;
178 
179  /// Reset Level data member.
180  void ResetLevel(void);
181 
182  /// Get the Level member data.
183  ///
184  /// @return
185  /// Copy of the member data.
186  TLevel GetLevel(void) const;
187 
188  /// Assign a value to Level data member.
189  ///
190  /// @param value
191  /// Value to assign
192  void SetLevel(TLevel value);
193 
194  /// Assign a value to Level data member.
195  ///
196  /// @return
197  /// Reference to the data value.
198  TLevel& SetLevel(void);
199 
200  /// Check if a value has been assigned to Role data member.
201  ///
202  /// Data member Role is optional;
203  /// its type is defined as 'typedef ERole TRole'
204  /// @return
205  /// - true, if a value has been assigned.
206  /// - false, otherwise.
207  bool IsSetRole(void) const;
208 
209  /// Check if it is safe to call GetRole method.
210  ///
211  /// @return
212  /// - true, if the data member is getatable.
213  /// - false, otherwise.
214  bool CanGetRole(void) const;
215 
216  /// Reset Role data member.
217  void ResetRole(void);
218 
219  /// Get the Role member data.
220  ///
221  /// @return
222  /// Copy of the member data.
223  TRole GetRole(void) const;
224 
225  /// Assign a value to Role data member.
226  ///
227  /// @param value
228  /// Value to assign
229  void SetRole(TRole value);
230 
231  /// Assign a value to Role data member.
232  ///
233  /// @return
234  /// Reference to the data value.
235  TRole& SetRole(void);
236 
237  /// Check if a value has been assigned to Affil data member.
238  ///
239  /// Data member Affil is optional;
240  /// its type is defined as 'typedef CAffil TAffil'
241  /// @return
242  /// - true, if a value has been assigned.
243  /// - false, otherwise.
244  bool IsSetAffil(void) const;
245 
246  /// Check if it is safe to call GetAffil method.
247  ///
248  /// @return
249  /// - true, if the data member is getatable.
250  /// - false, otherwise.
251  bool CanGetAffil(void) const;
252 
253  /// Reset Affil data member.
254  void ResetAffil(void);
255 
256  /// Get the Affil member data.
257  ///
258  /// @return
259  /// Reference to the member data.
260  const TAffil& GetAffil(void) const;
261 
262  /// Assign a value to Affil data member.
263  ///
264  /// @param value
265  /// Reference to value.
266  void SetAffil(TAffil& value);
267 
268  /// Assign a value to Affil data member.
269  ///
270  /// @return
271  /// Reference to the data value.
272  TAffil& SetAffil(void);
273 
274  /// TRUE if corresponding author
275  /// Check if a value has been assigned to Is_corr data member.
276  ///
277  /// Data member Is_corr is optional;
278  /// its type is defined as 'typedef bool TIs_corr'
279  /// @return
280  /// - true, if a value has been assigned.
281  /// - false, otherwise.
282  bool IsSetIs_corr(void) const;
283 
284  /// Check if it is safe to call GetIs_corr method.
285  ///
286  /// @return
287  /// - true, if the data member is getatable.
288  /// - false, otherwise.
289  bool CanGetIs_corr(void) const;
290 
291  /// Reset Is_corr data member.
292  void ResetIs_corr(void);
293 
294  /// Get the Is_corr member data.
295  ///
296  /// @return
297  /// Copy of the member data.
298  TIs_corr GetIs_corr(void) const;
299 
300  /// Assign a value to Is_corr data member.
301  ///
302  /// @param value
303  /// Value to assign
304  void SetIs_corr(TIs_corr value);
305 
306  /// Assign a value to Is_corr data member.
307  ///
308  /// @return
309  /// Reference to the data value.
310  TIs_corr& SetIs_corr(void);
311 
312  /// Reset the whole object
313  virtual void Reset(void);
314 
315 
316 private:
317  // Prohibit copy constructor and assignment operator
320 
321  // data
322  Uint4 m_set_State[1];
327  bool m_Is_corr;
328 };
329 
330 /* @} */
331 
332 
333 
334 
335 
336 ///////////////////////////////////////////////////////////
337 ///////////////////// inline methods //////////////////////
338 ///////////////////////////////////////////////////////////
339 inline
340 bool CAuthor_Base::IsSetName(void) const
341 {
342  return m_Name.NotEmpty();
343 }
344 
345 inline
346 bool CAuthor_Base::CanGetName(void) const
347 {
348  return true;
349 }
350 
351 inline
353 {
354  if ( !m_Name ) {
355  const_cast<CAuthor_Base*>(this)->ResetName();
356  }
357  return (*m_Name);
358 }
359 
360 inline
362 {
363  if ( !m_Name ) {
364  ResetName();
365  }
366  return (*m_Name);
367 }
368 
369 inline
370 bool CAuthor_Base::IsSetLevel(void) const
371 {
372  return ((m_set_State[0] & 0xc) != 0);
373 }
374 
375 inline
377 {
378  return IsSetLevel();
379 }
380 
381 inline
383 {
384  m_Level = (ELevel)(0);
385  m_set_State[0] &= ~0xc;
386 }
387 
388 inline
390 {
391  if (!CanGetLevel()) {
392  ThrowUnassigned(1);
393  }
394  return m_Level;
395 }
396 
397 inline
399 {
400  m_Level = value;
401  m_set_State[0] |= 0xc;
402 }
403 
404 inline
406 {
407 #ifdef _DEBUG
408  if (!IsSetLevel()) {
409  memset(&m_Level,UnassignedByte(),sizeof(m_Level));
410  }
411 #endif
412  m_set_State[0] |= 0x4;
413  return m_Level;
414 }
415 
416 inline
417 bool CAuthor_Base::IsSetRole(void) const
418 {
419  return ((m_set_State[0] & 0x30) != 0);
420 }
421 
422 inline
423 bool CAuthor_Base::CanGetRole(void) const
424 {
425  return IsSetRole();
426 }
427 
428 inline
430 {
431  m_Role = (ERole)(0);
432  m_set_State[0] &= ~0x30;
433 }
434 
435 inline
437 {
438  if (!CanGetRole()) {
439  ThrowUnassigned(2);
440  }
441  return m_Role;
442 }
443 
444 inline
446 {
447  m_Role = value;
448  m_set_State[0] |= 0x30;
449 }
450 
451 inline
453 {
454 #ifdef _DEBUG
455  if (!IsSetRole()) {
456  memset(&m_Role,UnassignedByte(),sizeof(m_Role));
457  }
458 #endif
459  m_set_State[0] |= 0x10;
460  return m_Role;
461 }
462 
463 inline
464 bool CAuthor_Base::IsSetAffil(void) const
465 {
466  return m_Affil.NotEmpty();
467 }
468 
469 inline
471 {
472  return IsSetAffil();
473 }
474 
475 inline
477 {
478  if (!CanGetAffil()) {
479  ThrowUnassigned(3);
480  }
481  return (*m_Affil);
482 }
483 
484 inline
486 {
487  return ((m_set_State[0] & 0x300) != 0);
488 }
489 
490 inline
492 {
493  return IsSetIs_corr();
494 }
495 
496 inline
498 {
499  m_Is_corr = 0;
500  m_set_State[0] &= ~0x300;
501 }
502 
503 inline
505 {
506  if (!CanGetIs_corr()) {
507  ThrowUnassigned(4);
508  }
509  return m_Is_corr;
510 }
511 
512 inline
514 {
515  m_Is_corr = value;
516  m_set_State[0] |= 0x300;
517 }
518 
519 inline
521 {
522 #ifdef _DEBUG
523  if (!IsSetIs_corr()) {
524  memset(&m_Is_corr,UnassignedByte(),sizeof(m_Is_corr));
525  }
526 #endif
527  m_set_State[0] |= 0x100;
528  return m_Is_corr;
529 }
530 
531 ///////////////////////////////////////////////////////////
532 ////////////////// end of inline methods //////////////////
533 ///////////////////////////////////////////////////////////
534 
535 
536 
537 
538 
539 END_objects_SCOPE // namespace ncbi::objects::
540 
542 
543 
544 #endif // OBJECTS_BIBLIO_AUTHOR_BASE_HPP
@Affil.hpp User-defined methods of the data storage class.
Definition: Affil.hpp:56
CAuthor_Base –.
Definition: Author_.hpp:74
CRef –.
Definition: ncbiobj.hpp:618
Base class for all serializable objects.
Definition: serialbase.hpp:150
static char UnassignedByte(void)
Definition: serialbase.hpp:181
void ThrowUnassigned(TMemberIndex index) const
#define ENUM_METHOD_NAME(EnumName)
Definition: serialbase.hpp:994
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_BIBLIO_EXPORT
Definition: ncbi_export.h:312
DECLARE_INTERNAL_TYPE_INFO()
TLevel & SetLevel(void)
Assign a value to Level data member.
Definition: Author_.hpp:405
bool m_Is_corr
Definition: Author_.hpp:327
TName & SetName(void)
Assign a value to Name data member.
Definition: Author_.hpp:361
bool CanGetName(void) const
Check if it is safe to call GetName method.
Definition: Author_.hpp:346
bool IsSetIs_corr(void) const
TRUE if corresponding author Check if a value has been assigned to Is_corr data member.
Definition: Author_.hpp:485
const TAffil & GetAffil(void) const
Get the Affil member data.
Definition: Author_.hpp:476
bool TIs_corr
Definition: Author_.hpp:109
bool CanGetAffil(void) const
Check if it is safe to call GetAffil method.
Definition: Author_.hpp:470
TIs_corr GetIs_corr(void) const
Get the Is_corr member data.
Definition: Author_.hpp:504
void ResetRole(void)
Reset Role data member.
Definition: Author_.hpp:429
TIs_corr & SetIs_corr(void)
Assign a value to Is_corr data member.
Definition: Author_.hpp:520
bool CanGetRole(void) const
Check if it is safe to call GetRole method.
Definition: Author_.hpp:423
bool IsSetAffil(void) const
Check if a value has been assigned to Affil data member.
Definition: Author_.hpp:464
TRole & SetRole(void)
Assign a value to Role data member.
Definition: Author_.hpp:452
void ResetName(void)
Reset Name data member.
Definition: Author_.cpp:72
Uint4 m_set_State[1]
Definition: Author_.hpp:322
ELevel m_Level
Definition: Author_.hpp:324
const TName & GetName(void) const
Get the Name member data.
Definition: Author_.hpp:352
CRef< TName > m_Name
Definition: Author_.hpp:323
bool CanGetIs_corr(void) const
Check if it is safe to call GetIs_corr method.
Definition: Author_.hpp:491
CRef< TAffil > m_Affil
Definition: Author_.hpp:326
bool CanGetLevel(void) const
Check if it is safe to call GetLevel method.
Definition: Author_.hpp:376
CAffil TAffil
Definition: Author_.hpp:108
ERole m_Role
Definition: Author_.hpp:325
CPerson_id TName
Definition: Author_.hpp:105
void ResetLevel(void)
Reset Level data member.
Definition: Author_.hpp:382
bool IsSetRole(void) const
Check if a value has been assigned to Role data member.
Definition: Author_.hpp:417
TLevel GetLevel(void) const
Get the Level member data.
Definition: Author_.hpp:389
bool IsSetName(void) const
Author, Primary or Secondary Check if a value has been assigned to Name data member.
Definition: Author_.hpp:340
void ResetIs_corr(void)
Reset Is_corr data member.
Definition: Author_.hpp:497
CSerialObject Tparent
Definition: Author_.hpp:75
TRole GetRole(void) const
Get the Role member data.
Definition: Author_.hpp:436
CAuthor_Base(const CAuthor_Base &)
ERole
Author Role Indicator.
Definition: Author_.hpp:94
CAuthor_Base & operator=(const CAuthor_Base &)
ERole TRole
Definition: Author_.hpp:107
Tparent::CMemberIndex< E_memberIndex, 6 > TmemberIndex
Definition: Author_.hpp:120
ELevel TLevel
Definition: Author_.hpp:106
bool IsSetLevel(void) const
Check if a value has been assigned to Level data member.
Definition: Author_.hpp:370
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Wed Jun 12 11:12:02 2024 by modify_doxy.py rev. 669887