UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
tr_bodies_cache_qsql.hpp
1 /* tr_bodies_cache_qsql.hpp */
2 /* $Id$ */
3 #ifndef __tr_bodies_cache_qsql_hpp
4 #define __tr_bodies_cache_qsql_hpp
5 
6 #include <QSqlQuery>
7 #include <hds_db/base/defines.hpp>
9 
11 namespace hds
12 {
14  namespace db
15  {
16  class SeismicQSql;
17 
20  {
21  public:
22 
25 
30  const size_t read_cache_size,
31  const size_t write_cache_size);
32 
34  void init(SeismicQSql *pseis,
35  const size_t read_cache_size,
36  const size_t write_cache_size);
37 
41  const TrBody& get(const DbIndex &id);
42 
46  void update(const DbIndex &id, const TrBody &body);
47 
51  DbIndex append(const TrBody &body);
52 
55  void clear();
56 
59  void flush();
60 
65  ErrCode lastError() const {return m_last_error;}
66 
67  protected:
68 
71 
74 
76  ErrCode m_last_error;
77 
78  QSqlQuery m_get_body_query;
79  QSqlQuery m_update_body_query;
80  QSqlQuery m_append_body_query;
81 
82  ErrCode db_get_body(const DbIndex &trace_id, TrBody &body);
83 
84  ErrCode db_update_body(const DbIndex &trace_id, const TrBody &body);
85 
86  ErrCode db_append_body(const TrBody &body, DbIndex &trace_id);
87  };
88 
89  }; // db
90 }; // hds
91 
92 #endif /* tr_bodies_cache_qsql.hpp */
ErrCode lastError() const
Definition: tr_bodies_cache_qsql.hpp:65
uint64_t DbIndex
Definition: defines.hpp:26
void init(SeismicQSql *pseis, const size_t read_cache_size, const size_t write_cache_size)
void update(const DbIndex &id, const TrBody &body)
ErrCode
Definition: defines.hpp:46
std::vector< AmplT > TrBody
Definition: defines.hpp:23
Definition: seismic_qsql.hpp:24
SeismicQSql * mp_seis
Definition: tr_bodies_cache_qsql.hpp:73
Definition: tr_bodies_cache_qsql.hpp:19
LRUCache< DbIndex, hds::db::TrBody > m_cache
Definition: tr_bodies_cache_qsql.hpp:70
DbIndex append(const TrBody &body)