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

Go to the SVN repository for this file.

1 /* $Id$
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  * File Description:
27  * This code was generated by application DATATOOL
28  * using the following specifications:
29  * 'seqtable.asn'.
30  *
31  * ATTENTION:
32  * Don't edit or commit this file into CVS as this file will
33  * be overridden (by DATATOOL) without warning!
34  * ===========================================================================
35  */
36 
37 // standard includes
38 #include <ncbi_pch.hpp>
39 #include <serial/serialimpl.hpp>
40 
41 // generated includes
45 
46 BEGIN_objects_SCOPE // namespace ncbi::objects::
47 
48 
49 // generated classes
50 
52 {
53  if ( m_choice != e_not_set )
55 }
56 
58 {
59  switch ( m_choice ) {
60  case e_Indexes:
61  m_Indexes.Destruct();
62  break;
63  case e_Bit_set:
64  m_Bit_set.Destruct();
65  break;
66  case e_Indexes_delta:
67  m_Indexes_delta.Destruct();
68  break;
69  case e_Bit_set_bvector:
70  m_object->RemoveReference();
71  break;
72  default:
73  break;
74  }
76 }
77 
78 void CSeqTable_sparse_index_Base::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
79 {
80  switch ( index ) {
81  case e_Indexes:
82  m_Indexes.Construct();
83  break;
84  case e_Bit_set:
85  m_Bit_set.Construct();
86  break;
87  case e_Indexes_delta:
88  m_Indexes_delta.Construct();
89  break;
90  case e_Bit_set_bvector:
91  (m_object = new(pool) ncbi::objects::CBVector_data())->AddReference();
92  break;
93  default:
94  break;
95  }
96  m_choice = index;
97 }
98 
100  "not set",
101  "indexes",
102  "bit-set",
103  "indexes-delta",
104  "bit-set-bvector"
105 };
106 
108 {
109  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
110 }
111 
113 {
114  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
115 }
116 
118 {
120  return *static_cast<const TBit_set_bvector*>(m_object);
121 }
122 
124 {
126  return *static_cast<TBit_set_bvector*>(m_object);
127 }
128 
130 {
131  TBit_set_bvector* ptr = &value;
132  if ( m_choice != e_Bit_set_bvector || m_object != ptr ) {
133  ResetSelection();
134  (m_object = ptr)->AddReference();
136  }
137 }
138 
139 // helper methods
140 
141 // type info
143 {
144  SET_CHOICE_MODULE("NCBI-SeqTable");
145  ADD_NAMED_BUF_CHOICE_VARIANT("indexes", m_Indexes, STL_vector, (STD, (unsigned)));
146  ADD_NAMED_BUF_CHOICE_VARIANT("bit-set", m_Bit_set, STL_CHAR_vector, (char));
147  ADD_NAMED_BUF_CHOICE_VARIANT("indexes-delta", m_Indexes_delta, STL_vector, (STD, (unsigned)));
148  ADD_NAMED_REF_CHOICE_VARIANT("bit-set-bvector", m_object, CBVector_data);
149  info->CodeVersion(22400);
150  info->DataSpec(ncbi::EDataSpec::eASN);
151 }
153 
154 // constructor
156  : m_choice(e_not_set)
157 {
158 }
159 
160 // destructor
162 {
163  Reset();
164 }
165 
166 
167 
168 END_objects_SCOPE // namespace ncbi::objects::
169 
171 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
BEGIN_NAMED_BASE_CHOICE_INFO("SeqTable-sparse-index", CSeqTable_sparse_index)
string
Definition: cgiapp.hpp:687
#define DIAG_COMPILE_INFO
Make compile time diagnostic information object to use in CNcbiDiag and CException.
Definition: ncbidiag.hpp:170
#define ADD_NAMED_REF_CHOICE_VARIANT(MemberAlias, MemberName, ClassName)
Definition: serialimpl.hpp:400
#define END_CHOICE_INFO
Definition: serialimpl.hpp:506
#define SET_CHOICE_MODULE(ModuleName)
Definition: serialimpl.hpp:500
#define ADD_NAMED_BUF_CHOICE_VARIANT(MemberAlias, MemberName, TypeMacro, TypeMacroArgs)
Definition: serialimpl.hpp:385
@ eDoNotResetVariant
Definition: serialbase.hpp:78
void AddReference(void) const
Add reference to object.
Definition: ncbiobj.hpp:489
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
TBit_set_bvector & SetBit_set_bvector(void)
Select the variant.
static const char *const sm_SelectionNames[]
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
NCBI_NS_NCBI::CSerialObject * m_object
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
NCBI_NS_NCBI::CUnionBuffer< TIndexes > m_Indexes
NCBI_NS_NCBI::CUnionBuffer< TIndexes_delta > m_Indexes_delta
const TBit_set_bvector & GetBit_set_bvector(void) const
Get the variant data.
virtual void Reset(void)
Reset the whole object.
NCBI_NS_NCBI::CUnionBuffer< TBit_set > m_Bit_set
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
@ e_Bit_set
Bitset of rows with values, set bit means the row has value. Most-significant bit in each octet comes...
@ e_Bit_set_bvector
Bitset of rows with values, as serialized bvector<>, see include/util/bitset/bm.h.
@ e_Indexes_delta
Indexes of rows with values, delta-encoded.
@ e_Indexes
Indexes of rows with values.
@ e_not_set
static MDB_envinfo info
Definition: mdb_load.c:37
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Tue May 14 16:16:33 2024 by modify_doxy.py rev. 669887