NCBI C++ ToolKit
Source_qual_choice.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: Source_qual_choice.cpp 63087 2014-05-28 13:24:42Z chenj $
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  * Author: J. Chen
27  *
28  * File Description:
29  * Get source qual value from BioSource
30  *
31  * Remark:
32  * This code was originally generated by application DATATOOL
33  * using the following specifications:
34  * 'macro.asn'.
35  */
36 
37 // standard includes
38 #include <ncbi_pch.hpp>
39 
40 // generated includes
42 
43 // generated classes
44 
46 
47 BEGIN_objects_SCOPE // namespace ncbi::objects::
48 
49 // destructor
51 {
52 }
53 
55 {
56  switch (src_qual) {
60  case eSource_qual_clone:
79  case eSource_qual_map:
88  case eSource_qual_sex:
99  return true;
100  default: return false;
101  }
102 };
103 
105 {
106  string str;
107  switch (Which()) {
108  case e_Location:
109  {
110  str = CBioSource::ENUM_METHOD_NAME(EGenome)()
111  ->FindName((CBioSource::EGenome)biosrc.GetGenome(), false);
112  if (str == "unknown") {
113  str = kEmptyStr;
114  }
115  else if (str == "extrachrom") {
116  str = "extrachromosomal";
117  }
118  if (!str_cons.Match (str)) {
119  str = kEmptyStr;
120  }
121  break;
122  }
123  case e_Origin:
124  {
125  str = CBioSource::ENUM_METHOD_NAME(EOrigin)()
126  ->FindName((CBioSource::EOrigin)biosrc.GetOrigin(), false);
127  if (!str_cons.Match(str)) {
128  str = kEmptyStr;
129  }
130  break;
131  }
132  case e_Gcode:
133  if (biosrc.IsSetGcode() && biosrc.GetGcode()) {
134  str = NStr::IntToString(biosrc.GetGcode());
135  }
136  break;
137  case e_Mgcode:
138  if (biosrc.IsSetMgcode() && biosrc.GetMgcode()) {
139  str = NStr::IntToString(biosrc.GetMgcode());
140  }
141  break;
142  default: break;
143  }
144  return str;
145 };
146 
147 END_objects_SCOPE // namespace ncbi::objects::
148 
150 
151 /* Original file checksum: lines: 57, chars: 1747, CRC32: 9261c344 */
User-defined methods of the data storage class.
bool IsSetGcode(void) const
Definition: BioSource.cpp:365
int GetGcode(void) const
Definition: BioSource.cpp:370
bool IsSetMgcode(void) const
Definition: BioSource.cpp:375
int GetMgcode(void) const
Definition: BioSource.cpp:380
bool IsSubsrcQual(ESource_qual src_qual) const
string GetLimitedSourceQualFromBioSource(const CBioSource &biosrc, const CString_constraint &str_cons) const
bool Match(const CMatchString &str) const
static const char * str(char *buf, int n)
Definition: stats.c:84
#define ENUM_METHOD_NAME(EnumName)
Definition: serialbase.hpp:994
#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 kEmptyStr
Definition: ncbistr.hpp:123
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
Definition: ncbistr.hpp:5084
TGenome GetGenome(void) const
Get the Genome member data.
Definition: BioSource_.hpp:422
TOrigin GetOrigin(void) const
Get the Origin member data.
Definition: BioSource_.hpp:472
EGenome
biological context
Definition: BioSource_.hpp:97
ESource_qual
Access to ESource_qual's attributes (values, names) as defined in spec.
E_Choice Which(void) const
Which variant is currently selected.
@ eSource_qual_cell_line
@ eSource_qual_metagenomic
@ eSource_qual_dev_stage
@ eSource_qual_fwd_primer_seq
@ eSource_qual_plasmid_name
@ eSource_qual_clone_lib
@ eSource_qual_genotype
@ eSource_qual_mating_type
@ eSource_qual_collected_by
@ eSource_qual_haplogroup
@ eSource_qual_country
@ eSource_qual_altitude
@ eSource_qual_map
@ eSource_qual_rearranged
@ eSource_qual_linkage_group
@ eSource_qual_fwd_primer_name
@ eSource_qual_subsource_note
@ eSource_qual_sex
@ eSource_qual_plastid_name
@ eSource_qual_frequency
@ eSource_qual_identified_by
@ eSource_qual_tissue_type
@ eSource_qual_transgenic
@ eSource_qual_rev_primer_name
@ eSource_qual_collection_date
@ eSource_qual_endogenous_virus_name
@ eSource_qual_lab_host
@ eSource_qual_subclone
@ eSource_qual_haplotype
@ eSource_qual_lat_lon
@ eSource_qual_cell_type
@ eSource_qual_clone
@ eSource_qual_pop_variant
@ eSource_qual_germline
@ eSource_qual_rev_primer_seq
@ eSource_qual_chromosome
@ eSource_qual_environmental_sample
@ eSource_qual_segment
@ eSource_qual_insertion_seq_name
@ eSource_qual_transposon_name
@ eSource_qual_tissue_lib
@ eSource_qual_isolation_source
Modified on Mon May 27 04:40:38 2024 by modify_doxy.py rev. 669887