UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
hds::db::TrHdrsCacheQSql Class Reference

#include <tr_hdrs_cache_qsql.hpp>

Public Member Functions

 TrHdrsCacheQSql ()
 
 TrHdrsCacheQSql (SeismicQSql *pseis, const size_t read_cache_size, const size_t write_cache_size)
 
void init (SeismicQSql *pseis, const size_t read_cache_size, const size_t write_cache_size)
 
const TrHeaderget (const DbIndex &id)
 
void update (const DbIndex &id, const TrHeader &hdr)
 
DbIndex append (const TrHeader &hdr)
 
void clear ()
 
void flush ()
 
ErrCode lastError () const
 

Protected Member Functions

ErrCode db_get_header (const DbIndex &trace_id, TrHeader &hdr)
 
ErrCode db_update_header (const DbIndex &trace_id, const TrHeader &hdr)
 
ErrCode db_append_header (const TrHeader &hdr, DbIndex &trace_id)
 
ErrCode db_cache_all_headers (LRUCache< DbIndex, TrHeader > &hdrs_cache)
 
ErrCode query2hdr (const QSqlQuery &query, TrHeader &hdr) const
 

Protected Attributes

LRUCache< DbIndex,
hds::db::TrHeader
m_cache
 
SeismicQSqlmp_seis
 
ErrCode m_last_error
 
QSqlQuery m_get_hdr_query
 
QSqlQuery m_get_all_hdrs_query
 
QSqlQuery m_update_hdr_query
 
QSqlQuery m_append_hdr_query
 

Detailed Description

Cached access to headers.

Constructor & Destructor Documentation

hds::db::TrHdrsCacheQSql::TrHdrsCacheQSql ( )

Default empty cache constructur.

hds::db::TrHdrsCacheQSql::TrHdrsCacheQSql ( SeismicQSql pseis,
const size_t  read_cache_size,
const size_t  write_cache_size 
)
Construct cache with seismic and sizes provided. 

Seismic not copied, just store a pointer.

Member Function Documentation

DbIndex hds::db::TrHdrsCacheQSql::append ( const TrHeader hdr)
Append new header. lastError() gets correpondent error code.
Returns
index of trace for header appended.
void hds::db::TrHdrsCacheQSql::clear ( )

Clear cache data. Can't generate any error.

ErrCode hds::db::TrHdrsCacheQSql::db_cache_all_headers ( LRUCache< DbIndex, TrHeader > &  hdrs_cache)
protected

Get all headers from database and push them to cache provided.

void hds::db::TrHdrsCacheQSql::flush ( )

Flush all unsaved data into database. lastError() gets correpondent error code.

const TrHeader& hds::db::TrHdrsCacheQSql::get ( const DbIndex id)
Get header with provided id. On error return default header 

and lastError() gets correpondent error code.

void hds::db::TrHdrsCacheQSql::init ( SeismicQSql pseis,
const size_t  read_cache_size,
const size_t  write_cache_size 
)

Initialize cache. lastError() gets correpondent error code.

ErrCode hds::db::TrHdrsCacheQSql::lastError ( ) const
inline
Get current error code. 
Returns
EC_NO_ERROR if the last interaction with object is correct. Otherwise return correspondent error code.
void hds::db::TrHdrsCacheQSql::update ( const DbIndex id,
const TrHeader hdr 
)

Update header with provided id. lastError() gets correpondent error code.

Member Data Documentation

LRUCache<DbIndex, hds::db::TrHeader> hds::db::TrHdrsCacheQSql::m_cache
protected

< Cache storage. Current seismic object.

SeismicQSql* hds::db::TrHdrsCacheQSql::mp_seis
protected

Current last error.


The documentation for this class was generated from the following file: