NCBI C++ ToolKit
Name_std_.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 Name_std_.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/general/general.asn">general.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/general/general.def">general.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_GENERAL_NAME_STD_BASE_HPP
42 #define OBJECTS_GENERAL_NAME_STD_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_NCBI_General
63  *
64  * @{
65  */
66 
67 /////////////////////////////////////////////////////////////////////////////
68 /// Structured names
69 ///
70 /// CName_std_Base --
71 ///
72 
74 {
76 public:
77  // constructor
78  CName_std_Base(void);
79  // destructor
80  virtual ~CName_std_Base(void);
81 
82  // type info
84 
85  // types
86  typedef string TLast;
87  typedef string TFirst;
88  typedef string TMiddle;
89  typedef string TFull;
90  typedef string TInitials;
91  typedef string TSuffix;
92  typedef string TTitle;
93 
94  // member index
95  enum class E_memberIndex {
96  e__allMandatory = 0,
97  e_last,
98  e_first,
99  e_middle,
100  e_full,
101  e_initials,
102  e_suffix,
103  e_title
104  };
106 
107  // getters
108  // setters
109 
110  /// Check if a value has been assigned to Last data member.
111  ///
112  /// Data member Last is mandatory;
113  /// its type is defined as 'typedef string TLast'
114  /// @return
115  /// - true, if a value has been assigned.
116  /// - false, otherwise.
117  bool IsSetLast(void) const;
118 
119  /// Check if it is safe to call GetLast method.
120  ///
121  /// @return
122  /// - true, if the data member is getatable.
123  /// - false, otherwise.
124  bool CanGetLast(void) const;
125 
126  /// Reset Last data member.
127  void ResetLast(void);
128 
129  /// Get the Last member data.
130  ///
131  /// @return
132  /// Reference to the member data.
133  const TLast& GetLast(void) const;
134 
135  /// Assign a value to Last data member.
136  ///
137  /// @param value
138  /// Value to assign
139  void SetLast(const TLast& value);
140  void SetLast(TLast&& value);
141 
142  /// Assign a value to Last data member.
143  ///
144  /// @return
145  /// Reference to the data value.
146  TLast& SetLast(void);
147 
148  /// Check if a value has been assigned to First data member.
149  ///
150  /// Data member First is optional;
151  /// its type is defined as 'typedef string TFirst'
152  /// @return
153  /// - true, if a value has been assigned.
154  /// - false, otherwise.
155  bool IsSetFirst(void) const;
156 
157  /// Check if it is safe to call GetFirst method.
158  ///
159  /// @return
160  /// - true, if the data member is getatable.
161  /// - false, otherwise.
162  bool CanGetFirst(void) const;
163 
164  /// Reset First data member.
165  void ResetFirst(void);
166 
167  /// Get the First member data.
168  ///
169  /// @return
170  /// Reference to the member data.
171  const TFirst& GetFirst(void) const;
172 
173  /// Assign a value to First data member.
174  ///
175  /// @param value
176  /// Value to assign
177  void SetFirst(const TFirst& value);
178  void SetFirst(TFirst&& value);
179 
180  /// Assign a value to First data member.
181  ///
182  /// @return
183  /// Reference to the data value.
184  TFirst& SetFirst(void);
185 
186  /// Check if a value has been assigned to Middle data member.
187  ///
188  /// Data member Middle is optional;
189  /// its type is defined as 'typedef string TMiddle'
190  /// @return
191  /// - true, if a value has been assigned.
192  /// - false, otherwise.
193  bool IsSetMiddle(void) const;
194 
195  /// Check if it is safe to call GetMiddle method.
196  ///
197  /// @return
198  /// - true, if the data member is getatable.
199  /// - false, otherwise.
200  bool CanGetMiddle(void) const;
201 
202  /// Reset Middle data member.
203  void ResetMiddle(void);
204 
205  /// Get the Middle member data.
206  ///
207  /// @return
208  /// Reference to the member data.
209  const TMiddle& GetMiddle(void) const;
210 
211  /// Assign a value to Middle data member.
212  ///
213  /// @param value
214  /// Value to assign
215  void SetMiddle(const TMiddle& value);
216  void SetMiddle(TMiddle&& value);
217 
218  /// Assign a value to Middle data member.
219  ///
220  /// @return
221  /// Reference to the data value.
222  TMiddle& SetMiddle(void);
223 
224  /// full name eg. "J. John Smith, Esq"
225  /// Check if a value has been assigned to Full data member.
226  ///
227  /// Data member Full is optional;
228  /// its type is defined as 'typedef string TFull'
229  /// @return
230  /// - true, if a value has been assigned.
231  /// - false, otherwise.
232  bool IsSetFull(void) const;
233 
234  /// Check if it is safe to call GetFull method.
235  ///
236  /// @return
237  /// - true, if the data member is getatable.
238  /// - false, otherwise.
239  bool CanGetFull(void) const;
240 
241  /// Reset Full data member.
242  void ResetFull(void);
243 
244  /// Get the Full member data.
245  ///
246  /// @return
247  /// Reference to the member data.
248  const TFull& GetFull(void) const;
249 
250  /// Assign a value to Full data member.
251  ///
252  /// @param value
253  /// Value to assign
254  void SetFull(const TFull& value);
255  void SetFull(TFull&& value);
256 
257  /// Assign a value to Full data member.
258  ///
259  /// @return
260  /// Reference to the data value.
261  TFull& SetFull(void);
262 
263  /// first + middle initials
264  /// Check if a value has been assigned to Initials data member.
265  ///
266  /// Data member Initials is optional;
267  /// its type is defined as 'typedef string TInitials'
268  /// @return
269  /// - true, if a value has been assigned.
270  /// - false, otherwise.
271  bool IsSetInitials(void) const;
272 
273  /// Check if it is safe to call GetInitials method.
274  ///
275  /// @return
276  /// - true, if the data member is getatable.
277  /// - false, otherwise.
278  bool CanGetInitials(void) const;
279 
280  /// Reset Initials data member.
281  void ResetInitials(void);
282 
283  /// Get the Initials member data.
284  ///
285  /// @return
286  /// Reference to the member data.
287  const TInitials& GetInitials(void) const;
288 
289  /// Assign a value to Initials data member.
290  ///
291  /// @param value
292  /// Value to assign
293  void SetInitials(const TInitials& value);
294  void SetInitials(TInitials&& value);
295 
296  /// Assign a value to Initials data member.
297  ///
298  /// @return
299  /// Reference to the data value.
300  TInitials& SetInitials(void);
301 
302  /// Jr, Sr, III
303  /// Check if a value has been assigned to Suffix data member.
304  ///
305  /// Data member Suffix is optional;
306  /// its type is defined as 'typedef string TSuffix'
307  /// @return
308  /// - true, if a value has been assigned.
309  /// - false, otherwise.
310  bool IsSetSuffix(void) const;
311 
312  /// Check if it is safe to call GetSuffix method.
313  ///
314  /// @return
315  /// - true, if the data member is getatable.
316  /// - false, otherwise.
317  bool CanGetSuffix(void) const;
318 
319  /// Reset Suffix data member.
320  void ResetSuffix(void);
321 
322  /// Get the Suffix member data.
323  ///
324  /// @return
325  /// Reference to the member data.
326  const TSuffix& GetSuffix(void) const;
327 
328  /// Assign a value to Suffix data member.
329  ///
330  /// @param value
331  /// Value to assign
332  void SetSuffix(const TSuffix& value);
333  void SetSuffix(TSuffix&& value);
334 
335  /// Assign a value to Suffix data member.
336  ///
337  /// @return
338  /// Reference to the data value.
339  TSuffix& SetSuffix(void);
340 
341  /// Dr., Sister, etc
342  /// Check if a value has been assigned to Title data member.
343  ///
344  /// Data member Title is optional;
345  /// its type is defined as 'typedef string TTitle'
346  /// @return
347  /// - true, if a value has been assigned.
348  /// - false, otherwise.
349  bool IsSetTitle(void) const;
350 
351  /// Check if it is safe to call GetTitle method.
352  ///
353  /// @return
354  /// - true, if the data member is getatable.
355  /// - false, otherwise.
356  bool CanGetTitle(void) const;
357 
358  /// Reset Title data member.
359  void ResetTitle(void);
360 
361  /// Get the Title member data.
362  ///
363  /// @return
364  /// Reference to the member data.
365  const TTitle& GetTitle(void) const;
366 
367  /// Assign a value to Title data member.
368  ///
369  /// @param value
370  /// Value to assign
371  void SetTitle(const TTitle& value);
372  void SetTitle(TTitle&& value);
373 
374  /// Assign a value to Title data member.
375  ///
376  /// @return
377  /// Reference to the data value.
378  TTitle& SetTitle(void);
379 
380  /// Reset the whole object
381  virtual void Reset(void);
382 
383 
384 private:
385  // Prohibit copy constructor and assignment operator
388 
389  // data
390  Uint4 m_set_State[1];
391  string m_Last;
392  string m_First;
393  string m_Middle;
394  string m_Full;
395  string m_Initials;
396  string m_Suffix;
397  string m_Title;
398 };
399 
400 /* @} */
401 
402 
403 
404 
405 
406 ///////////////////////////////////////////////////////////
407 ///////////////////// inline methods //////////////////////
408 ///////////////////////////////////////////////////////////
409 inline
411 {
412  return ((m_set_State[0] & 0x3) != 0);
413 }
414 
415 inline
417 {
418  return IsSetLast();
419 }
420 
421 inline
423 {
424  if (!CanGetLast()) {
425  ThrowUnassigned(0);
426  }
427  return m_Last;
428 }
429 
430 inline
432 {
433  m_Last = value;
434  m_set_State[0] |= 0x3;
435 }
436 
437 inline
439 {
440  m_Last = std::forward<CName_std_Base::TLast>(value);
441  m_set_State[0] |= 0x3;
442 }
443 
444 inline
446 {
447 #ifdef _DEBUG
448  if (!IsSetLast()) {
450  }
451 #endif
452  m_set_State[0] |= 0x1;
453  return m_Last;
454 }
455 
456 inline
458 {
459  return ((m_set_State[0] & 0xc) != 0);
460 }
461 
462 inline
464 {
465  return IsSetFirst();
466 }
467 
468 inline
470 {
471  if (!CanGetFirst()) {
472  ThrowUnassigned(1);
473  }
474  return m_First;
475 }
476 
477 inline
479 {
480  m_First = value;
481  m_set_State[0] |= 0xc;
482 }
483 
484 inline
486 {
487  m_First = std::forward<CName_std_Base::TFirst>(value);
488  m_set_State[0] |= 0xc;
489 }
490 
491 inline
493 {
494 #ifdef _DEBUG
495  if (!IsSetFirst()) {
497  }
498 #endif
499  m_set_State[0] |= 0x4;
500  return m_First;
501 }
502 
503 inline
505 {
506  return ((m_set_State[0] & 0x30) != 0);
507 }
508 
509 inline
511 {
512  return IsSetMiddle();
513 }
514 
515 inline
517 {
518  if (!CanGetMiddle()) {
519  ThrowUnassigned(2);
520  }
521  return m_Middle;
522 }
523 
524 inline
526 {
527  m_Middle = value;
528  m_set_State[0] |= 0x30;
529 }
530 
531 inline
533 {
534  m_Middle = std::forward<CName_std_Base::TMiddle>(value);
535  m_set_State[0] |= 0x30;
536 }
537 
538 inline
540 {
541 #ifdef _DEBUG
542  if (!IsSetMiddle()) {
544  }
545 #endif
546  m_set_State[0] |= 0x10;
547  return m_Middle;
548 }
549 
550 inline
552 {
553  return ((m_set_State[0] & 0xc0) != 0);
554 }
555 
556 inline
558 {
559  return IsSetFull();
560 }
561 
562 inline
564 {
565  if (!CanGetFull()) {
566  ThrowUnassigned(3);
567  }
568  return m_Full;
569 }
570 
571 inline
573 {
574  m_Full = value;
575  m_set_State[0] |= 0xc0;
576 }
577 
578 inline
580 {
581  m_Full = std::forward<CName_std_Base::TFull>(value);
582  m_set_State[0] |= 0xc0;
583 }
584 
585 inline
587 {
588 #ifdef _DEBUG
589  if (!IsSetFull()) {
591  }
592 #endif
593  m_set_State[0] |= 0x40;
594  return m_Full;
595 }
596 
597 inline
599 {
600  return ((m_set_State[0] & 0x300) != 0);
601 }
602 
603 inline
605 {
606  return IsSetInitials();
607 }
608 
609 inline
611 {
612  if (!CanGetInitials()) {
613  ThrowUnassigned(4);
614  }
615  return m_Initials;
616 }
617 
618 inline
620 {
621  m_Initials = value;
622  m_set_State[0] |= 0x300;
623 }
624 
625 inline
627 {
628  m_Initials = std::forward<CName_std_Base::TInitials>(value);
629  m_set_State[0] |= 0x300;
630 }
631 
632 inline
634 {
635 #ifdef _DEBUG
636  if (!IsSetInitials()) {
638  }
639 #endif
640  m_set_State[0] |= 0x100;
641  return m_Initials;
642 }
643 
644 inline
646 {
647  return ((m_set_State[0] & 0xc00) != 0);
648 }
649 
650 inline
652 {
653  return IsSetSuffix();
654 }
655 
656 inline
658 {
659  if (!CanGetSuffix()) {
660  ThrowUnassigned(5);
661  }
662  return m_Suffix;
663 }
664 
665 inline
667 {
668  m_Suffix = value;
669  m_set_State[0] |= 0xc00;
670 }
671 
672 inline
674 {
675  m_Suffix = std::forward<CName_std_Base::TSuffix>(value);
676  m_set_State[0] |= 0xc00;
677 }
678 
679 inline
681 {
682 #ifdef _DEBUG
683  if (!IsSetSuffix()) {
685  }
686 #endif
687  m_set_State[0] |= 0x400;
688  return m_Suffix;
689 }
690 
691 inline
693 {
694  return ((m_set_State[0] & 0x3000) != 0);
695 }
696 
697 inline
699 {
700  return IsSetTitle();
701 }
702 
703 inline
705 {
706  if (!CanGetTitle()) {
707  ThrowUnassigned(6);
708  }
709  return m_Title;
710 }
711 
712 inline
714 {
715  m_Title = value;
716  m_set_State[0] |= 0x3000;
717 }
718 
719 inline
721 {
722  m_Title = std::forward<CName_std_Base::TTitle>(value);
723  m_set_State[0] |= 0x3000;
724 }
725 
726 inline
728 {
729 #ifdef _DEBUG
730  if (!IsSetTitle()) {
732  }
733 #endif
734  m_set_State[0] |= 0x1000;
735  return m_Title;
736 }
737 
738 ///////////////////////////////////////////////////////////
739 ////////////////// end of inline methods //////////////////
740 ///////////////////////////////////////////////////////////
741 
742 
743 
744 
745 
746 END_objects_SCOPE // namespace ncbi::objects::
747 
749 
750 
751 #endif // OBJECTS_GENERAL_NAME_STD_BASE_HPP
Structured names.
Definition: Name_std_.hpp:74
Base class for all serializable objects.
Definition: serialbase.hpp:150
void ThrowUnassigned(TMemberIndex index) const
static string UnassignedString(void)
Definition: serialbase.hpp:175
NCBI_XOBJUTIL_EXPORT string GetTitle(const CBioseq_Handle &hnd, TGetTitleFlags flags=0)
Definition: seqtitle.cpp:106
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_GENERAL_EXPORT
Definition: ncbi_export.h:512
bool IsSetSuffix(void) const
Jr, Sr, III Check if a value has been assigned to Suffix data member.
Definition: Name_std_.hpp:645
bool CanGetLast(void) const
Check if it is safe to call GetLast method.
Definition: Name_std_.hpp:416
string TMiddle
Definition: Name_std_.hpp:88
bool CanGetInitials(void) const
Check if it is safe to call GetInitials method.
Definition: Name_std_.hpp:604
const TInitials & GetInitials(void) const
Get the Initials member data.
Definition: Name_std_.hpp:610
bool CanGetFirst(void) const
Check if it is safe to call GetFirst method.
Definition: Name_std_.hpp:463
bool IsSetMiddle(void) const
Check if a value has been assigned to Middle data member.
Definition: Name_std_.hpp:504
const TFull & GetFull(void) const
Get the Full member data.
Definition: Name_std_.hpp:563
Uint4 m_set_State[1]
Definition: Name_std_.hpp:390
bool IsSetFull(void) const
full name eg.
Definition: Name_std_.hpp:551
bool IsSetInitials(void) const
first + middle initials Check if a value has been assigned to Initials data member.
Definition: Name_std_.hpp:598
bool IsSetTitle(void) const
Dr., Sister, etc Check if a value has been assigned to Title data member.
Definition: Name_std_.hpp:692
string TInitials
Definition: Name_std_.hpp:90
bool IsSetLast(void) const
Check if a value has been assigned to Last data member.
Definition: Name_std_.hpp:410
const TMiddle & GetMiddle(void) const
Get the Middle member data.
Definition: Name_std_.hpp:516
string m_Initials
Definition: Name_std_.hpp:395
const TTitle & GetTitle(void) const
Get the Title member data.
Definition: Name_std_.hpp:704
TInitials & SetInitials(void)
Assign a value to Initials data member.
Definition: Name_std_.hpp:633
const TSuffix & GetSuffix(void) const
Get the Suffix member data.
Definition: Name_std_.hpp:657
CName_std_Base & operator=(const CName_std_Base &)
CSerialObject Tparent
Definition: Name_std_.hpp:75
bool CanGetSuffix(void) const
Check if it is safe to call GetSuffix method.
Definition: Name_std_.hpp:651
const TFirst & GetFirst(void) const
Get the First member data.
Definition: Name_std_.hpp:469
TMiddle & SetMiddle(void)
Assign a value to Middle data member.
Definition: Name_std_.hpp:539
const TLast & GetLast(void) const
Get the Last member data.
Definition: Name_std_.hpp:422
TSuffix & SetSuffix(void)
Assign a value to Suffix data member.
Definition: Name_std_.hpp:680
string TSuffix
Definition: Name_std_.hpp:91
Tparent::CMemberIndex< E_memberIndex, 8 > TmemberIndex
Definition: Name_std_.hpp:105
bool IsSetFirst(void) const
Check if a value has been assigned to First data member.
Definition: Name_std_.hpp:457
CName_std_Base(const CName_std_Base &)
bool CanGetFull(void) const
Check if it is safe to call GetFull method.
Definition: Name_std_.hpp:557
TFirst & SetFirst(void)
Assign a value to First data member.
Definition: Name_std_.hpp:492
TLast & SetLast(void)
Assign a value to Last data member.
Definition: Name_std_.hpp:445
bool CanGetTitle(void) const
Check if it is safe to call GetTitle method.
Definition: Name_std_.hpp:698
DECLARE_INTERNAL_TYPE_INFO()
TTitle & SetTitle(void)
Assign a value to Title data member.
Definition: Name_std_.hpp:727
TFull & SetFull(void)
Assign a value to Full data member.
Definition: Name_std_.hpp:586
bool CanGetMiddle(void) const
Check if it is safe to call GetMiddle method.
Definition: Name_std_.hpp:510
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
static void SetTitle(CRef< CSeq_entry > entry, string title)
Modified on Fri Sep 20 14:56:58 2024 by modify_doxy.py rev. 669887