NCBI C++ ToolKit
Date_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 Date_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_DATE_STD_BASE_HPP
42 #define OBJECTS_GENERAL_DATE_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 /// NOTE: this is NOT a unix tm struct
69 ///
70 /// CDate_std_Base --
71 ///
72 
74 {
76 public:
77  // constructor
78  CDate_std_Base(void);
79  // destructor
80  virtual ~CDate_std_Base(void);
81 
82  // type info
84 
85  // types
86  typedef int TYear;
87  typedef int TMonth;
88  typedef int TDay;
89  typedef string TSeason;
90  typedef int THour;
91  typedef int TMinute;
92  typedef int TSecond;
93 
94  // member index
95  enum class E_memberIndex {
96  e__allMandatory = 0,
97  e_year,
98  e_month,
99  e_day,
100  e_season,
101  e_hour,
102  e_minute,
103  e_second
104  };
106 
107  // getters
108  // setters
109 
110  /// full year (including 1900)
111  /// Check if a value has been assigned to Year data member.
112  ///
113  /// Data member Year is mandatory;
114  /// its type is defined as 'typedef int TYear'
115  /// @return
116  /// - true, if a value has been assigned.
117  /// - false, otherwise.
118  bool IsSetYear(void) const;
119 
120  /// Check if it is safe to call GetYear method.
121  ///
122  /// @return
123  /// - true, if the data member is getatable.
124  /// - false, otherwise.
125  bool CanGetYear(void) const;
126 
127  /// Reset Year data member.
128  void ResetYear(void);
129 
130  /// Get the Year member data.
131  ///
132  /// @return
133  /// Copy of the member data.
134  TYear GetYear(void) const;
135 
136  /// Assign a value to Year data member.
137  ///
138  /// @param value
139  /// Value to assign
140  void SetYear(TYear value);
141 
142  /// Assign a value to Year data member.
143  ///
144  /// @return
145  /// Reference to the data value.
146  TYear& SetYear(void);
147 
148  /// month (1-12)
149  /// Check if a value has been assigned to Month data member.
150  ///
151  /// Data member Month is optional;
152  /// its type is defined as 'typedef int TMonth'
153  /// @return
154  /// - true, if a value has been assigned.
155  /// - false, otherwise.
156  bool IsSetMonth(void) const;
157 
158  /// Check if it is safe to call GetMonth method.
159  ///
160  /// @return
161  /// - true, if the data member is getatable.
162  /// - false, otherwise.
163  bool CanGetMonth(void) const;
164 
165  /// Reset Month data member.
166  void ResetMonth(void);
167 
168  /// Get the Month member data.
169  ///
170  /// @return
171  /// Copy of the member data.
172  TMonth GetMonth(void) const;
173 
174  /// Assign a value to Month data member.
175  ///
176  /// @param value
177  /// Value to assign
178  void SetMonth(TMonth value);
179 
180  /// Assign a value to Month data member.
181  ///
182  /// @return
183  /// Reference to the data value.
184  TMonth& SetMonth(void);
185 
186  /// day of month (1-31)
187  /// Check if a value has been assigned to Day data member.
188  ///
189  /// Data member Day is optional;
190  /// its type is defined as 'typedef int TDay'
191  /// @return
192  /// - true, if a value has been assigned.
193  /// - false, otherwise.
194  bool IsSetDay(void) const;
195 
196  /// Check if it is safe to call GetDay method.
197  ///
198  /// @return
199  /// - true, if the data member is getatable.
200  /// - false, otherwise.
201  bool CanGetDay(void) const;
202 
203  /// Reset Day data member.
204  void ResetDay(void);
205 
206  /// Get the Day member data.
207  ///
208  /// @return
209  /// Copy of the member data.
210  TDay GetDay(void) const;
211 
212  /// Assign a value to Day data member.
213  ///
214  /// @param value
215  /// Value to assign
216  void SetDay(TDay value);
217 
218  /// Assign a value to Day data member.
219  ///
220  /// @return
221  /// Reference to the data value.
222  TDay& SetDay(void);
223 
224  /// for "spring", "may-june", etc
225  /// Check if a value has been assigned to Season data member.
226  ///
227  /// Data member Season is optional;
228  /// its type is defined as 'typedef string TSeason'
229  /// @return
230  /// - true, if a value has been assigned.
231  /// - false, otherwise.
232  bool IsSetSeason(void) const;
233 
234  /// Check if it is safe to call GetSeason method.
235  ///
236  /// @return
237  /// - true, if the data member is getatable.
238  /// - false, otherwise.
239  bool CanGetSeason(void) const;
240 
241  /// Reset Season data member.
242  void ResetSeason(void);
243 
244  /// Get the Season member data.
245  ///
246  /// @return
247  /// Reference to the member data.
248  const TSeason& GetSeason(void) const;
249 
250  /// Assign a value to Season data member.
251  ///
252  /// @param value
253  /// Value to assign
254  void SetSeason(const TSeason& value);
255  void SetSeason(TSeason&& value);
256 
257  /// Assign a value to Season data member.
258  ///
259  /// @return
260  /// Reference to the data value.
261  TSeason& SetSeason(void);
262 
263  /// hour of day (0-23)
264  /// Check if a value has been assigned to Hour data member.
265  ///
266  /// Data member Hour is optional;
267  /// its type is defined as 'typedef int THour'
268  /// @return
269  /// - true, if a value has been assigned.
270  /// - false, otherwise.
271  bool IsSetHour(void) const;
272 
273  /// Check if it is safe to call GetHour method.
274  ///
275  /// @return
276  /// - true, if the data member is getatable.
277  /// - false, otherwise.
278  bool CanGetHour(void) const;
279 
280  /// Reset Hour data member.
281  void ResetHour(void);
282 
283  /// Get the Hour member data.
284  ///
285  /// @return
286  /// Copy of the member data.
287  THour GetHour(void) const;
288 
289  /// Assign a value to Hour data member.
290  ///
291  /// @param value
292  /// Value to assign
293  void SetHour(THour value);
294 
295  /// Assign a value to Hour data member.
296  ///
297  /// @return
298  /// Reference to the data value.
299  THour& SetHour(void);
300 
301  /// minute of hour (0-59)
302  /// Check if a value has been assigned to Minute data member.
303  ///
304  /// Data member Minute is optional;
305  /// its type is defined as 'typedef int TMinute'
306  /// @return
307  /// - true, if a value has been assigned.
308  /// - false, otherwise.
309  bool IsSetMinute(void) const;
310 
311  /// Check if it is safe to call GetMinute method.
312  ///
313  /// @return
314  /// - true, if the data member is getatable.
315  /// - false, otherwise.
316  bool CanGetMinute(void) const;
317 
318  /// Reset Minute data member.
319  void ResetMinute(void);
320 
321  /// Get the Minute member data.
322  ///
323  /// @return
324  /// Copy of the member data.
325  TMinute GetMinute(void) const;
326 
327  /// Assign a value to Minute data member.
328  ///
329  /// @param value
330  /// Value to assign
331  void SetMinute(TMinute value);
332 
333  /// Assign a value to Minute data member.
334  ///
335  /// @return
336  /// Reference to the data value.
337  TMinute& SetMinute(void);
338 
339  /// second of minute (0-59)
340  /// Check if a value has been assigned to Second data member.
341  ///
342  /// Data member Second is optional;
343  /// its type is defined as 'typedef int TSecond'
344  /// @return
345  /// - true, if a value has been assigned.
346  /// - false, otherwise.
347  bool IsSetSecond(void) const;
348 
349  /// Check if it is safe to call GetSecond method.
350  ///
351  /// @return
352  /// - true, if the data member is getatable.
353  /// - false, otherwise.
354  bool CanGetSecond(void) const;
355 
356  /// Reset Second data member.
357  void ResetSecond(void);
358 
359  /// Get the Second member data.
360  ///
361  /// @return
362  /// Copy of the member data.
363  TSecond GetSecond(void) const;
364 
365  /// Assign a value to Second data member.
366  ///
367  /// @param value
368  /// Value to assign
369  void SetSecond(TSecond value);
370 
371  /// Assign a value to Second data member.
372  ///
373  /// @return
374  /// Reference to the data value.
375  TSecond& SetSecond(void);
376 
377  /// Reset the whole object
378  virtual void Reset(void);
379 
380 
381 private:
382  // Prohibit copy constructor and assignment operator
385 
386  // data
387  Uint4 m_set_State[1];
388  int m_Year;
389  int m_Month;
390  int m_Day;
391  string m_Season;
392  int m_Hour;
393  int m_Minute;
394  int m_Second;
395 };
396 
397 /* @} */
398 
399 
400 
401 
402 
403 ///////////////////////////////////////////////////////////
404 ///////////////////// inline methods //////////////////////
405 ///////////////////////////////////////////////////////////
406 inline
408 {
409  return ((m_set_State[0] & 0x3) != 0);
410 }
411 
412 inline
414 {
415  return IsSetYear();
416 }
417 
418 inline
420 {
421  m_Year = 0;
422  m_set_State[0] &= ~0x3;
423 }
424 
425 inline
427 {
428  if (!CanGetYear()) {
429  ThrowUnassigned(0);
430  }
431  return m_Year;
432 }
433 
434 inline
436 {
437  m_Year = value;
438  m_set_State[0] |= 0x3;
439 }
440 
441 inline
443 {
444 #ifdef _DEBUG
445  if (!IsSetYear()) {
446  memset(&m_Year,UnassignedByte(),sizeof(m_Year));
447  }
448 #endif
449  m_set_State[0] |= 0x1;
450  return m_Year;
451 }
452 
453 inline
455 {
456  return ((m_set_State[0] & 0xc) != 0);
457 }
458 
459 inline
461 {
462  return IsSetMonth();
463 }
464 
465 inline
467 {
468  m_Month = 0;
469  m_set_State[0] &= ~0xc;
470 }
471 
472 inline
474 {
475  if (!CanGetMonth()) {
476  ThrowUnassigned(1);
477  }
478  return m_Month;
479 }
480 
481 inline
483 {
484  m_Month = value;
485  m_set_State[0] |= 0xc;
486 }
487 
488 inline
490 {
491 #ifdef _DEBUG
492  if (!IsSetMonth()) {
493  memset(&m_Month,UnassignedByte(),sizeof(m_Month));
494  }
495 #endif
496  m_set_State[0] |= 0x4;
497  return m_Month;
498 }
499 
500 inline
501 bool CDate_std_Base::IsSetDay(void) const
502 {
503  return ((m_set_State[0] & 0x30) != 0);
504 }
505 
506 inline
508 {
509  return IsSetDay();
510 }
511 
512 inline
514 {
515  m_Day = 0;
516  m_set_State[0] &= ~0x30;
517 }
518 
519 inline
521 {
522  if (!CanGetDay()) {
523  ThrowUnassigned(2);
524  }
525  return m_Day;
526 }
527 
528 inline
530 {
531  m_Day = value;
532  m_set_State[0] |= 0x30;
533 }
534 
535 inline
537 {
538 #ifdef _DEBUG
539  if (!IsSetDay()) {
540  memset(&m_Day,UnassignedByte(),sizeof(m_Day));
541  }
542 #endif
543  m_set_State[0] |= 0x10;
544  return m_Day;
545 }
546 
547 inline
549 {
550  return ((m_set_State[0] & 0xc0) != 0);
551 }
552 
553 inline
555 {
556  return IsSetSeason();
557 }
558 
559 inline
561 {
562  if (!CanGetSeason()) {
563  ThrowUnassigned(3);
564  }
565  return m_Season;
566 }
567 
568 inline
570 {
571  m_Season = value;
572  m_set_State[0] |= 0xc0;
573 }
574 
575 inline
577 {
578  m_Season = std::forward<CDate_std_Base::TSeason>(value);
579  m_set_State[0] |= 0xc0;
580 }
581 
582 inline
584 {
585 #ifdef _DEBUG
586  if (!IsSetSeason()) {
588  }
589 #endif
590  m_set_State[0] |= 0x40;
591  return m_Season;
592 }
593 
594 inline
596 {
597  return ((m_set_State[0] & 0x300) != 0);
598 }
599 
600 inline
602 {
603  return IsSetHour();
604 }
605 
606 inline
608 {
609  m_Hour = 0;
610  m_set_State[0] &= ~0x300;
611 }
612 
613 inline
615 {
616  if (!CanGetHour()) {
617  ThrowUnassigned(4);
618  }
619  return m_Hour;
620 }
621 
622 inline
624 {
625  m_Hour = value;
626  m_set_State[0] |= 0x300;
627 }
628 
629 inline
631 {
632 #ifdef _DEBUG
633  if (!IsSetHour()) {
634  memset(&m_Hour,UnassignedByte(),sizeof(m_Hour));
635  }
636 #endif
637  m_set_State[0] |= 0x100;
638  return m_Hour;
639 }
640 
641 inline
643 {
644  return ((m_set_State[0] & 0xc00) != 0);
645 }
646 
647 inline
649 {
650  return IsSetMinute();
651 }
652 
653 inline
655 {
656  m_Minute = 0;
657  m_set_State[0] &= ~0xc00;
658 }
659 
660 inline
662 {
663  if (!CanGetMinute()) {
664  ThrowUnassigned(5);
665  }
666  return m_Minute;
667 }
668 
669 inline
671 {
672  m_Minute = value;
673  m_set_State[0] |= 0xc00;
674 }
675 
676 inline
678 {
679 #ifdef _DEBUG
680  if (!IsSetMinute()) {
681  memset(&m_Minute,UnassignedByte(),sizeof(m_Minute));
682  }
683 #endif
684  m_set_State[0] |= 0x400;
685  return m_Minute;
686 }
687 
688 inline
690 {
691  return ((m_set_State[0] & 0x3000) != 0);
692 }
693 
694 inline
696 {
697  return IsSetSecond();
698 }
699 
700 inline
702 {
703  m_Second = 0;
704  m_set_State[0] &= ~0x3000;
705 }
706 
707 inline
709 {
710  if (!CanGetSecond()) {
711  ThrowUnassigned(6);
712  }
713  return m_Second;
714 }
715 
716 inline
718 {
719  m_Second = value;
720  m_set_State[0] |= 0x3000;
721 }
722 
723 inline
725 {
726 #ifdef _DEBUG
727  if (!IsSetSecond()) {
728  memset(&m_Second,UnassignedByte(),sizeof(m_Second));
729  }
730 #endif
731  m_set_State[0] |= 0x1000;
732  return m_Second;
733 }
734 
735 ///////////////////////////////////////////////////////////
736 ////////////////// end of inline methods //////////////////
737 ///////////////////////////////////////////////////////////
738 
739 
740 
741 
742 
743 END_objects_SCOPE // namespace ncbi::objects::
744 
746 
747 
748 #endif // OBJECTS_GENERAL_DATE_STD_BASE_HPP
NOTE: this is NOT a unix tm struct.
Definition: Date_std_.hpp:74
Base class for all serializable objects.
Definition: serialbase.hpp:150
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_GENERAL_EXPORT
Definition: ncbi_export.h:512
TMinute GetMinute(void) const
Get the Minute member data.
Definition: Date_std_.hpp:661
bool IsSetYear(void) const
full year (including 1900) Check if a value has been assigned to Year data member.
Definition: Date_std_.hpp:407
CDate_std_Base(const CDate_std_Base &)
TMinute & SetMinute(void)
Assign a value to Minute data member.
Definition: Date_std_.hpp:677
TSeason & SetSeason(void)
Assign a value to Season data member.
Definition: Date_std_.hpp:583
TSecond GetSecond(void) const
Get the Second member data.
Definition: Date_std_.hpp:708
TMonth & SetMonth(void)
Assign a value to Month data member.
Definition: Date_std_.hpp:489
void ResetHour(void)
Reset Hour data member.
Definition: Date_std_.hpp:607
const TSeason & GetSeason(void) const
Get the Season member data.
Definition: Date_std_.hpp:560
THour GetHour(void) const
Get the Hour member data.
Definition: Date_std_.hpp:614
Uint4 m_set_State[1]
Definition: Date_std_.hpp:387
bool CanGetHour(void) const
Check if it is safe to call GetHour method.
Definition: Date_std_.hpp:601
bool CanGetDay(void) const
Check if it is safe to call GetDay method.
Definition: Date_std_.hpp:507
bool IsSetDay(void) const
day of month (1-31) Check if a value has been assigned to Day data member.
Definition: Date_std_.hpp:501
CDate_std_Base & operator=(const CDate_std_Base &)
Tparent::CMemberIndex< E_memberIndex, 8 > TmemberIndex
Definition: Date_std_.hpp:105
void ResetMonth(void)
Reset Month data member.
Definition: Date_std_.hpp:466
CSerialObject Tparent
Definition: Date_std_.hpp:75
bool CanGetSecond(void) const
Check if it is safe to call GetSecond method.
Definition: Date_std_.hpp:695
void ResetDay(void)
Reset Day data member.
Definition: Date_std_.hpp:513
void ResetSecond(void)
Reset Second data member.
Definition: Date_std_.hpp:701
bool CanGetSeason(void) const
Check if it is safe to call GetSeason method.
Definition: Date_std_.hpp:554
bool IsSetMinute(void) const
minute of hour (0-59) Check if a value has been assigned to Minute data member.
Definition: Date_std_.hpp:642
bool CanGetMinute(void) const
Check if it is safe to call GetMinute method.
Definition: Date_std_.hpp:648
bool IsSetHour(void) const
hour of day (0-23) Check if a value has been assigned to Hour data member.
Definition: Date_std_.hpp:595
void ResetMinute(void)
Reset Minute data member.
Definition: Date_std_.hpp:654
bool IsSetSeason(void) const
for "spring", "may-june", etc Check if a value has been assigned to Season data member.
Definition: Date_std_.hpp:548
TYear & SetYear(void)
Assign a value to Year data member.
Definition: Date_std_.hpp:442
bool IsSetMonth(void) const
month (1-12) Check if a value has been assigned to Month data member.
Definition: Date_std_.hpp:454
TYear GetYear(void) const
Get the Year member data.
Definition: Date_std_.hpp:426
TMonth GetMonth(void) const
Get the Month member data.
Definition: Date_std_.hpp:473
TDay & SetDay(void)
Assign a value to Day data member.
Definition: Date_std_.hpp:536
TDay GetDay(void) const
Get the Day member data.
Definition: Date_std_.hpp:520
bool IsSetSecond(void) const
second of minute (0-59) Check if a value has been assigned to Second data member.
Definition: Date_std_.hpp:689
string TSeason
Definition: Date_std_.hpp:89
bool CanGetYear(void) const
Check if it is safe to call GetYear method.
Definition: Date_std_.hpp:413
void ResetYear(void)
Reset Year data member.
Definition: Date_std_.hpp:419
TSecond & SetSecond(void)
Assign a value to Second data member.
Definition: Date_std_.hpp:724
THour & SetHour(void)
Assign a value to Hour data member.
Definition: Date_std_.hpp:630
DECLARE_INTERNAL_TYPE_INFO()
bool CanGetMonth(void) const
Check if it is safe to call GetMonth method.
Definition: Date_std_.hpp:460
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Fri Sep 20 14:57:28 2024 by modify_doxy.py rev. 669887