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

Go to the SVN repository for this file.

1 /* $Id: Seq_data.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 data definition file
34  * 'seq.asn'.
35  */
36 
37 // standard includes
38 
39 // generated includes
40 #include <ncbi_pch.hpp>
41 #include <objects/seq/Seq_data.hpp>
42 
43 // additional includes
44 #include <objects/seq/IUPACaa_.hpp>
45 #include <objects/seq/IUPACna.hpp>
46 #include <objects/seq/NCBI2na_.hpp>
47 #include <objects/seq/NCBI4na_.hpp>
48 #include <objects/seq/NCBI8aa_.hpp>
49 #include <objects/seq/NCBI8na_.hpp>
50 #include <objects/seq/NCBIeaa_.hpp>
51 #include <objects/seq/NCBIpaa_.hpp>
52 #include <objects/seq/NCBIpna_.hpp>
54 #include <corelib/ncbiexpt.hpp>
55 
56 // generated classes
57 
59 
60 BEGIN_objects_SCOPE // namespace ncbi::objects::
61 
62 // constructor
63 CSeq_data::CSeq_data(const string& value, E_Choice index)
64 {
65 
66 
67  // Does value have to be validated
68  // create seq type data holder
69  switch (index) {
70  case e_Iupacna:
71  case e_Iupacaa:
72  case e_Ncbieaa:
73  DoConstruct (value, index);
74  break;
75 
76  case e_Ncbi2na:
77  case e_Ncbi4na:
78  case e_Ncbi8na:
79  case e_Ncbipna:
80  case e_Ncbi8aa:
81  case e_Ncbipaa:
82  case e_Ncbistdaa:
83  {
84  vector< char > v;
85  v.resize (value.size());
86  memcpy(&v[0], value.c_str(), value.size());
87  DoConstruct (v, index);
88  break;
89  }
90  default:
91  // throw error
93  "CSeq_data constructor: Invalid E_Choice index");
94  }
95 }
96 
97 CSeq_data::CSeq_data(const vector< char >& value, E_Choice index)
98 {
99  // Does value have to be validated
100  // create seq type data holder
101  switch (index) {
102  case e_Iupacna:
103  case e_Iupacaa:
104  case e_Ncbieaa:
105  {
106  string s;
107  s.assign (&value[0], value.size());
108  DoConstruct (s, index);
109  break;
110  }
111  case e_Ncbi2na:
112  case e_Ncbi4na:
113  case e_Ncbi8na:
114  case e_Ncbipna:
115  case e_Ncbi8aa:
116  case e_Ncbipaa:
117  case e_Ncbistdaa:
118  DoConstruct (value, index);
119  break;
120 
121  default:
122  // throw error
124  "CSeq_data constructor: Invalid E_Choice index");
125  }
126 }
127 
128 // destructor
130 {
131 }
132 
133 void CSeq_data::DoConstruct(const string& value, E_Choice index)
134 {
135 
136  switch (index) {
137  case e_Iupacna:
138  SetIupacna() = CIUPACna(value);
139  break;
140  case e_Iupacaa:
141  SetIupacaa() = CIUPACaa(value);
142  break;
143  case e_Ncbieaa:
144  SetNcbieaa() = CNCBIeaa(value);
145  break;
146  default:
147  // throw an error
149  "CSeq_data::DoConstruct: Invalid E_Choice index");
150  }
151 }
152 
153 void CSeq_data::DoConstruct(const vector< char >& value, E_Choice index)
154 {
155  switch (index) {
156  case e_Ncbi2na:
157  SetNcbi2na().Set() = value;
158  break;
159  case e_Ncbi4na:
160  SetNcbi4na().Set() = value;
161  break;
162  case e_Ncbi8na:
163  SetNcbi8na().Set() = value;
164  break;
165  case e_Ncbipna:
166  SetNcbipna().Set() = value;
167  break;
168  case e_Ncbi8aa:
169  SetNcbi8aa().Set() = value;
170  break;
171  case e_Ncbipaa:
172  SetNcbipaa().Set() = value;
173  break;
174  case e_Ncbistdaa:
175  SetNcbistdaa().Set() = value;
176  break;
177  default:
178  // throw an error
180  "CSeq_data::DoConstruct: Invalid E_Choice index");
181  }
182 }
183 
184 END_objects_SCOPE // namespace ncbi::objects::
185 
187 
188 /* Original file checksum: lines: 64, chars: 1872, CRC32: 4f4e2fd */
TNcbipna & SetNcbipna(void)
Select the variant.
Definition: Seq_data_.hpp:617
TPrim & Set(void)
Definition: serialbase.hpp:310
CSeq_data(void)
Definition: Seq_data.hpp:79
TIupacna & SetIupacna(void)
Select the variant.
Definition: Seq_data_.hpp:517
TNcbistdaa & SetNcbistdaa(void)
Select the variant.
Definition: Seq_data_.hpp:697
~CSeq_data(void)
Definition: Seq_data.cpp:129
Data storage class.
TNcbi8na & SetNcbi8na(void)
Select the variant.
Definition: Seq_data_.hpp:597
CIUPACaa –.
Definition: IUPACaa.hpp:65
Data storage class.
Data storage class.
Defines NCBI C++ exception handling.
consecutive codes for std aas
Definition: Seq_data_.hpp:113
User-defined methods of the data storage class.
CNCBIeaa –.
Definition: NCBIeaa.hpp:65
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:101
IUPAC 1 letter nuc acid code.
Definition: Seq_data_.hpp:104
E_Choice
Choice variants.
Definition: Seq_data_.hpp:102
amino acid probabilities
Definition: Seq_data_.hpp:112
TNcbieaa & SetNcbieaa(void)
Select the variant.
Definition: Seq_data_.hpp:657
extended ASCII 1 letter aa codes
Definition: Seq_data_.hpp:111
TNcbi4na & SetNcbi4na(void)
Select the variant.
Definition: Seq_data_.hpp:577
CIUPACna –.
Definition: IUPACna.hpp:65
Data storage class.
char value[7]
Definition: config.c:428
void DoConstruct(const string &value, E_Choice index)
Definition: Seq_data.cpp:133
Data storage class.
Data storage class.
CException –.
Definition: ncbiexpt.hpp:709
nucleic acid probabilities
Definition: Seq_data_.hpp:109
Data storage class.
4 bit nucleic acid code
Definition: Seq_data_.hpp:107
TNcbi8aa & SetNcbi8aa(void)
Select the variant.
Definition: Seq_data_.hpp:637
2 bit nucleic acid code
Definition: Seq_data_.hpp:106
TNcbipaa & SetNcbipaa(void)
Select the variant.
Definition: Seq_data_.hpp:677
Data storage class.
TIupacaa & SetIupacaa(void)
Select the variant.
Definition: Seq_data_.hpp:537
Data storage class.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string...
Definition: ncbiexpt.hpp:546
TNcbi2na & SetNcbi2na(void)
Select the variant.
Definition: Seq_data_.hpp:557
8 bit extended nucleic acid code
Definition: Seq_data_.hpp:108
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:98
IUPAC 1 letter amino acid code.
Definition: Seq_data_.hpp:105
8 bit extended amino acid codes
Definition: Seq_data_.hpp:110
Modified on Tue Aug 23 18:27:32 2016 by modify_doxy.py rev. 506947