Lucene++ - a full-featured, c++ search engine
API Documentation


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
TimeLimitingCollector.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2011 Alan Wright. All rights reserved.
3 // Distributable under the terms of either the Apache License (Version 2.0)
4 // or the GNU Lesser General Public License.
6 
7 #ifndef TIMELIMITINGCOLLECTOR_H
8 #define TIMELIMITINGCOLLECTOR_H
9 
10 #include "Collector.h"
11 
12 namespace Lucene
13 {
17  class LPPAPI TimeLimitingCollector : public Collector
18  {
19  public:
23  TimeLimitingCollector(CollectorPtr collector, int64_t timeAllowed);
24 
25  virtual ~TimeLimitingCollector();
26 
28 
29  public:
32  static const int32_t DEFAULT_RESOLUTION;
33 
37 
38  protected:
39  static int64_t resolution;
40  bool greedy;
41 
42  int64_t t0;
43  int64_t timeout;
45 
46  int32_t docBase;
47 
48  public:
51  static int64_t getResolution();
52 
64  static void setResolution(int64_t newResolution);
65 
67  static void stopTimer();
68 
74  bool isGreedy();
75 
79  void setGreedy(bool greedy);
80 
83  virtual void collect(int32_t doc);
84 
85  virtual void setNextReader(IndexReaderPtr reader, int32_t docBase);
86  virtual void setScorer(ScorerPtr scorer);
87  virtual bool acceptsDocsOutOfOrder();
88 
89  protected:
91  static TimerThreadPtr TIMER_THREAD();
92 
93  friend class TimerThread;
94  };
95 }
96 
97 #endif

clucene.sourceforge.net