1 #ifndef SRA__READER__SRA__VDBREAD__HPP
2 #define SRA__READER__SRA__VDBREAD__HPP
127 void x_InitNew(
void);
155 bool IsLocalFile()
const;
160 static bool IsPlainAccession(
const string& acc_or_path);
164 static string ConvertSysPathToPOSIX(
const string& sys_path);
169 static string ConvertAccOrSysPathToPOSIX(
const string& acc_or_path);
208 string Resolve(
const string& acc)
const;
216 :
public CSraRef<const VDBManager>
222 string FindAccPath(
const string& acc)
const;
224 string FindDereferencedAccPath(
const string& acc_or_path)
const;
233 string GetCacheRoot()
const;
236 void SetCacheRoot(
const string& path);
239 void DeleteCacheOlderThan(
Uint4 days);
242 void CommitConfig()
const;
253 CTime GetTimestamp(
const string& path)
const;
255 CTime GetURLTimestamp(
const string& url)
const;
266 :
public CSraRef<const VDatabase>
272 CVDB(
const CVDBMgr& mgr,
const string& acc_or_path);
307 EMissing missing = eMissing_Throw);
309 const string& acc_or_path,
310 EMissing missing = eMissing_Throw);
320 string GetFullName(
void)
const;
346 const char* index_name,
347 EMissing missing = eMissing_Throw);
357 string GetFullName(
void)
const;
373 :
public CSraRef<const VCursor>
399 return OpenRowRc(row_id) == 0;
443 typedef pair<TVDBRowId, CRef<CObject> >
TSlot;
453 template<
class Object>
483 m_Index(kInvalidIndex)
490 Init(cursor, 0, name,
NULL, missing);
494 const char* backup_name =
NULL,
497 Init(cursor, 0, name, backup_name, missing);
500 size_t element_bit_size,
502 const char* backup_name =
NULL,
505 Init(cursor, element_bit_size, name, backup_name, missing);
508 bool IsStatic(
const CVDBCursor& cursor)
const;
512 m_Index = kInvalidIndex;
514 void ResetIfAlwaysEmpty(
const CVDBCursor& cursor);
536 size_t element_bit_size,
538 const char* backup_name,
547 template<
size_t ElementBitSize>
556 const char* backup_name =
NULL,
558 :
CVDBColumn(cursor, ElementBitSize, name, backup_name, missing)
565 #define DECLARE_VDB_COLUMN(name) \
566 CVDBValue::SRef name(TVDBRowId row, CVDBValue::EMissing missing = CVDBValue::eMissing_Throw) const { \
567 return CVDBValue::SRef(m_Cursor, row, NCBI_NAME2(m_,name), missing); \
569 CVDBColumn NCBI_NAME2(m_, name)
572 #define DECLARE_VDB_COLUMN_AS(type, name) \
573 CVDBValueFor<type> name(TVDBRowId row, CVDBValue::EMissing missing = CVDBValue::eMissing_Throw) const { \
574 return CVDBValueFor<type>(m_Cursor, row, NCBI_NAME2(m_,name), missing); \
576 CVDBColumnBits<sizeof(type)*8> NCBI_NAME2(m_, name)
579 #define DECLARE_VDB_COLUMN_AS_STRING(name) \
580 CVDBStringValue name(TVDBRowId row, CVDBValue::EMissing missing = CVDBValue::eMissing_Throw) const { \
581 return CVDBStringValue(m_Cursor, row, NCBI_NAME2(m_,name), missing); \
583 CVDBColumnBits<8> NCBI_NAME2(m_, name)
586 #define DECLARE_VDB_COLUMN_AS_4BITS(name) \
587 CVDBValueFor4Bits name(TVDBRowId row) const { \
588 return CVDBValueFor4Bits(m_Cursor, row, NCBI_NAME2(m_,name)); \
590 CVDBColumnBits<4> NCBI_NAME2(m_, name)
593 #define INIT_VDB_COLUMN(name) \
594 NCBI_NAME2(m_, name)(m_Cursor, #name)
595 #define INIT_VDB_COLUMN_BACKUP(name, backup_name) \
596 NCBI_NAME2(m_, name)(m_Cursor, #name, #backup_name)
597 #define INIT_VDB_COLUMN_AS(name, type) \
598 NCBI_NAME2(m_, name)(m_Cursor, "("#type")"#name)
599 #define INIT_OPTIONAL_VDB_COLUMN(name) \
600 NCBI_NAME2(m_, name)(m_Cursor, #name, NULL, CVDBColumn::eMissing_Allow)
601 #define INIT_OPTIONAL_VDB_COLUMN_BACKUP(name, backup_name) \
602 NCBI_NAME2(m_, name)(m_Cursor, #name, #backup_name, CVDBColumn::eMissing_Allow)
603 #define INIT_OPTIONAL_VDB_COLUMN_AS(name, type) \
604 NCBI_NAME2(m_, name)(m_Cursor, "("#type")"#name, NULL, CVDBColumn::eMissing_Allow)
619 : cursor(cur),
column(col), row(
r)
629 : m_Table(0), m_ColumnName(0), m_Row(0)
638 m_ColumnName =
column.GetName();
664 x_Get(cursor, row,
column, missing);
673 const char* param_name,
const CTempString& param_value,
678 cursor.
SetParam(param_name, param_value);
693 return m_Ref.PrintFullName(
out);
702 EMissing missing = eMissing_Throw);
704 void x_ReportIndexOutOfBounds(
size_t index)
const;
705 void x_ReportNotOneValue(
void)
const;
708 if ( index >=
size() ) {
709 x_ReportIndexOutOfBounds(index);
712 void x_CheckRange(
size_t pos,
size_t len)
const;
716 x_ReportNotOneValue();
750 x_Get(cursor, row,
column);
773 return x_ValueByRawIndex(index+raw_offset());
784 return m_Ref.PrintFullName(
out);
793 return sub_index? (v&0xf): (v>>4);
797 return sub_value(raw_data()[raw_index/2], raw_index%2);
800 void x_ReportIndexOutOfBounds(
size_t index)
const;
803 if ( index >=
size() ) {
804 x_ReportIndexOutOfBounds(index);
807 void x_CheckRange(
size_t pos,
size_t len)
const;
849 x_Get(cursor, row,
column);
872 return x_ValueByRawIndex(index+raw_offset());
883 return m_Ref.PrintFullName(
out);
892 return (v>>(6-2*sub_index))&3;
896 return sub_value(raw_data()[raw_index/4], raw_index%4);
899 void x_ReportIndexOutOfBounds(
size_t index)
const;
902 if ( index >=
size() ) {
903 x_ReportIndexOutOfBounds(index);
906 void x_CheckRange(
size_t pos,
size_t len)
const;
946 const char* param_name,
const CTempString& param_value,
998 operator double(
void)
const;
1024 const char* param_name,
const CTempString& param_value,
1032 return static_cast<const char*
>(
m_Data);
1059 #ifndef NCBI_OS_MSWIN
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
CVDBColumnBits(const CVDBCursor &cursor, const char *name, const char *backup_name=NULL, EMissing missing=eMissing_Throw)
CVDBColumn(const CVDBCursor &cursor, const char *name, EMissing missing)
DECLARE_OPERATOR_BOOL(m_Index !=kInvalidIndex)
CVDBColumn(const CVDBCursor &cursor, size_t element_bit_size, const char *name, const char *backup_name=NULL, EMissing missing=eMissing_Throw)
TVDBColumnIdx GetIndex(void) const
const char * GetName(void) const
CVDBColumn(const CVDBCursor &cursor, const char *name, const char *backup_name=NULL, EMissing missing=eMissing_Throw)
TVDBRowIdRange GetRowIdRange(const CVDBCursor &cursor) const
bool RowIsOpened(void) const
CVDBCursor(const CVDBTable &table)
const CVDBTable & GetTable(void) const
void SetParam(const char *name, const CTempString &value) const
bool TryOpenRow(TVDBRowId row_id)
TVDBRowIdRange GetRowIdRange(TVDBColumnIdx column=0) const
CRequestContextUpdater(const CRequestContextUpdater &)=delete
CObject * Get(TVDBRowId row)
CVDBObjectCacheBase(const CVDBObjectCacheBase &)
void Put(CObject *curs, TVDBRowId row)
pair< TVDBRowId, CRef< CObject > > TSlot
void operator=(const CVDBObjectCacheBase &)
void Put(CRef< Object > &ref, TVDBRowId row=0)
CRef< Object > Get(TVDBRowId row=0)
CVDBStringValue(const CVDBCursor &cursor, TVDBRowId row, const CVDBColumn &column, EMissing missing=eMissing_Throw)
CVDBStringValue(const CVDBValue::SRef &ref)
const char * data(void) const
CVDBStringValue(CVDBCursor &cursor, const char *param_name, const CTempString ¶m_value, const CVDBColumn &column)
CVDBStringValue(const CVDBCursor &cursor, const CVDBColumn &column)
CTempString operator*(void) const
const char * GetName(void) const
const CVDBTable & GetTable(void) const
const CVDB & GetDb(void) const
const string & GetName(void) const
uint32_t size(void) const
TValue x_ValueByRawIndex(size_t raw_index) const
CVDBValueFor2Bits(const CVDBValue::SSaveRef &ref, const char *raw, uint32_t offset, uint32_t sz)
uint32_t raw_offset(void) const
const char * raw_data(void) const
CVDBValueFor2Bits(const CVDBCursor &cursor, TVDBRowId row, const CVDBColumn &column)
CVDBValue::SSaveRef m_Ref
static TValue sub_value(uint8_t v, size_t sub_index)
CNcbiOstream & PrintFullName(CNcbiOstream &out) const
CVDBValueFor2Bits(const CVDBValue::SRef &ref)
TValue operator[](size_t index) const
void x_CheckIndex(size_t index) const
TValue Value(size_t index) const
CVDBValueFor4Bits(const CVDBCursor &cursor, TVDBRowId row, const CVDBColumn &column)
TValue operator[](size_t index) const
TValue x_ValueByRawIndex(size_t raw_index) const
void x_CheckIndex(size_t index) const
uint32_t raw_offset(void) const
CVDBValue::SSaveRef m_Ref
const char * raw_data(void) const
static TValue sub_value(uint8_t v, size_t sub_index)
uint32_t size(void) const
CNcbiOstream & PrintFullName(CNcbiOstream &out) const
TValue Value(size_t index) const
CVDBValueFor4Bits(const CVDBValue::SRef &ref)
CVDBValueFor4Bits(const CVDBValue::SSaveRef &ref, const char *raw, uint32_t offset, uint32_t sz)
CVDBValueFor(const CVDBCursor &cursor, TVDBRowId row, const CVDBColumn &column, EMissing missing=eMissing_Throw)
const_iterator end() const
const TValue & operator*(void) const
CVDBValueFor< TValue > substr(size_t pos, size_t len) const
CVDBValueFor(CVDBCursor &cursor, const char *param_name, const CTempString ¶m_value, const CVDBColumn &column)
CVDBValueFor(const CVDBCursor &cursor, const CVDBColumn &column)
const TValue & operator[](size_t i) const
CVDBValueFor(const CVDBValue::SRef &ref)
const TValue * const_iterator
const TValue * data() const
const_iterator begin() const
const TValue * operator->(void) const
const TValue & Value(void) const
void x_CheckRange(size_t pos, size_t len) const
CNcbiOstream & PrintFullName(CNcbiOstream &out) const
CVDBValue(const CVDBCursor &cursor, TVDBRowId row, const CVDBColumn &column, EMissing missing=eMissing_Throw)
CVDBValue(const CVDBCursor &cursor, const CVDBColumn &column)
CVDBValue(const SRef &ref)
void x_CheckOneValue(void) const
CVDBValue(const CVDBCursor &cursor, const char *param_name, const CTempString ¶m_value, const CVDBColumn &column)
void x_CheckIndex(size_t index) const
const string & GetFullName(void) const
const string & GetName(void) const
static string ConvertAccOrSysPathToPOSIX(const string &acc_or_path)
static string ConvertSysPathToPOSIX(const string &sys_path)
CSraRef< const VPath > TParent
CVPath(const VPath *path)
Include a standard set of the NCBI C++ Toolkit most basic headers.
std::ofstream out("events_result.xml")
main entry point for tests
#define NCBI_DEPRECATED_CTOR(decl)
Macro used to mark a constructor as deprecated.
TObjectType * ReleaseOrNull(void)
Release a reference to the object and return a pointer to the object.
uint32_t Uint4
4-byte (32-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
#define NCBI_SRAREAD_EXPORT
<!DOCTYPE HTML >< html > n< header > n< title > PubSeq Gateway Help Page</title > n< style > n table
const TYPE & Get(const CNamedParameterList *param)
const struct ncbi::grid::netcache::search::fields::SIZE size
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
static const char table_name[]
static pcre_uint8 * buffer
@ Resolve
Try to resolve provided seq-ids.
static const char * column
unsigned __int64 uint64_t
SRef(const CVDBCursor &cur, TVDBRowId r, const CVDBColumn &col)
const CVDBColumn & column
const CVDBCursor & cursor
void Set(const CVDBCursor &cursor, TVDBRowId row, const CVDBColumn &column)
const CVDBTable * m_Table
const char * m_ColumnName
DECLARE_SRA_REF_TRAITS(VDBManager, const)
CVDBValueFor< uint16_t > CVDBUInt16Value
pair< TVDBRowId, TVDBRowCount > TVDBRowIdRange
CVDBValueFor< char > CVDBBytesValue
string ToString(const wxRect &rc)