NCBI C++ ToolKit
SubSource_.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 SubSource_.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/seqfeat/seqfeat.asn">seqfeat.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/seqfeat/seqfeat.def">seqfeat.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_SEQFEAT_SUBSOURCE_BASE_HPP
42 #define OBJECTS_SEQFEAT_SUBSOURCE_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_BioSource
63  *
64  * @{
65  */
66 
67 /////////////////////////////////////////////////////////////////////////////
68 ///
69 /// CSubSource_Base --
70 ///
71 
73 {
75 public:
76  // constructor
77  CSubSource_Base(void);
78  // destructor
79  virtual ~CSubSource_Base(void);
80 
81  // type info
83 
84  enum ESubtype {
85  eSubtype_chromosome = 1,
86  eSubtype_map = 2,
87  eSubtype_clone = 3,
88  eSubtype_subclone = 4,
89  eSubtype_haplotype = 5,
90  eSubtype_genotype = 6,
91  eSubtype_sex = 7,
92  eSubtype_cell_line = 8,
93  eSubtype_cell_type = 9,
94  eSubtype_tissue_type = 10,
95  eSubtype_clone_lib = 11,
96  eSubtype_dev_stage = 12,
97  eSubtype_frequency = 13,
98  eSubtype_germline = 14,
99  eSubtype_rearranged = 15,
100  eSubtype_lab_host = 16,
101  eSubtype_pop_variant = 17,
102  eSubtype_tissue_lib = 18,
103  eSubtype_plasmid_name = 19,
104  eSubtype_transposon_name = 20,
105  eSubtype_insertion_seq_name = 21,
106  eSubtype_plastid_name = 22,
107  eSubtype_country = 23,
108  eSubtype_segment = 24,
109  eSubtype_endogenous_virus_name = 25,
110  eSubtype_transgenic = 26,
111  eSubtype_environmental_sample = 27,
112  eSubtype_isolation_source = 28,
113  eSubtype_lat_lon = 29, ///< +/- decimal degrees
114  eSubtype_collection_date = 30, ///< DD-MMM-YYYY format
115  eSubtype_collected_by = 31, ///< name of person who collected the sample
116  eSubtype_identified_by = 32, ///< name of person who identified the sample
117  eSubtype_fwd_primer_seq = 33, ///< sequence (possibly more than one; semicolon-separated)
118  eSubtype_rev_primer_seq = 34, ///< sequence (possibly more than one; semicolon-separated)
119  eSubtype_fwd_primer_name = 35,
120  eSubtype_rev_primer_name = 36,
121  eSubtype_metagenomic = 37,
122  eSubtype_mating_type = 38,
123  eSubtype_linkage_group = 39,
124  eSubtype_haplogroup = 40,
125  eSubtype_whole_replicon = 41,
126  eSubtype_phenotype = 42,
127  eSubtype_altitude = 43,
128  eSubtype_other = 255
129  };
130 
131  /// Access to ESubtype's attributes (values, names) as defined in spec
132  static const NCBI_NS_NCBI::CEnumeratedTypeValues* ENUM_METHOD_NAME(ESubtype)(void);
133 
134  // types
135  typedef int TSubtype;
136  typedef string TName;
137  typedef string TAttrib;
138 
139  // member index
140  enum class E_memberIndex {
141  e__allMandatory = 0,
142  e_subtype,
143  e_name,
144  e_attrib
145  };
147 
148  // getters
149  // setters
150 
151  /// Check if a value has been assigned to Subtype data member.
152  ///
153  /// Data member Subtype is mandatory;
154  /// its type is defined as 'typedef int TSubtype'
155  /// @return
156  /// - true, if a value has been assigned.
157  /// - false, otherwise.
158  bool IsSetSubtype(void) const;
159 
160  /// Check if it is safe to call GetSubtype method.
161  ///
162  /// @return
163  /// - true, if the data member is getatable.
164  /// - false, otherwise.
165  bool CanGetSubtype(void) const;
166 
167  /// Reset Subtype data member.
168  void ResetSubtype(void);
169 
170  /// Get the Subtype member data.
171  ///
172  /// @return
173  /// Copy of the member data.
174  TSubtype GetSubtype(void) const;
175 
176  /// Assign a value to Subtype data member.
177  ///
178  /// @param value
179  /// Value to assign
180  void SetSubtype(TSubtype value);
181 
182  /// Assign a value to Subtype data member.
183  ///
184  /// @return
185  /// Reference to the data value.
186  TSubtype& SetSubtype(void);
187 
188  /// Check if a value has been assigned to Name data member.
189  ///
190  /// Data member Name is mandatory;
191  /// its type is defined as 'typedef string TName'
192  /// @return
193  /// - true, if a value has been assigned.
194  /// - false, otherwise.
195  bool IsSetName(void) const;
196 
197  /// Check if it is safe to call GetName method.
198  ///
199  /// @return
200  /// - true, if the data member is getatable.
201  /// - false, otherwise.
202  bool CanGetName(void) const;
203 
204  /// Reset Name data member.
205  void ResetName(void);
206 
207  /// Get the Name member data.
208  ///
209  /// @return
210  /// Reference to the member data.
211  const TName& GetName(void) const;
212 
213  /// Assign a value to Name data member.
214  ///
215  /// @param value
216  /// Value to assign
217  void SetName(const TName& value);
218  void SetName(TName&& value);
219 
220  /// Assign a value to Name data member.
221  ///
222  /// @return
223  /// Reference to the data value.
224  TName& SetName(void);
225 
226  /// attribution/source of this name
227  /// Check if a value has been assigned to Attrib data member.
228  ///
229  /// Data member Attrib is optional;
230  /// its type is defined as 'typedef string TAttrib'
231  /// @return
232  /// - true, if a value has been assigned.
233  /// - false, otherwise.
234  bool IsSetAttrib(void) const;
235 
236  /// Check if it is safe to call GetAttrib method.
237  ///
238  /// @return
239  /// - true, if the data member is getatable.
240  /// - false, otherwise.
241  bool CanGetAttrib(void) const;
242 
243  /// Reset Attrib data member.
244  void ResetAttrib(void);
245 
246  /// Get the Attrib member data.
247  ///
248  /// @return
249  /// Reference to the member data.
250  const TAttrib& GetAttrib(void) const;
251 
252  /// Assign a value to Attrib data member.
253  ///
254  /// @param value
255  /// Value to assign
256  void SetAttrib(const TAttrib& value);
257  void SetAttrib(TAttrib&& value);
258 
259  /// Assign a value to Attrib data member.
260  ///
261  /// @return
262  /// Reference to the data value.
263  TAttrib& SetAttrib(void);
264 
265  /// Reset the whole object
266  virtual void Reset(void);
267 
268 
269 private:
270  // Prohibit copy constructor and assignment operator
273 
274  // data
275  Uint4 m_set_State[1];
277  string m_Name;
278  string m_Attrib;
279 };
280 
281 /* @} */
282 
283 
284 
285 
286 
287 ///////////////////////////////////////////////////////////
288 ///////////////////// inline methods //////////////////////
289 ///////////////////////////////////////////////////////////
290 inline
292 {
293  return ((m_set_State[0] & 0x3) != 0);
294 }
295 
296 inline
298 {
299  return IsSetSubtype();
300 }
301 
302 inline
304 {
305  m_Subtype = (ESubtype)(0);
306  m_set_State[0] &= ~0x3;
307 }
308 
309 inline
311 {
312  if (!CanGetSubtype()) {
313  ThrowUnassigned(0);
314  }
315  return m_Subtype;
316 }
317 
318 inline
320 {
321  m_Subtype = value;
322  m_set_State[0] |= 0x3;
323 }
324 
325 inline
327 {
328 #ifdef _DEBUG
329  if (!IsSetSubtype()) {
330  memset(&m_Subtype,UnassignedByte(),sizeof(m_Subtype));
331  }
332 #endif
333  m_set_State[0] |= 0x1;
334  return m_Subtype;
335 }
336 
337 inline
339 {
340  return ((m_set_State[0] & 0xc) != 0);
341 }
342 
343 inline
345 {
346  return IsSetName();
347 }
348 
349 inline
351 {
352  if (!CanGetName()) {
353  ThrowUnassigned(1);
354  }
355  return m_Name;
356 }
357 
358 inline
360 {
361  m_Name = value;
362  m_set_State[0] |= 0xc;
363 }
364 
365 inline
367 {
368  m_Name = std::forward<CSubSource_Base::TName>(value);
369  m_set_State[0] |= 0xc;
370 }
371 
372 inline
374 {
375 #ifdef _DEBUG
376  if (!IsSetName()) {
378  }
379 #endif
380  m_set_State[0] |= 0x4;
381  return m_Name;
382 }
383 
384 inline
386 {
387  return ((m_set_State[0] & 0x30) != 0);
388 }
389 
390 inline
392 {
393  return IsSetAttrib();
394 }
395 
396 inline
398 {
399  if (!CanGetAttrib()) {
400  ThrowUnassigned(2);
401  }
402  return m_Attrib;
403 }
404 
405 inline
407 {
408  m_Attrib = value;
409  m_set_State[0] |= 0x30;
410 }
411 
412 inline
414 {
415  m_Attrib = std::forward<CSubSource_Base::TAttrib>(value);
416  m_set_State[0] |= 0x30;
417 }
418 
419 inline
421 {
422 #ifdef _DEBUG
423  if (!IsSetAttrib()) {
425  }
426 #endif
427  m_set_State[0] |= 0x10;
428  return m_Attrib;
429 }
430 
431 ///////////////////////////////////////////////////////////
432 ////////////////// end of inline methods //////////////////
433 ///////////////////////////////////////////////////////////
434 
435 
436 
437 
438 
439 END_objects_SCOPE // namespace ncbi::objects::
440 
442 
443 
444 #endif // OBJECTS_SEQFEAT_SUBSOURCE_BASE_HPP
Base class for all serializable objects.
Definition: serialbase.hpp:150
CSubSource_Base –.
Definition: SubSource_.hpp:73
int GetSubtype(CFieldNamePanel *field_name_panel, string &ncRNA_class)
static char UnassignedByte(void)
Definition: serialbase.hpp:181
void ThrowUnassigned(TMemberIndex index) const
#define ENUM_METHOD_NAME(EnumName)
Definition: serialbase.hpp:994
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_SEQFEAT_EXPORT
Definition: ncbi_export.h:768
TSubtype & SetSubtype(void)
Assign a value to Subtype data member.
Definition: SubSource_.hpp:326
const TAttrib & GetAttrib(void) const
Get the Attrib member data.
Definition: SubSource_.hpp:397
TSubtype GetSubtype(void) const
Get the Subtype member data.
Definition: SubSource_.hpp:310
CSerialObject Tparent
Definition: SubSource_.hpp:74
bool IsSetSubtype(void) const
Check if a value has been assigned to Subtype data member.
Definition: SubSource_.hpp:291
bool CanGetName(void) const
Check if it is safe to call GetName method.
Definition: SubSource_.hpp:344
TName & SetName(void)
Assign a value to Name data member.
Definition: SubSource_.hpp:373
bool CanGetSubtype(void) const
Check if it is safe to call GetSubtype method.
Definition: SubSource_.hpp:297
const TName & GetName(void) const
Get the Name member data.
Definition: SubSource_.hpp:350
bool IsSetAttrib(void) const
attribution/source of this name Check if a value has been assigned to Attrib data member.
Definition: SubSource_.hpp:385
Tparent::CMemberIndex< E_memberIndex, 4 > TmemberIndex
Definition: SubSource_.hpp:146
Uint4 m_set_State[1]
Definition: SubSource_.hpp:275
void ResetSubtype(void)
Reset Subtype data member.
Definition: SubSource_.hpp:303
bool IsSetName(void) const
Check if a value has been assigned to Name data member.
Definition: SubSource_.hpp:338
CSubSource_Base & operator=(const CSubSource_Base &)
bool CanGetAttrib(void) const
Check if it is safe to call GetAttrib method.
Definition: SubSource_.hpp:391
CSubSource_Base(const CSubSource_Base &)
TAttrib & SetAttrib(void)
Assign a value to Attrib data member.
Definition: SubSource_.hpp:420
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Wed Sep 04 14:58:36 2024 by modify_doxy.py rev. 669887