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.
5 /////////////////////////////////////////////////////////////////////////////
6 
7 #ifndef INTBLOCKPOOL_H
8 #define INTBLOCKPOOL_H
9 
10 #include "LuceneObject.h"
11 
12 namespace Lucene {
13 
14 class IntBlockPool : public LuceneObject {
15 public:
16     IntBlockPool(const DocumentsWriterPtr& docWriter, bool trackAllocations);
17     virtual ~IntBlockPool();
18 
19     LUCENE_CLASS(IntBlockPool);
20 
21 public:
22     Collection<IntArray> buffers;
23 
24     int32_t bufferUpto; // Which buffer we are upto
25     int32_t intUpto; // Where we are in head buffer
26 
27     IntArray buffer; // Current head buffer
28     int32_t intOffset; // Current head offset
29     bool trackAllocations;
30 
31 protected:
32     DocumentsWriterWeakPtr _docWriter;
33 
34 public:
35     void reset();
36     void nextBuffer();
37 };
38 
39 }
40 
41 #endif
42