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

Go to the SVN repository for this file.

1 /* $Id: SeqTable_multi_data.cpp 99064 2023-02-08 19:14:27Z ucko $
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/objhook.hpp>
46 #include <corelib/ncbi_param.hpp>
47 
50 #include <cmath>
51 
53 
54 // generated classes
55 
57 
58 BEGIN_objects_SCOPE // namespace ncbi::objects::
59 
60 // constructor
62 {
63 }
64 
65 
66 // destructor
68 {
69 }
70 
71 
72 DEFINE_STATIC_MUTEX(sx_PrepareMutex_multi_data);
73 
74 
76 {
77  m_Cache.Reset();
78 }
79 
80 
82 {
84  if ( !info ) {
85  if ( GetInt_delta().GetIntSize() <= sizeof(Int4) ) {
87  }
88  else {
90  }
91  m_Cache = info;
92  }
93  return *info;
94 }
95 
96 
97 /////////////////////////////////////////////////////////////////////////////
98 // CIntDeltaSumCache
99 /////////////////////////////////////////////////////////////////////////////
100 
102 {
103 }
104 
105 
107  size_t index)
108 {
109  Int8 v8 = GetDeltaSum8(deltas, index);
110  Int4 v = Int4(v8);
111  if ( v != v8 ) {
112  NCBI_THROW(CSeqTableException, eIncompatibleValueType,
113  "CIntDeltaSumCache::GetDeltaSum4(): "
114  "Int8 value doesn't fit in Int4");
115  }
116  return v;
117 }
118 
119 
121  size_t index)
122 {
123  return GetDeltaSum4(deltas, index);
124 }
125 
126 
127 #define USE_DELTA_CACHE
128 
129 /////////////////////////////////////////////////////////////////////////////
130 // CInt4DeltaSumCache
131 /////////////////////////////////////////////////////////////////////////////
132 
133 const size_t CInt4DeltaSumCache::kBlockSize = 128;
134 
135 
137  : m_Blocks(new TValue[(size+kBlockSize-1)/kBlockSize]),
138  m_BlocksFilled(0),
139 #ifdef USE_DELTA_CACHE
140  m_CacheBlockInfo(new TValue[kBlockSize]),
141 #endif
142  m_CacheBlockIndex(size_t(0)-1)
143 {
144 }
145 
146 
148 {
149 }
150 
151 
152 inline
154  size_t block_index,
155  size_t block_offset)
156 {
157 #ifdef USE_DELTA_CACHE
158  _ASSERT(block_index <= m_BlocksFilled);
159  if ( block_index != m_CacheBlockIndex ) {
160  size_t size = deltas.GetSize();
161  size_t block_pos = block_index*kBlockSize;
162  _ASSERT(block_pos < size);
163  size_t block_size = min(kBlockSize, size-block_pos);
164  _ASSERT(block_offset < block_size);
165  TValue sum = block_index == 0? 0: m_Blocks[block_index-1];
166  for ( size_t i = 0; i < block_size; ++i ) {
167  TValue v;
168  if ( deltas.TryGetValue(block_pos+i, v) ) {
169  sum += v;
170  }
171  m_CacheBlockInfo[i] = sum;
172  }
173  m_CacheBlockIndex = block_index;
174  if ( block_index == m_BlocksFilled ) {
175  m_Blocks[block_index] = sum;
176  m_BlocksFilled = block_index+1;
177  }
178  }
179  return m_CacheBlockInfo[block_offset];
180 #else
181  size_t size = deltas.GetSize();
182  size_t block_pos = block_index*kBlockSize;
183  _ASSERT(block_pos < size);
184  size_t block_size = min(kBlockSize, size-block_pos);
185  _ASSERT(block_offset < block_size);
186  TValue sum = block_index == 0? 0: m_Blocks[block_index-1];
187  for ( size_t i = 0; i <= block_offset; ++i ) {
188  TValue v;
189  if ( deltas.TryGetValue(block_pos+i, v) ) {
190  sum += v;
191  }
192  }
193  if ( block_index == m_BlocksFilled ) {
194  TValue sum2 = sum;
195  for ( size_t i = block_offset+1; i < block_size; ++i ) {
196  TValue v;
197  if ( deltas.TryGetValue(block_pos+i, v) ) {
198  sum2 += v;
199  }
200  }
201  m_Blocks[block_index] = sum2;
202  m_BlocksFilled = block_index+1;
203  }
204  return sum;
205 #endif
206 }
207 
208 
210  size_t index)
211 {
212  _ASSERT(index < deltas.GetSize());
213  size_t block_index = index / kBlockSize;
214  size_t block_offset = index % kBlockSize;
215  while ( block_index >= m_BlocksFilled ) {
216  x_GetDeltaSum2(deltas, m_BlocksFilled, 0);
217  }
218  return x_GetDeltaSum2(deltas, block_index, block_offset);
219 }
220 
221 
222 /////////////////////////////////////////////////////////////////////////////
223 // CInt8DeltaSumCache
224 /////////////////////////////////////////////////////////////////////////////
225 
226 const size_t CInt8DeltaSumCache::kBlockSize = 128;
227 
228 
230  : m_Blocks(new TValue[(size+kBlockSize-1)/kBlockSize]),
231  m_BlocksFilled(0),
232 #ifdef USE_DELTA_CACHE
233  m_CacheBlockInfo(new TValue[kBlockSize]),
234 #endif
235  m_CacheBlockIndex(size_t(0)-1)
236 {
237 }
238 
239 
241 {
242 }
243 
244 
245 inline
247  size_t block_index,
248  size_t block_offset)
249 {
250 #ifdef USE_DELTA_CACHE
251  _ASSERT(block_index <= m_BlocksFilled);
252  if ( block_index != m_CacheBlockIndex ) {
253  size_t size = deltas.GetSize();
254  size_t block_pos = block_index*kBlockSize;
255  _ASSERT(block_pos < size);
256  size_t block_size = min(kBlockSize, size-block_pos);
257  _ASSERT(block_offset < block_size);
258  TValue sum = block_index == 0? 0: m_Blocks[block_index-1];
259  for ( size_t i = 0; i < block_size; ++i ) {
260  TValue v;
261  if ( deltas.TryGetValue(block_pos+i, v) ) {
262  sum += v;
263  }
264  m_CacheBlockInfo[i] = sum;
265  }
266  m_CacheBlockIndex = block_index;
267  if ( block_index == m_BlocksFilled ) {
268  m_Blocks[block_index] = sum;
269  m_BlocksFilled = block_index+1;
270  }
271  }
272  return m_CacheBlockInfo[block_offset];
273 #else
274  size_t size = deltas.GetSize();
275  size_t block_pos = block_index*kBlockSize;
276  _ASSERT(block_pos < size);
277  size_t block_size = min(kBlockSize, size-block_pos);
278  _ASSERT(block_offset < block_size);
279  TValue sum = block_index == 0? 0: m_Blocks[block_index-1];
280  for ( size_t i = 0; i <= block_offset; ++i ) {
281  TValue v;
282  if ( deltas.TryGetValue(block_pos+i, v) ) {
283  sum += v;
284  }
285  }
286  if ( block_index == m_BlocksFilled ) {
287  TValue sum2 = sum;
288  for ( size_t i = block_offset+1; i < block_size; ++i ) {
289  TValue v;
290  if ( deltas.TryGetValue(block_pos+i, v) ) {
291  sum2 += v;
292  }
293  }
294  m_Blocks[block_index] = sum2;
295  m_BlocksFilled = block_index+1;
296  }
297  return sum;
298 #endif
299 }
300 
301 
303  size_t index)
304 {
305  _ASSERT(index < deltas.GetSize());
306  size_t block_index = index / kBlockSize;
307  size_t block_offset = index % kBlockSize;
308  while ( block_index >= m_BlocksFilled ) {
309  x_GetDeltaSum2(deltas, m_BlocksFilled, 0);
310  }
311  return x_GetDeltaSum2(deltas, block_index, block_offset);
312 }
313 
314 
315 /////////////////////////////////////////////////////////////////////////////
316 
317 
319 {
320  switch ( Which() ) {
321  case e_Bit_bvector:
322  return e_Bit;
323  case e_Int1:
324  case e_Int2:
325  return e_Int;
326  case e_Int_delta:
327  return GetInt_delta().GetValueType();
328  case e_Int_scaled:
329  return GetInt_scaled().GetIntSize() <= sizeof(Int4)? e_Int: e_Int8;
330  case e_Common_string:
331  return e_String;
332  case e_Common_bytes:
333  return e_Bytes;
334  default:
335  return Which();
336  }
337 }
338 
339 
341 {
342  switch ( GetValueType() ) {
343  case e_Bit:
344  case e_Int:
345  case e_Int8:
346  return true;
347  default:
348  return false;
349  }
350 }
351 
352 
354 {
355  switch ( GetValueType() ) {
356  case e_Bit:
357  case e_Int:
358  case e_Int8:
359  case e_Real:
360  return true;
361  default:
362  return false;
363  }
364 }
365 
366 
368 {
369  switch ( Which() ) {
370  case e_Int:
371  return sizeof(TInt::value_type);
372  case e_Int1:
373  return sizeof(TInt1::value_type);
374  case e_Int2:
375  return sizeof(TInt2::value_type);
376  case e_Int8:
377  return sizeof(TInt8::value_type);
378  case e_Bit:
379  case e_Bit_bvector:
380  return 1; // one char is enough to store bit value
381  case e_Int_delta:
382  return GetInt_delta().GetIntSize();
383  case e_Int_scaled:
384  return GetInt_scaled().GetIntSize();
385  default:
386  return 0;
387  }
388 }
389 
390 
392 {
393  switch ( Which() ) {
394  case e_Int:
395  return GetInt().size();
396  case e_Int1:
397  return GetInt1().size();
398  case e_Int2:
399  return GetInt2().size();
400  case e_Int8:
401  return GetInt8().size();
402  case e_Real:
403  return GetReal().size();
404  case e_String:
405  return GetString().size();
406  case e_Bytes:
407  return GetBytes().size();
408  case e_Common_string:
409  return GetCommon_string().GetIndexes().size();
410  case e_Common_bytes:
411  return GetCommon_bytes().GetIndexes().size();
412  case e_Bit:
413  return GetBit().size()*8;
414  case e_Loc:
415  return GetLoc().size();
416  case e_Id:
417  return GetId().size();
418  case e_Interval:
419  return GetInterval().size();
420  case e_Bit_bvector:
421  return GetBit_bvector().GetSize();
422  case e_Int_delta:
423  return GetInt_delta().GetSize();
424  case e_Int_scaled:
425  return GetInt_scaled().GetData().GetSize();
426  case e_Real_scaled:
427  return GetReal_scaled().GetData().GetSize();
428  default:
429  break;
430  }
431  return 0;
432 }
433 
434 
435 template<class DstInt>
436 static inline
437 bool sx_DownCastInt8(DstInt& v, const Int8& value, const char* type_name)
438 {
439  v = DstInt(value);
440  if ( Int8(v) != value ) {
441  NCBI_THROW_FMT(CSeqTableException, eIncompatibleValueType,
442  "CSeqTable_multi_data::TryGet"<<type_name<<"(): "
443  "value is too big for requested type: "<<value);
444  }
445  return true;
446 }
447 
448 
449 template<class DstInt>
450 static inline
451 bool sx_Round(DstInt& v, double value, const char* cast_error)
452 {
453  // Round and check range.
454  // Function round() is not everywhere available,
455  // so we are using either floor() or ceil() depending on value sign.
456  bool range_error;
457  static constexpr double kMaxPlusOne
458  = ((numeric_limits<DstInt>::max() - 1) / 2 + 1) * 2.0;
459  if ( value > 0 ) {
460  value = floor(value + .5);
461  range_error = value >= kMaxPlusOne;
462  }
463  else {
464  value = ceil(value-.5);
465  range_error = value < numeric_limits<DstInt>::min();
466  }
467  if ( range_error ) {
468  // range check failed
469  NCBI_THROW(CSeqTableException, eIncompatibleValueType, cast_error);
470  }
471  v = DstInt(value);
472  return true;
473 }
474 
475 
476 template<class Arr, class Row, class Int>
477 static inline
478 bool sx_TryGet(const Arr& arr, Row row, Int& v)
479 {
480  if ( row >= arr.size() ) {
481  return false;
482  }
483  v = arr[row];
484  return true;
485 }
486 
487 
488 bool CSeqTable_multi_data::TryGetBool(size_t row, bool& v) const
489 {
490  Int8 value;
491  return x_TryGetInt8(row, value, "Bool") &&
492  sx_DownCastInt8(v, value, "Bool");
493 }
494 
495 
497 {
498  Int8 value;
499  return x_TryGetInt8(row, value, "Int1") &&
500  sx_DownCastInt8(v, value, "Int1");
501 }
502 
503 
505 {
506  Int8 value;
507  return x_TryGetInt8(row, value, "Int2") &&
508  sx_DownCastInt8(v, value, "Int2");
509 }
510 
511 
513 {
514  Int8 value;
515  return x_TryGetInt8(row, value, "Int4") &&
516  sx_DownCastInt8(v, value, "Int4");
517 }
518 
519 
521  const char* type_name) const
522 {
523  switch ( Which() ) {
524  case e_Bit:
525  {
526  const TBit& bits = GetBit();
527  size_t i = row/8;
528  if ( i >= bits.size() ) {
529  return false;
530  }
531  size_t j = row%8;
532  Uint1 bb = bits[i];
533  v = ((bb<<j)&0x80) != 0;
534  return true;
535  }
536  case e_Bit_bvector:
537  return sx_TryGet(GetBit_bvector().GetBitVector(),
538  static_cast<bm::bvector<>::size_type>(row), v);
539  case e_Int1:
540  return sx_TryGet(GetInt1(), row, v);
541  case e_Int2:
542  return sx_TryGet(GetInt2(), row, v);
543  case e_Int:
544  return sx_TryGet(GetInt(), row, v);
545  case e_Int8:
546  return sx_TryGet(GetInt8(), row, v);
547  case e_Int_delta:
548  {
549  const CSeqTable_multi_data& deltas = GetInt_delta();
550  if ( row >= deltas.GetSize() ) {
551  return false;
552  }
553  CMutexGuard guard(sx_PrepareMutex_multi_data);
554  v = x_GetIntDeltaCache().GetDeltaSum8(deltas, row);
555  return true;
556  }
557  case e_Int_scaled:
558  return GetInt_scaled().TryGetInt8(row, v);
559  default:
560  NCBI_THROW_FMT(CSeqTableException, eIncompatibleValueType,
561  "CSeqTable_multi_data::TryGet"<<type_name<<"(): "
562  "value cannot be converted to requested type");
563  }
564 }
565 
566 
568 {
569  return x_TryGetInt8(row, v, "Int8");
570 }
571 
572 
573 bool CSeqTable_multi_data::TryGetReal(size_t row, double& v) const
574 {
575  switch ( Which() ) {
576  case e_Real:
577  return sx_TryGet(GetReal(), row, v);
578  case e_Real_scaled:
579  return GetReal_scaled().TryGetReal(row, v);
580  default:
581  Int8 value_int8;
582  if ( !x_TryGetInt8(row, value_int8, "Real") ) {
583  return false;
584  }
585  v = double(value_int8);
586  return true;
587  }
588 }
589 
590 
591 const string* CSeqTable_multi_data::GetStringPtr(size_t row) const
592 {
593  if ( IsString() ) {
595  if ( row < arr.size() ) {
596  return &arr[row];
597  }
598  }
599  else if ( IsCommon_string() ) {
600  const CCommonString_table& common = GetCommon_string();
602  if ( row < indexes.size() ) {
603  const CCommonString_table::TStrings& arr = common.GetStrings();
604  size_t arr_index = indexes[row];
605  if ( arr_index < arr.size() ) {
606  return &arr[arr_index];
607  }
608  }
609  }
610  else {
611  NCBI_THROW(CSeqTableException, eIncompatibleValueType,
612  "CSeqTable_multi_data::GetStringPtr() "
613  "data cannot be converted to string");
614  }
615  return 0;
616 }
617 
618 
620 {
621  if ( GetValueType() == e_Real ) {
622  double value;
623  return TryGetReal(row, value) &&
624  sx_Round(v, value,
625  "CSeqTable_multi_data::TryGetInt1WithRounding(): "
626  "real value doesn't fit in Int1");
627  }
628  return TryGetInt1(row, v);
629 }
630 
631 
633 {
634  if ( GetValueType() == e_Real ) {
635  double value;
636  return TryGetReal(row, value) &&
637  sx_Round(v, value,
638  "CSeqTable_multi_data::TryGetInt2WithRounding(): "
639  "real value doesn't fit in Int2");
640  }
641  return TryGetInt2(row, v);
642 }
643 
644 
646 {
647  if ( GetValueType() == e_Real ) {
648  double value;
649  return TryGetReal(row, value) &&
650  sx_Round(v, value,
651  "CSeqTable_multi_data::TryGetInt4WithRounding(): "
652  "real value doesn't fit in Int4");
653  }
654  return TryGetInt4(row, v);
655 }
656 
657 
659 {
660  if ( GetValueType() == e_Real ) {
661  double value;
662  return TryGetReal(row, value) &&
663  sx_Round(v, value,
664  "CSeqTable_multi_data::TryGetInt8WithRounding(): "
665  "real value doesn't fit in Int8");
666  }
667  return TryGetInt8(row, v);
668 }
669 
670 
671 const vector<char>* CSeqTable_multi_data::GetBytesPtr(size_t row) const
672 {
673  if ( IsBytes() ) {
675  if ( row < arr.size() ) {
676  return arr[row];
677  }
678  }
679  else if ( IsCommon_bytes() ) {
680  const CCommonBytes_table& common = GetCommon_bytes();
682  if ( row < indexes.size() ) {
683  const CCommonBytes_table::TBytes& arr = common.GetBytes();
684  size_t arr_index = indexes[row];
685  if ( arr_index < arr.size() ) {
686  return arr[arr_index];
687  }
688  }
689  }
690  else {
691  NCBI_THROW(CSeqTableException, eIncompatibleValueType,
692  "CSeqTable_multi_data::GetBytesPtr() "
693  "data cannot be converted to OCTET STRING");
694  }
695  return 0;
696 }
697 
698 
699 NCBI_PARAM_DECL(bool, OBJECTS, SEQ_TABLE_RESERVE);
700 NCBI_PARAM_DEF_EX(bool, OBJECTS, SEQ_TABLE_RESERVE, true,
701  eParam_NoThread, OBJECTS_SEQ_TABLE_RESERVE);
702 
705  const CObjectInfoCV& variant)
706 {
707  static CSafeStatic<NCBI_PARAM_TYPE(OBJECTS, SEQ_TABLE_RESERVE)> s_Reserve;
708 
709  if ( !s_Reserve->Get() ) {
710  return;
711  }
713  size_t size = table->GetNum_rows();
716  try {
717  switch ( variant.GetVariantIndex() ) {
718  case e_Int:
719  data->SetInt().reserve(size);
720  break;
721  case e_Int1:
722  data->SetInt1().reserve(size);
723  break;
724  case e_Int2:
725  data->SetInt2().reserve(size);
726  break;
727  case e_Int8:
728  data->SetInt8().reserve(size);
729  break;
730  case e_Real:
731  data->SetReal().reserve(size);
732  break;
733  case e_String:
734  data->SetString().reserve(size);
735  break;
736  case e_Bytes:
737  data->SetBytes().reserve(size);
738  break;
739  case e_Common_string:
740  data->SetCommon_string().SetIndexes().reserve(size);
741  break;
742  case e_Common_bytes:
743  data->SetCommon_bytes().SetIndexes().reserve(size);
744  break;
745  case e_Bit:
746  data->SetBit().reserve((size+7)/8);
747  break;
748  case e_Loc:
749  data->SetLoc().reserve(size);
750  break;
751  case e_Id:
752  data->SetId().reserve(size);
753  break;
754  case e_Interval:
755  data->SetInterval().reserve(size);
756  break;
757  default:
758  break;
759  }
760  }
761  catch ( bad_alloc& /*ignored*/ ) {
762  // ignore insufficient memory exception from advisory reserve()
763  }
764  }
765 }
766 
767 
769 {
770  if ( Which() == type ) {
771  return;
772  }
773  switch ( type ) {
774  case e_Int:
775  ChangeToInt();
776  break;
777  case e_Int1:
778  ChangeToInt1();
779  break;
780  case e_Int2:
781  ChangeToInt2();
782  break;
783  case e_Int8:
784  ChangeToInt8();
785  break;
786  case e_Real:
787  ChangeToReal();
788  break;
789  case e_String:
790  ChangeToString();
791  break;
792  case e_Common_string:
794  break;
795  case e_Bytes:
796  ChangeToBytes();
797  break;
798  case e_Common_bytes:
800  break;
801  case e_Bit:
802  ChangeToBit();
803  break;
804  case e_Int_delta:
806  break;
807  case e_Bit_bvector:
809  break;
810  case e_Int_scaled: // scaling requires extra parameters
811  NCBI_THROW(CSeqTableException, eIncompatibleValueType,
812  "CSeqTable_multi_data::ChangeTo(e_Int_scaled): "
813  "scaling parameters are unknown");
814  case e_Real_scaled: // scaling requires extra parameters
815  NCBI_THROW(CSeqTableException, eIncompatibleValueType,
816  "CSeqTable_multi_data::ChangeTo(e_Real_scaled): "
817  "scaling parameters are unknown");
818  default:
819  NCBI_THROW(CSeqTableException, eIncompatibleValueType,
820  "CSeqTable_multi_data::ChangeTo(): "
821  "requested multi-data type is invalid");
822  }
823 }
824 
825 
826 void CSeqTable_multi_data::ChangeToString(const string* omitted_value)
827 {
828  if ( IsString() ) {
829  return;
830  }
831  if ( IsCommon_string() ) {
832  const CCommonString_table& common = GetCommon_string();
834  size_t size = indexes.size();
835  TString arr;
836  arr.reserve(size);
837  const CCommonString_table::TStrings& src = common.GetStrings();
839  size_t index = *it;
840  if ( index < src.size() ) {
841  arr.push_back(src[index]);
842  }
843  else if ( omitted_value ) {
844  arr.push_back(*omitted_value);
845  }
846  else {
847  NCBI_THROW(CSeqTableException, eIncompatibleValueType,
848  "CSeqTable_multi_data::ChangeToString(): "
849  "common string table is sparse");
850  }
851  }
852  swap(SetString(), arr);
853  return;
854  }
855  NCBI_THROW(CSeqTableException, eIncompatibleValueType,
856  "CSeqTable_multi_data::ChangeToString(): "
857  "requested mult-data type is invalid");
858 }
859 
860 
861 void CSeqTable_multi_data::ChangeToCommon_string(const string* omit_value)
862 {
863  if ( IsCommon_string() ) {
864  return;
865  }
866  if ( IsString() ) {
868  CCommonString_table::TIndexes& indexes = common->SetIndexes();
869  CCommonString_table::TStrings& arr = common->SetStrings();
870  const TString& src = GetString();
871  indexes.reserve(src.size());
873  TIndexMap;
874  TIndexMap index_map;
875  if ( omit_value ) {
876  index_map[*omit_value] = -1;
877  }
878  ITERATE ( TString, it, src ) {
879  const string& key = *it;
880  TIndexMap::iterator iter = index_map.lower_bound(key);
881  if ( iter == index_map.end() || iter->first != key ) {
882  iter = index_map.insert(iter, TIndexMap::value_type(key, arr.size()));
883  arr.push_back(key);
884  }
885  indexes.push_back(iter->second);
886  }
887  SetCommon_string(*common);
888  return;
889  }
890  NCBI_THROW(CSeqTableException, eIncompatibleValueType,
891  "CSeqTable_multi_data::ChangeToCommon_string(): "
892  "requested mult-data type is invalid");
893 }
894 
895 
897 {
898  if ( IsBytes() ) {
899  return;
900  }
901  if ( IsCommon_bytes() ) {
902  const CCommonBytes_table& common = GetCommon_bytes();
904  size_t size = indexes.size();
905  TBytes arr;
906  arr.reserve(size);
907  const CCommonBytes_table::TBytes& src = common.GetBytes();
909  size_t index = *it;
910  const TBytesValue* value;
911  if ( index < src.size() ) {
912  value = src[index];
913  }
914  else if ( omitted_value ) {
915  value = omitted_value;
916  }
917  else {
918  NCBI_THROW(CSeqTableException, eIncompatibleValueType,
919  "CSeqTable_multi_data::ChangeToBytes(): "
920  "common bytes table is sparse");
921  }
922  arr.push_back(new TBytesValue(*value));
923  }
924  swap(SetBytes(), arr);
925  return;
926  }
927  NCBI_THROW(CSeqTableException, eIncompatibleValueType,
928  "CSeqTable_multi_data::ChangeToBytes(): "
929  "requested mult-data type is invalid");
930 }
931 
932 
934 {
935  if ( IsCommon_bytes() ) {
936  return;
937  }
938  if ( IsBytes() ) {
940  CCommonBytes_table::TIndexes& indexes = common->SetIndexes();
941  CCommonBytes_table::TBytes& arr = common->SetBytes();
942  const TBytes& src = GetBytes();
943  indexes.reserve(src.size());
944  typedef map<const TBytesValue*,
946  PPtrLess<const TBytesValue*> > TIndexMap;
947  TIndexMap index_map;
948  if ( omit_value ) {
949  index_map[omit_value] = -1;
950  }
951  ITERATE ( TBytes, it, src ) {
952  const TBytesValue* key = *it;
953  TIndexMap::iterator iter = index_map.lower_bound(key);
954  if ( iter == index_map.end() || *iter->first != *key ) {
955  iter = index_map.insert(iter, TIndexMap::value_type(key, arr.size()));
956  arr.push_back(new TBytesValue(*key));
957  }
958  indexes.push_back(iter->second);
959  }
960  SetCommon_bytes(*common);
961  return;
962  }
963  NCBI_THROW(CSeqTableException, eIncompatibleValueType,
964  "CSeqTable_multi_data::ChangeToBytes(): "
965  "requested mult-data type is invalid");
966 }
967 
968 
969 void CSeqTable_multi_data::ChangeToReal_scaled(double mul, double add)
970 {
971  if ( IsReal_scaled() ) {
972  return;
973  }
974  TReal arr;
975  if ( IsReal() ) {
976  // in-place
977  swap(arr, SetReal());
978  NON_CONST_ITERATE ( TReal, it, arr ) {
979  TReal::value_type value = *it;
980  value -= add;
981  *it = value/mul;
982  }
983  }
984  else {
985  for ( size_t row = 0; ; ++row ) {
987  if ( !TryGetReal(row, value) ) {
988  break;
989  }
990  value -= add;
991  arr.push_back(value/mul);
992  }
993  }
994  swap(SetReal_scaled().SetData().SetReal(), arr);
995 }
996 
997 
999 {
1000  if ( IsInt_scaled() ) {
1001  return;
1002  }
1003  int min_v = 0, max_v = 0;
1004  if ( IsInt() ) {
1005  // in-place
1006  TInt arr;
1007  swap(arr, SetInt());
1008  NON_CONST_ITERATE ( TInt, it, arr ) {
1009  TInt::value_type value = *it;
1010  value -= add;
1011  if ( value % mul != 0 ) {
1012  // restore already scaled values
1013  while ( it != arr.begin() ) {
1014  TInt::value_type value = *--it;
1015  *it = value*mul+add;
1016  }
1017  swap(arr, SetInt());
1018  NCBI_THROW(CSeqTableException, eIncompatibleValueType,
1019  "CSeqTable_multi_data::ChangeToInt_scaled(): "
1020  "value is not round for scaling");
1021  }
1022  value /= mul;
1023  if ( value < min_v ) {
1024  min_v = value;
1025  }
1026  else if ( value > max_v ) {
1027  max_v = value;
1028  }
1029  *it = value;
1030  }
1031  swap(SetInt_scaled().SetData().SetInt(), arr);
1032  }
1033  else if ( GetIntSize() <= sizeof(Int4) ) {
1034  TInt arr;
1035  for ( size_t row = 0; ; ++row ) {
1037  if ( !TryGetInt(row, value) ) {
1038  break;
1039  }
1040  value -= add;
1041  if ( value % mul != 0 ) {
1042  NCBI_THROW(CSeqTableException, eIncompatibleValueType,
1043  "CSeqTable_multi_data::ChangeToInt_scaled(): "
1044  "value is not round for scaling");
1045  }
1046  value /= mul;
1047  if ( value > max_v ) {
1048  max_v = value;
1049  }
1050  else if ( value < min_v ) {
1051  min_v = value;
1052  }
1053  arr.push_back(value);
1054  }
1055  swap(SetInt_scaled().SetData().SetInt(), arr);
1056  }
1057  else { // Int8 -> scaled
1058  TInt8 arr;
1059  Int8 min_v8 = 0, max_v8 = 0;
1060  for ( size_t row = 0; ; ++row ) {
1061  Int8 value;
1062  if ( !TryGetInt8(row, value) ) {
1063  break;
1064  }
1065  value -= add;
1066  if ( value % mul != 0 ) {
1067  NCBI_THROW(CSeqTableException, eIncompatibleValueType,
1068  "CSeqTable_multi_data::ChangeToInt_scaled(): "
1069  "value is not round for scaling");
1070  }
1071  value /= mul;
1072  if ( value > max_v8 ) {
1073  max_v8 = value;
1074  }
1075  else if ( value < min_v8 ) {
1076  min_v8 = value;
1077  }
1078  arr.push_back(value);
1079  }
1081  swap(scaled.SetData().SetInt8(), arr);
1082  bool is_int8 = false;
1083  if ( min_v < kMin_Int ) {
1084  scaled.SetMin(min_v);
1085  is_int8 = true;
1086  }
1087  if ( max_v > kMax_Int ) {
1088  scaled.SetMax(max_v);
1089  is_int8 = true;
1090  }
1091  if ( is_int8 ) {
1092  return;
1093  }
1094  min_v = int(min_v8);
1095  max_v = int(max_v8);
1096  }
1097  // compact scaled data
1098  if ( min_v == 0 && max_v <= 1 ) {
1099  SetInt_scaled().SetData().ChangeToBit();
1100  }
1101  else if ( min_v >= kMin_I1 && max_v <= kMax_I1 ) {
1102  SetInt_scaled().SetData().ChangeToInt1();
1103  }
1104  else if ( min_v >= kMin_I2 && max_v <= kMax_I2 ) {
1105  SetInt_scaled().SetData().ChangeToInt2();
1106  }
1107  else {
1108  SetInt_scaled().SetData().ChangeToInt4();
1109  }
1110 }
1111 
1112 
1114 {
1115  if ( IsInt_delta() ) {
1116  return;
1117  }
1118  TInt arr;
1119  if ( IsInt() ) {
1120  // in-place
1121  swap(arr, SetInt());
1122  TInt::value_type prev_value = 0;
1123  NON_CONST_ITERATE ( TInt, it, arr ) {
1124  TInt::value_type value = *it;
1125  *it = value - prev_value;
1126  prev_value = value;
1127  }
1128  }
1129  else {
1130  TInt::value_type prev_value = 0;
1131  for ( size_t row = 0; ; ++row ) {
1133  if ( !TryGetInt(row, value) ) {
1134  break;
1135  }
1136  arr.push_back(value-prev_value);
1137  prev_value = value;
1138  }
1139  }
1140  Reset();
1141  swap(SetInt_delta().SetInt(), arr);
1142 }
1143 
1144 
1146 {
1147  if ( IsInt() ) {
1148  return;
1149  }
1150  if ( IsInt_delta() ) {
1151  TInt arr;
1152  size_t size = GetSize();
1153  arr.reserve(size);
1154  for ( size_t row = 0; row < size; ++row ) {
1155  int value;
1156  if ( !TryGetInt(row, value) ) {
1157  break;
1158  }
1159  arr.push_back(value);
1160  }
1161  SetInt().swap(arr);
1162  return;
1163  }
1164  TInt arr;
1165  for ( size_t row = 0; ; ++row ) {
1167  if ( !TryGetIntWithRounding(row, value) ) {
1168  break;
1169  }
1170  arr.push_back(value);
1171  }
1172  Reset();
1173  swap(SetInt(), arr);
1174 }
1175 
1176 
1178 {
1179  if ( IsInt1() ) {
1180  return;
1181  }
1182  TInt1 arr;
1183  for ( size_t row = 0; ; ++row ) {
1184  Int1 value;
1185  if ( !TryGetInt1WithRounding(row, value) ) {
1186  break;
1187  }
1188  arr.push_back(value);
1189  }
1190  Reset();
1191  swap(SetInt1(), arr);
1192 }
1193 
1194 
1196 {
1197  if ( IsInt2() ) {
1198  return;
1199  }
1200  TInt2 arr;
1201  for ( size_t row = 0; ; ++row ) {
1202  Int2 value;
1203  if ( !TryGetInt2WithRounding(row, value) ) {
1204  break;
1205  }
1206  arr.push_back(value);
1207  }
1208  Reset();
1209  swap(SetInt2(), arr);
1210 }
1211 
1212 
1214 {
1215  if ( IsInt8() ) {
1216  return;
1217  }
1218  TInt8 arr;
1219  for ( size_t row = 0; ; ++row ) {
1220  Int8 value;
1221  if ( !TryGetInt8WithRounding(row, value) ) {
1222  break;
1223  }
1224  arr.push_back(value);
1225  }
1226  Reset();
1227  swap(SetInt8(), arr);
1228 }
1229 
1230 
1232 {
1233  if ( IsReal() ) {
1234  return;
1235  }
1236  TReal arr;
1237  for ( size_t row = 0; ; ++row ) {
1238  double value;
1239  if ( !TryGetReal(row, value) ) {
1240  break;
1241  }
1242  arr.push_back(TInt::value_type(value));
1243  }
1244  Reset();
1245  swap(SetReal(), arr);
1246 }
1247 
1248 
1250 {
1251  if ( IsBit() ) {
1252  return;
1253  }
1254  TBit arr;
1255  if ( IsBit_bvector() ) {
1256  const bm::bvector<>& bv = GetBit_bvector().GetBitVector();
1257  arr.reserve((bv.size()+7)/8);
1258  if ( bv.any() ) {
1259  size_t last_byte_index = 0;
1260  Uint1 last_byte = 0;
1261  bm::id_t i = bv.get_first();
1262  do {
1263  size_t byte_index = i / 8;
1264  if ( byte_index != last_byte_index ) {
1265  arr.resize(last_byte_index);
1266  arr.push_back(last_byte);
1267  last_byte_index = byte_index;
1268  last_byte = 0;
1269  }
1270  size_t bit_index = i % 8;
1271  last_byte |= 0x80 >> bit_index;
1272  } while ( (i=bv.get_next(i)) );
1273  if ( last_byte ) {
1274  arr.resize(last_byte_index);
1275  arr.push_back(last_byte);
1276  }
1277  }
1278  arr.resize((bv.size()+7)/8);
1279  }
1280  else if ( CanGetInt() ) {
1281  size_t size = GetSize();
1282  arr.resize((size+7)/8);
1283  for ( size_t i = 0; i < size; ++i ) {
1284  int v;
1285  if ( !TryGetInt(i, v) ) {
1286  NCBI_THROW(CSeqTableException, eIncompatibleValueType,
1287  "CSeqTable_multi_data::ChangeToBit(): "
1288  "multi-data value cannot be converted to int");
1289  }
1290  if ( v < 0 || v > 1 ) {
1291  NCBI_THROW(CSeqTableException, eIncompatibleValueType,
1292  "CSeqTable_multi_data::ChangeToBit(): "
1293  "multi-data value is not 0 or 1");
1294  }
1295  if ( v ) {
1296  arr[i/8] |= 0x80 >> i%8;
1297  }
1298  }
1299  }
1300  else {
1301  NCBI_THROW(CSeqTableException, eIncompatibleValueType,
1302  "CSeqTable_multi_data::ChangeToBit(): "
1303  "requested mult-data type is invalid");
1304  }
1305  Reset();
1306  swap(SetBit(), arr);
1307 }
1308 
1309 
1311 {
1312  if ( IsBit_bvector() ) {
1313  return;
1314  }
1315  typedef bm::bvector<>::size_type TBVSize;
1316  TBVSize size = static_cast<TBVSize>(GetSize());
1318  if ( IsBit() ) {
1319  const TBit& src = GetBit();
1320  for ( TBVSize i = 0; i < size; i += 8 ) {
1321  for ( Uint1 b = src[i/8], j = 0; b & 0xff; ++j, b <<= 1 ) {
1322  if ( b&0x80 ) {
1323  bv->set_bit(i+j);
1324  }
1325  }
1326  }
1327  }
1328  else if ( CanGetInt() ) {
1329  for ( TBVSize i = 0; i < size; ++i ) {
1330  int v;
1331  if ( !TryGetInt(i, v) ) {
1332  NCBI_THROW(CSeqTableException, eIncompatibleValueType,
1333  "CSeqTable_multi_data::ChangeToBit_bvector(): "
1334  "multi-data value cannot be converted to int");
1335  }
1336  if ( v < 0 || v > 1 ) {
1337  NCBI_THROW(CSeqTableException, eIncompatibleValueType,
1338  "CSeqTable_multi_data::ChangeToBit_bvector(): "
1339  "multi-data value is not 0 or 1");
1340  }
1341  if ( v ) {
1342  bv->set_bit(i);
1343  }
1344  }
1345  }
1346  else {
1347  NCBI_THROW(CSeqTableException, eIncompatibleValueType,
1348  "CSeqTable_multi_data::ChangeToBit_bvector(): "
1349  "requested multi-data type is invalid");
1350  }
1351  bv->optimize();
1353 }
1354 
1355 
1356 END_objects_SCOPE // namespace ncbi::objects::
1357 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
NCBI_PARAM_DEF_EX(bool, OBJECTS, SEQ_TABLE_RESERVE, true, eParam_NoThread, OBJECTS_SEQ_TABLE_RESERVE)
#define USE_DELTA_CACHE
DEFINE_STATIC_MUTEX(sx_PrepareMutex_multi_data)
static bool sx_TryGet(const Arr &arr, Row row, Int &v)
static bool sx_Round(DstInt &v, double value, const char *cast_error)
static bool sx_DownCastInt8(DstInt &v, const Int8 &value, const char *type_name)
NCBI_PARAM_DECL(bool, OBJECTS, SEQ_TABLE_RESERVE)
User-defined methods of the data storage class.
User-defined methods of the data storage class.
static char * s_Reserve(size_t size, CSimpleBufferT< char > &buffer)
Definition: bgzf.cpp:285
static const signed char indexes[2][4][20]
Definition: camellia.c:187
AutoPtr –.
Definition: ncbimisc.hpp:401
const bm::bvector & GetBitVector(void) const
void SetBitVector(const bm::bvector<> *bv)
CCommonBytes_table –.
CCommonString_table –.
static const size_t kBlockSize
Definition: delta_cache.hpp:71
AutoArray< TValue > m_CacheBlockInfo
Definition: delta_cache.hpp:86
AutoArray< TValue > m_Blocks
Definition: delta_cache.hpp:77
TValue GetDeltaSum4(const TDeltas &deltas, size_t index)
TValue x_GetDeltaSum2(const TDeltas &deltas, size_t block_index, size_t block_offset)
TValue x_GetDeltaSum2(const TDeltas &deltas, size_t block_index, size_t block_offset)
TValue GetDeltaSum8(const TDeltas &deltas, size_t index)
AutoArray< TValue > m_Blocks
AutoArray< TValue > m_CacheBlockInfo
static const size_t kBlockSize
virtual Int8 GetDeltaSum8(const TDeltas &deltas, size_t index)
virtual ~CIntDeltaSumCache(void)
virtual Int4 GetDeltaSum4(const TDeltas &deltas, size_t index)
CObjectIStream –.
Definition: objistr.hpp:93
CObjectInfoCV –.
Definition: objectiter.hpp:588
CRef –.
Definition: ncbiobj.hpp:618
CSafeStatic<>::
bool TryGetInt8(size_t row, Int8 &v) const
bool TryGetReal(size_t row, double &v) const
Seq-loc and seq-align mapper exceptions.
virtual void PreReadChoiceVariant(CObjectIStream &in, const CObjectInfoCV &variant)
Return true to invoke default reading method afterwards.
bool TryGetInt8(size_t row, Int8 &v) const
bool TryGetInt4(size_t row, Int4 &v) const
bool TryGetInt1(size_t row, Int1 &v) const
void ChangeToCommon_bytes(const TBytesValue *omit_value=0)
bool TryGetInt1WithRounding(size_t row, Int1 &v) const
bool TryGetReal(size_t row, double &v) const
CIntDeltaSumCache & x_GetIntDeltaCache(void) const
void ChangeToString(const string *omitted_value=0)
const string * GetStringPtr(size_t row) const
bool TryGetInt(size_t row, int &v) const
size_t GetIntSize(void) const
E_Choice GetValueType(void) const
void ChangeTo(E_Choice type)
bool TryGetInt8WithRounding(size_t row, Int8 &v) const
bool x_TryGetInt8(size_t row, Int8 &v, const char *type_name) const
const TBytesValue * GetBytesPtr(size_t row) const
bool TryGetInt2WithRounding(size_t row, Int2 &v) const
void ChangeToCommon_string(const string *omit_value=0)
CRef< CIntDeltaSumCache > m_Cache
size_t GetSize(void) const
bool TryGetBool(size_t row, bool &v) const
bool TryGetInt2(size_t row, Int2 &v) const
bool TryGetIntWithRounding(size_t row, int &v) const
void ChangeToReal_scaled(double mul, double add)
bool TryGetValue(size_t row, Int1 &v) const
void ChangeToBytes(const TBytesValue *omitted_value=0)
bool TryGetInt4WithRounding(size_t row, Int4 &v) const
void ChangeToInt_scaled(int mul, int add)
bool any() const noexcept
Returns true if any bits in this bitset are set, and otherwise returns false.
Definition: bm.h:2451
size_type size() const noexcept
Returns bvector's capacity (number of bits it can store)
Definition: bm.h:1300
bvector_size_type size_type
Definition: bm.h:121
size_type get_next(size_type prev) const noexcept
Finds the number of the next bit ON.
Definition: bm.h:1609
size_type get_first() const noexcept
find first 1 bit in vector. Function may return 0 and this requires an extra check if bit 0 is actual...
Definition: bm.h:1600
Definition: map.hpp:338
static ulg bb
char data[12]
Definition: iconv.c:80
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
Definition: ncbimisc.hpp:822
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
Definition: ncbimisc.hpp:1508
element_type * release(void)
Release will release ownership of pointer to caller.
Definition: ncbimisc.hpp:472
#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
#define NCBI_THROW_FMT(exception_class, err_code, message)
The same as NCBI_THROW but with message processed as output to ostream.
Definition: ncbiexpt.hpp:719
static C * Get(const CTypesIterator &it)
Definition: objecttype.hpp:116
const CObjectInfo & GetChoiceObject(void) const
Get containing choice.
TMemberIndex GetVariantIndex(void) const
Get index of the variant in the choice.
TObjectType * GetNCPointerOrNull(void) const THROWS_NONE
Get pointer value.
Definition: ncbiobj.hpp:1162
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
#define NCBI_PARAM_TYPE(section, name)
Generate typename for a parameter from its {section, name} attributes.
Definition: ncbi_param.hpp:149
@ eParam_NoThread
Do not use per-thread values.
Definition: ncbi_param.hpp:418
#define kMin_Int
Definition: ncbi_limits.h:183
uint8_t Uint1
1-byte (8-bit) unsigned integer
Definition: ncbitype.h:99
int16_t Int2
2-byte (16-bit) signed integer
Definition: ncbitype.h:100
int32_t Int4
4-byte (32-bit) signed integer
Definition: ncbitype.h:102
#define kMax_Int
Definition: ncbi_limits.h:184
#define kMax_I2
Definition: ncbi_limits.h:215
#define kMax_I1
Definition: ncbi_limits.h:212
int64_t Int8
8-byte (64-bit) signed integer
Definition: ncbitype.h:104
int8_t Int1
1-byte (8-bit) signed integer
Definition: ncbitype.h:98
#define kMin_I2
Definition: ncbi_limits.h:214
#define kMin_I1
Definition: ncbi_limits.h:211
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
bool IsBit(void) const
Check if variant Bit is selected.
const TData & GetData(void) const
Get the Data member data.
void SetData(TData &value)
Assign a value to Data data member.
TReal & SetReal(void)
Select the variant.
void SetMin(TMin value)
Assign a value to Min data member.
const TReal_scaled & GetReal_scaled(void) const
Get the variant data.
TString & SetString(void)
Select the variant.
bool IsString(void) const
Check if variant String is selected.
const TInt2 & GetInt2(void) const
Get the variant data.
const TIndexes & GetIndexes(void) const
Get the Indexes member data.
const TInt1 & GetInt1(void) const
Get the variant data.
bool IsInt_delta(void) const
Check if variant Int_delta is selected.
const TInterval & GetInterval(void) const
Get the variant data.
void SetMax(TMax value)
Assign a value to Max data member.
const TBit & GetBit(void) const
Get the variant data.
bool IsInt1(void) const
Check if variant Int1 is selected.
const TIndexes & GetIndexes(void) const
Get the Indexes member data.
const TInt_delta & GetInt_delta(void) const
Get the variant data.
bool IsBit_bvector(void) const
Check if variant Bit_bvector is selected.
TInt2 & SetInt2(void)
Select the variant.
TBit_bvector & SetBit_bvector(void)
Select the variant.
const TCommon_string & GetCommon_string(void) const
Get the variant data.
bool IsReal(void) const
Check if variant Real is selected.
const TBit_bvector & GetBit_bvector(void) const
Get the variant data.
const TInt_scaled & GetInt_scaled(void) const
Get the variant data.
const TReal & GetReal(void) const
Get the variant data.
bool IsInt8(void) const
Check if variant Int8 is selected.
bool IsInt_scaled(void) const
Check if variant Int_scaled is selected.
bool IsInt(void) const
Check if variant Int is selected.
bool IsBytes(void) const
Check if variant Bytes is selected.
const TLoc & GetLoc(void) const
Get the variant data.
TInt8 & SetInt8(void)
Select the variant.
vector< vector< char > * > TBytes
const TInt8 & GetInt8(void) const
Get the variant data.
bool IsReal_scaled(void) const
Check if variant Real_scaled is selected.
TInt1 & SetInt1(void)
Select the variant.
TReal_scaled & SetReal_scaled(void)
Select the variant.
TInt & SetInt(void)
Select the variant.
bool IsCommon_bytes(void) const
Check if variant Common_bytes is selected.
TInt_delta & SetInt_delta(void)
Select the variant.
const TInt & GetInt(void) const
Get the variant data.
virtual void Reset(void)
Reset the whole object.
TBit & SetBit(void)
Select the variant.
const TBytes & GetBytes(void) const
Get the Bytes member data.
TInt_scaled & SetInt_scaled(void)
Select the variant.
const TData & GetData(void) const
Get the Data member data.
const TCommon_bytes & GetCommon_bytes(void) const
Get the variant data.
vector< CStringUTF8 > TStrings
TCommon_string & SetCommon_string(void)
Select the variant.
TCommon_bytes & SetCommon_bytes(void)
Select the variant.
vector< vector< char > * > TBytes
const TBytes & GetBytes(void) const
Get the variant data.
const TString & GetString(void) const
Get the variant data.
bool IsInt2(void) const
Check if variant Int2 is selected.
TSize GetSize(void) const
Get the Size member data.
E_Choice Which(void) const
Which variant is currently selected.
bool IsCommon_string(void) const
Check if variant Common_string is selected.
const TId & GetId(void) const
Get the variant data.
const TStrings & GetStrings(void) const
Get the Strings member data.
TBytes & SetBytes(void)
Select the variant.
@ e_Int8
a set of signed 8-byte integers
@ e_Int_scaled
scaled data (int/bit -> int)
@ e_Real
a set of reals, one per row
@ e_Int1
a set of signed 1-byte integers encoded as sequential octets
@ e_Loc
a set of locations, one per row
@ e_Common_bytes
a set of byte arrays with small set of possible values
@ e_Int_delta
delta-encoded data (int/bit -> int)
@ e_Bytes
a set of byte arrays, one per row
@ e_String
a set of strings, one per row
@ e_Bit
a set of bits, one per row Most-significant bit in each octet comes first.
@ e_Int2
a set of signed 2-byte integers
@ e_Int
a set of 4-byte integers, one per row
@ e_Common_string
a set of string with small set of possible values
@ e_Real_scaled
scaled data (int/bit -> real)
@ e_Bit_bvector
a set of bit, represented as serialized bvector, see include/util/bitset/bm.h
unsigned int
A callback function used to compare two keys in a database.
Definition: types.hpp:1210
<!DOCTYPE HTML >< html > n< header > n< title > PubSeq Gateway Help Page</title > n< style > n table
int i
static MDB_envinfo info
Definition: mdb_load.c:37
unsigned int id_t
Definition: bmconst.h:38
double value_type
The numeric datatype used by the parser.
Definition: muParserDef.h:228
const struct ncbi::grid::netcache::search::fields::SIZE size
const struct ncbi::grid::netcache::search::fields::KEY key
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Compressed bitset (entry point to bm.h)
T max(T x_, T y_)
T min(T x_, T y_)
std::istream & in(std::istream &in_, double &x_)
#define row(bind, expected)
Definition: string_bind.c:73
Compare objects pointed to by (smart) pointer.
Definition: ncbiutil.hpp:67
Definition: type.c:6
#define _ASSERT
static const char * type_name(CS_INT value)
Definition: will_convert.c:122
Modified on Sun Apr 14 05:25:05 2024 by modify_doxy.py rev. 669887