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

Go to the SVN repository for this file.

1 /* $Id: Seq_table.cpp 66087 2015-01-29 19:26:03Z 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 the following specifications:
34  * 'seqtable.asn'.
35  */
36 
37 // standard includes
38 #include <ncbi_pch.hpp>
39 
40 // generated includes
45 #include <serial/enumvalues.hpp>
46 
47 // generated classes
48 
50 
51 BEGIN_objects_SCOPE // namespace ncbi::objects::
52 
53 // destructor
55 {
56 }
57 
58 
60 {
61  return CSeqTable_column_info::ENUM_METHOD_NAME(EField_id)()->FindName(column_id, true);
62 }
63 
64 
66 {
67  ITERATE ( TColumns, it, GetColumns() ) {
68  const CSeqTable_column& column = **it;
69  const CSeqTable_column_info& info = column.GetHeader();
70  if ( info.IsSetField_name() && column_name == info.GetField_name() ) {
71  return column;
72  }
73  }
74  NCBI_THROW(CSeqTableException, eColumnNotFound,
75  "Column not found: "+string(column_name));
76 }
77 
78 
80 {
81  ITERATE ( TColumns, it, GetColumns() ) {
82  const CSeqTable_column& column = **it;
83  const CSeqTable_column_info& info = column.GetHeader();
84  if ( info.IsSetField_id() && column_id == info.GetField_id() ) {
85  return column;
86  }
87  }
88  NCBI_THROW(CSeqTableException, eColumnNotFound,
89  "Column not found: "+GetIdName(column_id));
90 }
91 
92 
94  CTempString column_name) const
95 {
96  ITERATE ( TColumns, it, GetColumns() ) {
97  const CSeqTable_column& column = **it;
98  const CSeqTable_column_info& info = column.GetHeader();
99  if ( info.IsSetField_id() && column_id == info.GetField_id() ) {
100  return column;
101  }
102  if ( info.IsSetField_name() && column_name == info.GetField_name() ) {
103  return column;
104  }
105  }
106  NCBI_THROW(CSeqTableException, eColumnNotFound,
107  "Column not found: "+string(column_name)+"/"+GetIdName(column_id));
108 }
109 
110 
112 {
113  switch ( GetErrCode() ) {
114  case eColumnNotFound: return "eColumnNotFound";
115  case eRowNotFound: return "eRowNotFound";
116  case eIncompatibleValueType:return "eIncompatibleValueType";
117  case eOtherError: return "eOtherError";
118  default: return CException::GetErrCodeString();
119  }
120 }
121 
122 END_objects_SCOPE // namespace ncbi::objects::
123 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
Seq-loc and seq-align mapper exceptions.
static string GetIdName(TColumnId column_id)
Definition: Seq_table.cpp:59
const CSeqTable_column & GetColumn(CTempString column_name) const
Definition: Seq_table.cpp:65
~CSeq_table(void)
Definition: Seq_table.cpp:54
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
Definition: tempstr.hpp:65
static const char * column
Definition: stats.c:23
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
TErrCode GetErrCode(void) const
Get error code.
Definition: ncbiexpt.cpp:453
#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:704
virtual const char * GetErrCodeString(void) const
Get error code interpreted as text.
Definition: ncbiexpt.cpp:444
#define ENUM_METHOD_NAME(EnumName)
Definition: serialbase.hpp:994
virtual const char * GetErrCodeString(void) const override
Get error code interpreted as text.
Definition: Seq_table.cpp:111
@ eIncompatibleValueType
Data cannot be converted to asked type.
@ eRowNotFound
Requested row is missing.
@ eColumnNotFound
Requested column is missing.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
const TColumns & GetColumns(void) const
Get the Columns member data.
Definition: Seq_table_.hpp:433
EField_id
identification of the column data in the objects described by the table known column data types posit...
vector< CRef< CSeqTable_column > > TColumns
Definition: Seq_table_.hpp:92
static MDB_envinfo info
Definition: mdb_load.c:37
Modified on Wed Apr 17 13:09:49 2024 by modify_doxy.py rev. 669887