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


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
FieldCacheImpl.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 FIELDCACHEIMPL_H
8 #define FIELDCACHEIMPL_H
9 
10 #include "FieldCache.h"
11 
12 namespace Lucene
13 {
15  class FieldCacheImpl : public FieldCache, public LuceneObject
16  {
17  public:
19  virtual ~FieldCacheImpl();
20 
22 
23  protected:
24  MapStringCache caches;
26 
27  public:
28  virtual void initialize();
29  virtual void purgeAllCaches();
30  virtual void purge(IndexReaderPtr r);
32 
33  virtual Collection<uint8_t> getBytes(IndexReaderPtr reader, const String& field);
34  virtual Collection<uint8_t> getBytes(IndexReaderPtr reader, const String& field, ByteParserPtr parser);
35 
36  virtual Collection<int32_t> getInts(IndexReaderPtr reader, const String& field);
37  virtual Collection<int32_t> getInts(IndexReaderPtr reader, const String& field, IntParserPtr parser);
38 
39  virtual Collection<int64_t> getLongs(IndexReaderPtr reader, const String& field);
40  virtual Collection<int64_t> getLongs(IndexReaderPtr reader, const String& field, LongParserPtr parser);
41 
42  virtual Collection<double> getDoubles(IndexReaderPtr reader, const String& field);
43  virtual Collection<double> getDoubles(IndexReaderPtr reader, const String& field, DoubleParserPtr parser);
44 
45  virtual Collection<String> getStrings(IndexReaderPtr reader, const String& field);
46  virtual StringIndexPtr getStringIndex(IndexReaderPtr reader, const String& field);
47 
48  virtual void setInfoStream(InfoStreamPtr stream);
49  virtual InfoStreamPtr getInfoStream();
50  };
51 
52  class Entry : public LuceneObject
53  {
54  public:
56  Entry(const String& field, boost::any custom);
57  virtual ~Entry();
58 
60 
61  public:
62  String field; // which Fieldable
63  boost::any custom; // which custom comparator or parser
64 
65  public:
67  virtual bool equals(LuceneObjectPtr other);
68 
70  virtual int32_t hashCode();
71  };
72 
74  class Cache : public LuceneObject
75  {
76  public:
77  Cache(FieldCachePtr wrapper = FieldCachePtr());
78  virtual ~Cache();
79 
81 
82  public:
84  WeakMapLuceneObjectMapEntryAny readerCache;
85 
86  protected:
87  virtual boost::any createValue(IndexReaderPtr reader, EntryPtr key) = 0;
88 
89  public:
91  virtual void purge(IndexReaderPtr r);
92 
93  virtual boost::any get(IndexReaderPtr reader, EntryPtr key);
94  virtual void printNewInsanity(InfoStreamPtr infoStream, boost::any value);
95  };
96 
97  class ByteCache : public Cache
98  {
99  public:
101  virtual ~ByteCache();
102 
104 
105  protected:
106  virtual boost::any createValue(IndexReaderPtr reader, EntryPtr key);
107  };
108 
109  class IntCache : public Cache
110  {
111  public:
112  IntCache(FieldCachePtr wrapper = FieldCachePtr());
113  virtual ~IntCache();
114 
116 
117  protected:
118  virtual boost::any createValue(IndexReaderPtr reader, EntryPtr key);
119  };
120 
121  class LongCache : public Cache
122  {
123  public:
125  virtual ~LongCache();
126 
128 
129  protected:
130  virtual boost::any createValue(IndexReaderPtr reader, EntryPtr key);
131  };
132 
133  class DoubleCache : public Cache
134  {
135  public:
137  virtual ~DoubleCache();
138 
140 
141  protected:
142  virtual boost::any createValue(IndexReaderPtr reader, EntryPtr key);
143  };
144 
145  class StringCache : public Cache
146  {
147  public:
149  virtual ~StringCache();
150 
152 
153  protected:
154  virtual boost::any createValue(IndexReaderPtr reader, EntryPtr key);
155  };
156 
157  class StringIndexCache : public Cache
158  {
159  public:
161  virtual ~StringIndexCache();
162 
164 
165  protected:
166  virtual boost::any createValue(IndexReaderPtr reader, EntryPtr key);
167  };
168 
170  {
171  public:
172  FieldCacheEntryImpl(LuceneObjectPtr readerKey, const String& fieldName, int32_t cacheType, boost::any custom, boost::any value);
173  virtual ~FieldCacheEntryImpl();
174 
176 
177  protected:
179  String fieldName;
180  int32_t cacheType;
181  boost::any custom;
182  boost::any value;
183 
184  public:
185  virtual LuceneObjectPtr getReaderKey();
186  virtual String getFieldName();
187  virtual int32_t getCacheType();
188  virtual boost::any getCustom();
189  virtual boost::any getValue();
190  };
191 }
192 
193 #endif

clucene.sourceforge.net