NCBI C++ ToolKit
Toupper_.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 Toupper_.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/objtools/eutils/linkout/linkout.dtd">linkout.dtd</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objtools/eutils/linkout/linkout.def">linkout.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 linkout__OBJTOOLS_EUTILS_LINKOUT_TOUPPER_BASE_HPP
42 #define linkout__OBJTOOLS_EUTILS_LINKOUT_TOUPPER_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
46 
47 // generated includes
48 #include <list>
49 #include <string>
50 
51 #ifndef BEGIN_linkout_SCOPE
52 # define BEGIN_linkout_SCOPE BEGIN_SCOPE(linkout)
53 # define END_linkout_SCOPE END_SCOPE(linkout)
54 #endif
55 BEGIN_linkout_SCOPE // namespace linkout::
56 
57 
58 // forward declarations
59 class CApad;
60 class CNormalize;
61 class CPad;
62 class CStrip;
63 class CSubs;
64 class CTolower;
65 class CToupper;
66 
67 
68 // generated classes
69 
70 
71 /** @addtogroup dataspec_linkout
72  *
73  * @{
74  */
75 
76 /////////////////////////////////////////////////////////////////////////////
77 ///
78 /// CToupper_Base --
79 ///
80 
81 class NCBI_EUTILS_EXPORT CToupper_Base : public NCBI_NS_NCBI::CSerialObject
82 {
83  typedef NCBI_NS_NCBI::CSerialObject Tparent;
84 public:
85  // constructor
86  CToupper_Base(void);
87  // destructor
88  virtual ~CToupper_Base(void);
89 
90  // type info
92 
93  /////////////////////////////////////////////////////////////////////////////
94  ///
95  /// C_Data --
96  ///
97 
98  class NCBI_EUTILS_EXPORT C_Data : public NCBI_NS_NCBI::CSerialObject
99  {
100  typedef NCBI_NS_NCBI::CSerialObject Tparent;
101  public:
102  // constructor
103  C_Data(void);
104  // destructor
105  ~C_Data(void);
106 
107  // type info
109 
110 
111  /// Choice variants.
112  enum E_Choice {
113  e_not_set = 0, ///< No variant selected
121  e_Normalize
122  };
123  /// Maximum+1 value of the choice variant enumerator.
125  e_MaxChoice = 9 ///< == e_Normalize+1
126  };
127 
128  /// Reset the whole object
129  void Reset(void);
130 
131  /// Reset the selection (set it to e_not_set).
132  void ResetSelection(void);
133 
134  /// Which variant is currently selected.
135  ///
136  /// @return
137  /// Choice state enumerator.
138  E_Choice Which(void) const;
139 
140  /// Verify selection, throw exception if it differs from the expected.
141  ///
142  /// @param index
143  /// Expected selection.
144  void CheckSelected(E_Choice index) const;
145 
146  /// Throw 'InvalidSelection' exception.
147  ///
148  /// @param index
149  /// Expected selection.
150  NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const;
151 
152  /// Retrieve selection name (for diagnostic purposes).
153  ///
154  /// @param index
155  /// One of possible selection states.
156  /// @return
157  /// Name string.
158  static NCBI_NS_STD::string SelectionName(E_Choice index);
159 
160  /// Select the requested variant if needed.
161  ///
162  /// @param index
163  /// New selection state.
164  /// @param reset
165  /// Flag that defines the resetting of the variant data. The data will
166  /// be reset if either the current selection differs from the new one,
167  /// or the flag is set to eDoResetVariant.
168  void Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset = NCBI_NS_NCBI::eDoResetVariant);
169  /// Select the requested variant if needed,
170  /// allocating CObject variants from memory pool.
171  void Select(E_Choice index,
173  NCBI_NS_NCBI::CObjectMemoryPool* pool);
174 
175  // types
177  typedef CPad TPad;
178  typedef CApad TApad;
179  typedef CSubs TSubs;
182  typedef CStrip TStrip;
184 
185  // getters
186  // setters
187 
188 
189  /// Check if variant _CharData is selected.
190  ///
191  /// _CharData type is defined as 'typedef NCBI_NS_STD::string T_CharData'.
192  /// @return
193  /// - true, if the variant is selected.
194  /// - false, otherwise.
195  bool Is_CharData(void) const;
196 
197  /// Get the variant data.
198  ///
199  /// @return
200  /// Reference to the data.
201  const T_CharData& Get_CharData(void) const;
202 
203  /// Select the variant.
204  ///
205  /// @return
206  /// Reference to the variant data.
207  T_CharData& Set_CharData(void);
208 
209  /// Select the variant and set its data.
210  ///
211  /// @param value
212  /// Variant data.
213  void Set_CharData(const T_CharData& value);
214 
215 
216  /// Check if variant Pad is selected.
217  ///
218  /// Pad type is defined as 'typedef CPad TPad'.
219  /// @return
220  /// - true, if the variant is selected.
221  /// - false, otherwise.
222  bool IsPad(void) const;
223 
224  /// Get the variant data.
225  ///
226  /// @return
227  /// Reference to the data.
228  const TPad& GetPad(void) const;
229 
230  /// Select the variant.
231  ///
232  /// @return
233  /// Reference to the variant data.
234  TPad& SetPad(void);
235  /// Select the variant and set its data.
236  ///
237  /// @param value
238  /// Reference to the data.
239  void SetPad(TPad& value);
240 
241 
242  /// Check if variant Apad is selected.
243  ///
244  /// Apad type is defined as 'typedef CApad TApad'.
245  /// @return
246  /// - true, if the variant is selected.
247  /// - false, otherwise.
248  bool IsApad(void) const;
249 
250  /// Get the variant data.
251  ///
252  /// @return
253  /// Reference to the data.
254  const TApad& GetApad(void) const;
255 
256  /// Select the variant.
257  ///
258  /// @return
259  /// Reference to the variant data.
260  TApad& SetApad(void);
261  /// Select the variant and set its data.
262  ///
263  /// @param value
264  /// Reference to the data.
265  void SetApad(TApad& value);
266 
267 
268  /// Check if variant Subs is selected.
269  ///
270  /// Subs type is defined as 'typedef CSubs TSubs'.
271  /// @return
272  /// - true, if the variant is selected.
273  /// - false, otherwise.
274  bool IsSubs(void) const;
275 
276  /// Get the variant data.
277  ///
278  /// @return
279  /// Reference to the data.
280  const TSubs& GetSubs(void) const;
281 
282  /// Select the variant.
283  ///
284  /// @return
285  /// Reference to the variant data.
286  TSubs& SetSubs(void);
287  /// Select the variant and set its data.
288  ///
289  /// @param value
290  /// Reference to the data.
291  void SetSubs(TSubs& value);
292 
293 
294  /// Check if variant Toupper is selected.
295  ///
296  /// Toupper type is defined as 'typedef CToupper TToupper'.
297  /// @return
298  /// - true, if the variant is selected.
299  /// - false, otherwise.
300  bool IsToupper(void) const;
301 
302  /// Get the variant data.
303  ///
304  /// @return
305  /// Reference to the data.
306  const TToupper& GetToupper(void) const;
307 
308  /// Select the variant.
309  ///
310  /// @return
311  /// Reference to the variant data.
312  TToupper& SetToupper(void);
313  /// Select the variant and set its data.
314  ///
315  /// @param value
316  /// Reference to the data.
317  void SetToupper(TToupper& value);
318 
319 
320  /// Check if variant Tolower is selected.
321  ///
322  /// Tolower type is defined as 'typedef CTolower TTolower'.
323  /// @return
324  /// - true, if the variant is selected.
325  /// - false, otherwise.
326  bool IsTolower(void) const;
327 
328  /// Get the variant data.
329  ///
330  /// @return
331  /// Reference to the data.
332  const TTolower& GetTolower(void) const;
333 
334  /// Select the variant.
335  ///
336  /// @return
337  /// Reference to the variant data.
338  TTolower& SetTolower(void);
339  /// Select the variant and set its data.
340  ///
341  /// @param value
342  /// Reference to the data.
343  void SetTolower(TTolower& value);
344 
345 
346  /// Check if variant Strip is selected.
347  ///
348  /// Strip type is defined as 'typedef CStrip TStrip'.
349  /// @return
350  /// - true, if the variant is selected.
351  /// - false, otherwise.
352  bool IsStrip(void) const;
353 
354  /// Get the variant data.
355  ///
356  /// @return
357  /// Reference to the data.
358  const TStrip& GetStrip(void) const;
359 
360  /// Select the variant.
361  ///
362  /// @return
363  /// Reference to the variant data.
364  TStrip& SetStrip(void);
365  /// Select the variant and set its data.
366  ///
367  /// @param value
368  /// Reference to the data.
369  void SetStrip(TStrip& value);
370 
371 
372  /// Check if variant Normalize is selected.
373  ///
374  /// Normalize type is defined as 'typedef CNormalize TNormalize'.
375  /// @return
376  /// - true, if the variant is selected.
377  /// - false, otherwise.
378  bool IsNormalize(void) const;
379 
380  /// Get the variant data.
381  ///
382  /// @return
383  /// Reference to the data.
384  const TNormalize& GetNormalize(void) const;
385 
386  /// Select the variant.
387  ///
388  /// @return
389  /// Reference to the variant data.
390  TNormalize& SetNormalize(void);
391  /// Select the variant and set its data.
392  ///
393  /// @param value
394  /// Reference to the data.
395  void SetNormalize(TNormalize& value);
396 
397 
398  private:
399  // copy constructor and assignment operator
400  C_Data(const C_Data& );
402  // choice state
404  // helper methods
405  void DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool = 0);
406 
407  static const char* const sm_SelectionNames[];
408  // data
409  union {
410  NCBI_NS_NCBI::CUnionBuffer<NCBI_NS_STD::string> m_string;
411  NCBI_NS_NCBI::CSerialObject *m_object;
412  };
413  };
414  // types
415  typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< C_Data > > Tdata;
416 
417  // getters
418  // setters
419 
420  /// Check if a value has been assigned to data member.
421  ///
422  /// Data member is mandatory;
423  /// its type is defined as 'typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< C_Data > > Tdata'
424  /// @return
425  /// - true, if a value has been assigned.
426  /// - false, otherwise.
427  bool IsSet(void) const;
428 
429  /// Check if it is safe to call Get method.
430  ///
431  /// @return
432  /// - true, if the data member is getatable.
433  /// - false, otherwise.
434  bool CanGet(void) const;
435 
436  /// Reset data member.
437  void Reset(void);
438 
439  /// Get the member data.
440  ///
441  /// @return
442  /// Reference to the member data.
443  const Tdata& Get(void) const;
444 
445  /// Assign a value to data member.
446  ///
447  /// @return
448  /// Reference to the data value.
449  Tdata& Set(void);
450 
451  /// Conversion operator to 'const Tdata' type.
452  operator const Tdata& (void) const;
453  /// Conversion operator to 'Tdata' type.
454  operator Tdata& (void);
455 
456 
457 
458 private:
459  // Prohibit copy constructor and assignment operator
462 
463  // data
464  Uint4 m_set_State[1];
465  NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< C_Data > > m_data;
466 };
467 
468 /* @} */
469 
470 
471 
472 
473 
474 ///////////////////////////////////////////////////////////
475 ///////////////////// inline methods //////////////////////
476 ///////////////////////////////////////////////////////////
477 inline
479 {
480  return m_choice;
481 }
482 
483 inline
485 {
486  if ( m_choice != index )
487  ThrowInvalidSelection(index);
488 }
489 
490 inline
491 void CToupper_Base::C_Data::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
492 {
493  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
494  if ( m_choice != e_not_set )
495  ResetSelection();
496  DoSelect(index, pool);
497  }
498 }
499 
500 inline
502 {
503  Select(index, reset, 0);
504 }
505 
506 inline
508 {
509  return m_choice == e__CharData;
510 }
511 
512 inline
514 {
515  CheckSelected(e__CharData);
516  return *m_string;
517 }
518 
519 inline
521 {
522  Select(e__CharData, NCBI_NS_NCBI::eDoNotResetVariant);
523  return *m_string;
524 }
525 
526 inline
528 {
529  return m_choice == e_Pad;
530 }
531 
532 inline
534 {
535  return m_choice == e_Apad;
536 }
537 
538 inline
540 {
541  return m_choice == e_Subs;
542 }
543 
544 inline
546 {
547  return m_choice == e_Toupper;
548 }
549 
550 inline
552 {
553  return m_choice == e_Tolower;
554 }
555 
556 inline
558 {
559  return m_choice == e_Strip;
560 }
561 
562 inline
564 {
565  return m_choice == e_Normalize;
566 }
567 
568 inline
569 bool CToupper_Base::IsSet(void) const
570 {
571  return ((m_set_State[0] & 0x3) != 0);
572 }
573 
574 inline
575 bool CToupper_Base::CanGet(void) const
576 {
577  return true;
578 }
579 
580 inline
582 {
583  return m_data;
584 }
585 
586 inline
588 {
589  m_set_State[0] |= 0x1;
590  return m_data;
591 }
592 
593 inline
594 CToupper_Base::operator const CToupper_Base::Tdata& (void) const
595 {
596  return m_data;
597 }
598 
599 inline
600 CToupper_Base::operator CToupper_Base::Tdata& (void)
601 {
602  m_set_State[0] |= 0x1;
603  return m_data;
604 }
605 
606 ///////////////////////////////////////////////////////////
607 ////////////////// end of inline methods //////////////////
608 ///////////////////////////////////////////////////////////
609 
610 
611 
612 
613 
614 END_linkout_SCOPE // namespace linkout::
615 
616 
617 #endif // linkout__OBJTOOLS_EUTILS_LINKOUT_TOUPPER_BASE_HPP
#define BEGIN_linkout_SCOPE
Definition: Toupper_.hpp:52
#define END_linkout_SCOPE
Definition: Toupper_.hpp:53
CApad –.
Definition: Apad.hpp:64
CNormalize –.
Definition: Normalize.hpp:64
CPad –.
Definition: Pad.hpp:64
CStrip –.
Definition: Strip.hpp:64
CSubs –.
Definition: Subs.hpp:64
CTolower –.
Definition: Tolower.hpp:64
CToupper_Base –.
Definition: Toupper_.hpp:82
CToupper –.
Definition: Toupper.hpp:64
char value[7]
Definition: config.c:431
string
Definition: cgiapp.hpp:687
EResetVariant
Definition: serialbase.hpp:76
@ eDoResetVariant
Definition: serialbase.hpp:77
@ eDoNotResetVariant
Definition: serialbase.hpp:78
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
#define NCBI_EUTILS_EXPORT
Definition: ncbi_export.h:1460
NCBI_NS_NCBI::CSerialObject Tparent
Definition: Toupper_.hpp:83
NCBI_NS_STD::string T_CharData
Definition: Toupper_.hpp:176
NCBI_NS_NCBI::CSerialObject * m_object
Definition: Toupper_.hpp:411
NCBI_NS_NCBI::CSerialObject Tparent
Definition: Toupper_.hpp:100
bool IsApad(void) const
Check if variant Apad is selected.
Definition: Toupper_.hpp:533
T_CharData & Set_CharData(void)
Select the variant.
Definition: Toupper_.hpp:520
CNormalize TNormalize
Definition: Toupper_.hpp:183
void Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset=NCBI_NS_NCBI::eDoResetVariant)
Select the requested variant if needed.
Definition: Toupper_.hpp:501
E_Choice
Choice variants.
Definition: Toupper_.hpp:112
NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< C_Data > > m_data
Definition: Toupper_.hpp:465
const Tdata & Get(void) const
Get the member data.
Definition: Toupper_.hpp:581
CToupper_Base(const CToupper_Base &)
C_Data(const C_Data &)
bool IsPad(void) const
Check if variant Pad is selected.
Definition: Toupper_.hpp:527
Tdata & Set(void)
Assign a value to data member.
Definition: Toupper_.hpp:587
E_Choice Which(void) const
Which variant is currently selected.
Definition: Toupper_.hpp:478
bool Is_CharData(void) const
Check if variant _CharData is selected.
Definition: Toupper_.hpp:507
CToupper_Base & operator=(const CToupper_Base &)
NCBI_NS_NCBI::CUnionBuffer< NCBI_NS_STD::string > m_string
Definition: Toupper_.hpp:410
bool CanGet(void) const
Check if it is safe to call Get method.
Definition: Toupper_.hpp:575
bool IsNormalize(void) const
Check if variant Normalize is selected.
Definition: Toupper_.hpp:563
Uint4 m_set_State[1]
Definition: Toupper_.hpp:464
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
Definition: Toupper_.hpp:484
bool IsSet(void) const
Check if a value has been assigned to data member.
Definition: Toupper_.hpp:569
bool IsTolower(void) const
Check if variant Tolower is selected.
Definition: Toupper_.hpp:551
DECLARE_INTERNAL_TYPE_INFO()
const T_CharData & Get_CharData(void) const
Get the variant data.
Definition: Toupper_.hpp:513
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
Definition: Toupper_.hpp:124
C_Data & operator=(const C_Data &)
bool IsStrip(void) const
Check if variant Strip is selected.
Definition: Toupper_.hpp:557
bool IsSubs(void) const
Check if variant Subs is selected.
Definition: Toupper_.hpp:539
bool IsToupper(void) const
Check if variant Toupper is selected.
Definition: Toupper_.hpp:545
NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< C_Data > > Tdata
Definition: Toupper_.hpp:415
@ e_not_set
const TYPE & Get(const CNamedParameterList *param)
Modified on Fri Mar 01 10:08:22 2024 by modify_doxy.py rev. 669887