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 
2 // Copyright (c) 2009-2014 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 public:
22  TimeLimitingCollector(const CollectorPtr& collector, int64_t timeAllowed);
23 
24  virtual ~TimeLimitingCollector();
25 
27 
28 public:
31  static const int32_t DEFAULT_RESOLUTION;
32 
36 
37 protected:
38  static int64_t resolution;
39  bool greedy;
40 
41  int64_t t0;
42  int64_t timeout;
44 
45  int32_t docBase;
46 
47 public:
50  static int64_t getResolution();
51 
63  static void setResolution(int64_t newResolution);
64 
66  static void stopTimer();
67 
73  bool isGreedy();
74 
78  void setGreedy(bool greedy);
79 
82  virtual void collect(int32_t doc);
83 
84  virtual void setNextReader(const IndexReaderPtr& reader, int32_t docBase);
85  virtual void setScorer(const ScorerPtr& scorer);
86  virtual bool acceptsDocsOutOfOrder();
87 
88 protected:
90  static TimerThreadPtr TIMER_THREAD();
91 
92  friend class TimerThread;
93 };
94 
95 }
96 
97 #endif

clucene.sourceforge.net