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

Go to the SVN repository for this file.

1 /* $Id: Seqdesc.cpp 33815 2007-05-04 17:18:18Z kazimird $
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/general/Date.hpp>
46 #include <objects/seq/Seqdesc.hpp>
47 #include <objects/seq/MolInfo.hpp>
51 
52 // generated classes
53 
55 
56 BEGIN_objects_SCOPE // namespace ncbi::objects::
57 
58 // destructor
60 {
61 }
62 
63 
64 static void s_GetContentLabel(const CSeqdesc& desc, string* const label)
65 {
66  const CEnumeratedTypeValues* tv;
67  switch (desc.Which()) {
69  (*label) += desc.GetComment();
70  return;
71  case CSeqdesc::e_Region:
72  (*label) += desc.GetRegion();
73  return;
74  case CSeqdesc::e_Het:
75  (*label) += desc.GetHet();
76  return;
77  case CSeqdesc::e_Title:
78  (*label) += desc.GetTitle();
79  return;
80  case CSeqdesc::e_Name:
81  (*label) += desc.GetName();
82  return;
84  desc.GetCreate_date().GetDate(label);
85  return;
87  desc.GetUpdate_date().GetDate(label);
88  return;
89  case CSeqdesc::e_Org:
90  desc.GetOrg().GetLabel(label);
91  return;
92  case CSeqdesc::e_Pub:
93  desc.GetPub().GetPub().GetLabel(label);
94  return;
95  case CSeqdesc::e_User:
96  desc.GetUser().GetLabel(label);
97  return;
98  case CSeqdesc::e_Method:
99  tv = GetTypeInfo_enum_EGIBB_method();
100  (*label) += tv->FindName(desc.GetMethod(), true);
101  return;
103  tv = GetTypeInfo_enum_EGIBB_mol();
104  (*label) += tv->FindName(desc.GetMol_type(), true);
105  return;
106  case CSeqdesc::e_Modif:
107  ITERATE(list<EGIBB_mod>, it, desc.GetModif()) {
108  tv = GetTypeInfo_enum_EGIBB_mod();
109  if (!label->empty()) {
110  (*label) += string(",") + tv->FindName(*it, true);
111  } else {
112  (*label) += tv->FindName(*it, true);
113  }
114  }
115  return;
116  case CSeqdesc::e_Source:
117  desc.GetSource().GetOrg().GetLabel(label);
118  return;
119  case CSeqdesc::e_Maploc:
120  desc.GetMaploc().GetLabel(label);
121  return;
122  case CSeqdesc::e_Molinfo:
123  desc.GetMolinfo().GetLabel(label);
124  return;
125  case CSeqdesc::e_Dbxref:
126  desc.GetDbxref().GetLabel(label);
127  return;
128  default:
129  return;
130  }
131 }
132 
133 
134 void CSeqdesc::GetLabel(string* const label, ELabelType label_type) const
135 {
136  // Return if label is null
137  if (!label) {
138  return;
139  }
140 
141  // Get type name for choice of this CSeqdesc object
142  string name = SelectionName(Which());
143 
144  // Append label based on label_type
145  switch (label_type) {
146  case eBoth:
147  (*label) += name + ": ";
148  case eContent:
149  s_GetContentLabel(*this, label);
150  return;
151  case eType:
152  (*label) += name;
153  return;
154  }
155 }
156 
157 
158 END_objects_SCOPE // namespace ncbi::objects::
159 
161 
162 /* Original file checksum: lines: 64, chars: 1873, CRC32: d5933a71 */
const string & FindName(TEnumValueType value, bool allowBadValue) const
Find name of the enum by its numeric value.
Definition: enumerated.cpp:132
void GetLabel(string *label) const
Definition: Org_ref.cpp:57
void GetLabel(string *const label, ELabelType label_type) const
Definition: Seqdesc.cpp:134
if all from one organism
Definition: Seqdesc_.hpp:116
cofactor, etc associated but not bound
Definition: Seqdesc_.hpp:132
const TSource & GetSource(void) const
Get the variant data.
Definition: Seqdesc_.cpp:566
const TName & GetName(void) const
Get the variant data.
Definition: Seqdesc_.hpp:1012
string
Definition: cgiapp.hpp:512
overall region (globin locus)
Definition: Seqdesc_.hpp:123
type of molecule
Definition: Seqdesc_.hpp:111
~CSeqdesc(void)
Definition: Seqdesc.cpp:59
date of last update
Definition: Seqdesc_.hpp:129
TMol_type GetMol_type(void) const
Get the variant data.
Definition: Seqdesc_.hpp:938
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:795
bool GetLabel(string *label, TLabelFlags flags=0, ELabelVersion version=eLabel_DefaultVersion) const
Append a label to "label" based on content.
Definition: Pub_equiv.cpp:56
const TModif & GetModif(void) const
Get the variant data.
Definition: Seqdesc_.hpp:965
const TPub & GetPub(void) const
Get the Pub member data.
Definition: Pubdesc_.hpp:600
const TMaploc & GetMaploc(void) const
Get the variant data.
Definition: Seqdesc_.cpp:290
const TPub & GetPub(void) const
Get the variant data.
Definition: Seqdesc_.cpp:356
a title for this sequence
Definition: Seqdesc_.hpp:115
E_Choice Which(void) const
Which variant is currently selected.
Definition: Seqdesc_.hpp:903
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:101
sequencing method
Definition: Seqdesc_.hpp:113
const TOrg & GetOrg(void) const
Get the variant data.
Definition: Seqdesc_.cpp:240
const TRegion & GetRegion(void) const
Get the variant data.
Definition: Seqdesc_.hpp:1108
void GetLabel(string *label) const
Definition: MolInfo.cpp:56
map location of this sequence
Definition: Seqdesc_.hpp:119
User-defined methods of the data storage class.
void GetLabel(string *label) const
Definition: Dbtag.cpp:328
const TTitle & GetTitle(void) const
Get the variant data.
Definition: Seqdesc_.hpp:1032
a reference to the publication
Definition: Seqdesc_.hpp:122
user defined object
Definition: Seqdesc_.hpp:124
static const char label[]
const TDbxref & GetDbxref(void) const
Get the variant data.
Definition: Seqdesc_.cpp:428
const TCreate_date & GetCreate_date(void) const
Get the variant data.
Definition: Seqdesc_.cpp:472
const THet & GetHet(void) const
Get the variant data.
Definition: Seqdesc_.hpp:1176
TMethod GetMethod(void) const
Get the variant data.
Definition: Seqdesc_.hpp:985
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: Seqdesc_.cpp:218
source of materials, includes Org-ref
Definition: Seqdesc_.hpp:133
void GetDate(string *label, bool year_only=false) const
Append a standardized string representation of the date to the label.
Definition: Date.hpp:149
info on the molecule and techniques
Definition: Seqdesc_.hpp:134
xref to other databases
Definition: Seqdesc_.hpp:126
a more extensive comment
Definition: Seqdesc_.hpp:117
date entry first created/released
Definition: Seqdesc_.hpp:128
static void s_GetContentLabel(const CSeqdesc &desc, string *const label)
Definition: Seqdesc.cpp:64
a name for this sequence
Definition: Seqdesc_.hpp:114
void GetLabel(string *label, ELabelContent mode=eContent) const
Append a label to label.
const TMolinfo & GetMolinfo(void) const
Get the variant data.
Definition: Seqdesc_.cpp:588
const TUpdate_date & GetUpdate_date(void) const
Get the variant data.
Definition: Seqdesc_.cpp:494
const TUser & GetUser(void) const
Get the variant data.
Definition: Seqdesc_.cpp:384
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:98
const TOrg & GetOrg(void) const
Get the Org member data.
Definition: BioSource_.hpp:509
const TComment & GetComment(void) const
Get the variant data.
Definition: Seqdesc_.hpp:1058
Modified on Sat Feb 24 14:01:39 2018 by modify_doxy.py rev. 546573