ddc
ConcSessionContext.h
Go to the documentation of this file.
1 //*-*- Mode: C++ -*- */
2 //
3 // DDC originally by Alexey Sokirko
4 // Changes and modifications 2011-2016 by Bryan Jurish
5 //
6 // This file is part of DDC (formerly in ConcHolder.h)
7 //
8 // DDC is free software: you can redistribute it and/or modify
9 // it under the terms of the GNU Lesser General Public License as published by
10 // the Free Software Foundation, either version 3 of the License, or
11 // (at your option) any later version.
12 //
13 // DDC is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public License
19 // along with DDC. If not, see <http://www.gnu.org/licenses/>.
20 //
21 #ifndef DDC_CONC_SESSION_CONTEXT_H
22 #define DDC_CONC_SESSION_CONTEXT_H
23 
24 #include "ConcHolder.h"
25 #include "../CommonLib/ddcThread.h"
26 
27 //==============================================================================
33 {
34 public:
36  map<string, CQueryResult> m_QueryCache;
37 
39  deque<string> m_Queries;
40 
41 public:
42  //----------------------------------------------------------------------
43  // \name Constructors etc.
45 
47  {};
48 
51  {};
53 
54 public:
55  //----------------------------------------------------------------------
56  // \name API: caching
58 
66  bool CacheGet(CConcHolder& Holder, const string &Query, DWORD& EndHitNo);
67 
76  void CacheSet(CConcHolder& Holder, const string& Query, vector<size_t>::const_iterator start, vector<size_t>::const_iterator end);
77 
79  void CacheClear();
80 
82  size_t CacheSize();
84 
85  //----------------------------------------------------------------------
86  // API: locking : now in ddcLockable base class
87  //inline int lock();
88  //inline int unlock();
89 };
90 
91 
92 #endif /* DDC_CONC_SESSION_CONTEXT_H */
93 
94 /*--- emacs style variables ---
95  * Local Variables:
96  * mode: C++
97  * c-file-style: "ellemtel"
98  * c-basic-offset: 4
99  * tab-width: 8
100  * indent-tabs-mode: nil
101  * End:
102  */
generic lockable object wrapper class
Definition: ddcThread.h:30
void CacheSet(CConcHolder &Holder, const string &Query, vector< size_t >::const_iterator start, vector< size_t >::const_iterator end)
Definition: ConcSessionContext.cpp:107
deque< string > m_Queries
a deque for last MaxQueryCacheSize queries; m_Queries.last() is the last given query ...
Definition: ConcSessionContext.h:39
CConcSessionContext()
Definition: ConcSessionContext.h:46
map< string, CQueryResult > m_QueryCache
hit results for the last MaxQueryCacheSize queries
Definition: ConcSessionContext.h:36
void CacheClear()
Definition: ConcSessionContext.cpp:171
common session data, sharable by multiple worker threads extracted from ddc-2.0.x CConcHolder; now C...
Definition: ConcSessionContext.h:32
class for a single (thread-local) DDC query session; formerly CConcHolder An instance of CConcSessio...
Definition: ConcSession.h:54
bool CacheGet(CConcHolder &Holder, const string &Query, DWORD &EndHitNo)
Definition: ConcSessionContext.cpp:43
~CConcSessionContext()
Definition: ConcSessionContext.h:50
size_t CacheSize()
Definition: ConcSessionContext.cpp:181
uint32_t DWORD
Definition: utilit.h:105