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

Go to the SVN repository for this file.

1 /* $Id: MolInfo.cpp 64159 2014-08-22 16:24:25Z vasilche $
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: .......
27  *
28  * File Description:
29  * .......
30  *
31  * Remark:
32  * This code was originally generated by application DATATOOL
33  * using specifications from the ASN data definition file
34  * 'seq.asn'.
35  */
36 
37 // standard includes
38 #include <ncbi_pch.hpp>
39 #include <serial/enumvalues.hpp>
40 
41 // generated includes
42 #include <objects/seq/MolInfo.hpp>
43 #include <util/static_map.hpp>
44 
45 // generated classes
46 
48 
49 BEGIN_objects_SCOPE // namespace ncbi::objects::
50 
51 // destructor
53 {
54 }
55 
56 void CMolInfo::GetLabel(string* label) const
57 {
58  // ensure label not null
59  if (!label) {
60  return;
61  }
62 
63  // build label
64  const CEnumeratedTypeValues* tv;
65  string sep = label->empty() ? "" : ",";
66  if (IsSetBiomol()) {
67  TBiomol biomol = GetBiomol();
68  tv = GetTypeInfo_enum_EBiomol();
69  (*label) += sep + tv->FindName(biomol, true);
70  sep = ",";
71  }
72  if (IsSetTech()) {
73  TTech tech = GetTech();
74  tv = GetTypeInfo_enum_ETech();
75  (*label) += sep + tv->FindName(tech, true);
76  sep = ",";
77  }
78  if (IsSetTechexp()) {
79  (*label) += sep + GetTechexp();
80  sep = ",";
81  }
82  if (IsSetCompleteness()) {
84  tv = GetTypeInfo_enum_ECompleteness();
85  (*label) += sep + tv->FindName(comp, true);
86  }
87 }
88 
89 
91 
92 static const TBiomolKey biomol_key_to_subtype [] = {
93  { " ", CMolInfo::eBiomol_unknown } ,
94  { "cRNA", CMolInfo::eBiomol_cRNA },
95  { "genomic", CMolInfo::eBiomol_genomic } ,
96  { "genomic mRNA", CMolInfo::eBiomol_genomic_mRNA } ,
97  { "mRNA [cDNA]", CMolInfo::eBiomol_mRNA } ,
98  { "ncRNA", CMolInfo::eBiomol_ncRNA } ,
99  { "other", CMolInfo::eBiomol_other } ,
100  { "other-genetic", CMolInfo::eBiomol_other_genetic } ,
101  { "peptide", CMolInfo::eBiomol_peptide } ,
102  { "precursor RNA", CMolInfo::eBiomol_pre_RNA } ,
103  { "rRNA", CMolInfo::eBiomol_rRNA } ,
104  { "scRNA", CMolInfo::eBiomol_scRNA } ,
105  { "snoRNA", CMolInfo::eBiomol_snoRNA } ,
106  { "snRNA", CMolInfo::eBiomol_snRNA } ,
107  { "tmRNA", CMolInfo::eBiomol_tmRNA } ,
108  { "transcribed RNA", CMolInfo::eBiomol_transcribed_RNA } ,
109  { "tRNA", CMolInfo::eBiomol_tRNA } ,
110 };
111 
114 
115 
117 {
118  string biomol_name = "";
119  TBiomolMap::const_iterator g_iter = sm_BiomolKeys.begin();
120  while (g_iter != sm_BiomolKeys.end() &&
121  g_iter->second != biomol) {
122  ++g_iter;
123  }
124  if (g_iter != sm_BiomolKeys.end()) {
125  biomol_name = g_iter->first;
126  }
127  return biomol_name;
128 }
129 
130 
131 END_objects_SCOPE // namespace ncbi::objects::
132 
134 
135 /* Original file checksum: lines: 64, chars: 1873, CRC32: ae3bbfec */
SStaticPair< const char *, CMolInfo::EBiomol > TBiomolKey
Definition: MolInfo.cpp:90
DEFINE_STATIC_ARRAY_MAP(TBiomolMap, sm_BiomolKeys, biomol_key_to_subtype)
CStaticPairArrayMap< const char *, CMolInfo::EBiomol, PNocase_CStr > TBiomolMap
Definition: MolInfo.cpp:112
static const TBiomolKey biomol_key_to_subtype[]
Definition: MolInfo.cpp:92
void GetLabel(string *label) const
Definition: MolInfo.cpp:56
~CMolInfo(void)
Definition: MolInfo.cpp:52
static string GetBiomolName(CMolInfo::TBiomol biomol)
Definition: MolInfo.cpp:116
class CStaticArrayMap<> is an array adaptor that provides an STLish interface to statically-defined a...
Definition: static_map.hpp:105
TBase::const_iterator const_iterator
Definition: static_map.hpp:109
const string & FindName(TEnumValueType value, bool allowBadValue) const
Find name of the enum by its numeric value.
Definition: enumerated.cpp:146
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static const char label[]
bool IsSetCompleteness(void) const
Check if a value has been assigned to Completeness data member.
Definition: MolInfo_.hpp:569
bool IsSetTechexp(void) const
explanation if tech not enough
Definition: MolInfo_.hpp:522
bool IsSetBiomol(void) const
Check if a value has been assigned to Biomol data member.
Definition: MolInfo_.hpp:422
TTech GetTech(void) const
Get the Tech member data.
Definition: MolInfo_.hpp:497
const TTechexp & GetTechexp(void) const
Get the Techexp member data.
Definition: MolInfo_.hpp:534
TBiomol GetBiomol(void) const
Get the Biomol member data.
Definition: MolInfo_.hpp:447
bool IsSetTech(void) const
Check if a value has been assigned to Tech data member.
Definition: MolInfo_.hpp:472
TCompleteness GetCompleteness(void) const
Get the Completeness member data.
Definition: MolInfo_.hpp:594
@ eBiomol_pre_RNA
precursor RNA of any sort really
Definition: MolInfo_.hpp:102
@ eBiomol_cRNA
viral RNA genome copy intermediate
Definition: MolInfo_.hpp:111
@ eBiomol_snoRNA
small nucleolar RNA
Definition: MolInfo_.hpp:112
@ eBiomol_genomic_mRNA
reported a mix of genomic and cdna sequence
Definition: MolInfo_.hpp:110
@ eBiomol_transcribed_RNA
transcribed RNA other than existing classes
Definition: MolInfo_.hpp:113
@ eBiomol_other_genetic
other genetic material
Definition: MolInfo_.hpp:109
Template structure SStaticPair is simlified replacement of STL pair<> Main reason of introducing this...
Definition: static_set.hpp:60
Modified on Fri Apr 12 17:14:50 2024 by modify_doxy.py rev. 669887