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


RAMDirectory.h
Go to the documentation of this file.
1 // 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 RAMDIRECTORY_H
8 #define RAMDIRECTORY_H
9 
10 #include "Directory.h"
11 
12 namespace Lucene {
13 
17 class LPPAPI RAMDirectory : public Directory {
18 public:
21 
32 
33  RAMDirectory(const DirectoryPtr& dir, bool closeDir);
34 
35  virtual ~RAMDirectory();
36 
38 
39 INTERNAL:
40  int64_t _sizeInBytes;
41  MapStringRAMFile fileMap;
42 
43 protected:
46  bool closeDir;
47 
48 public:
49  virtual void initialize();
50 
53 
55  virtual bool fileExists(const String& name);
56 
58  virtual uint64_t fileModified(const String& name);
59 
61  virtual void touchFile(const String& name);
62 
64  virtual int64_t fileLength(const String& name);
65 
68  int64_t sizeInBytes();
69 
71  virtual void deleteFile(const String& name);
72 
75  virtual IndexOutputPtr createOutput(const String& name);
76 
78  virtual IndexInputPtr openInput(const String& name);
79 
81  virtual void close();
82 };
83 
84 }
85 
86 #endif
Lucene::RAMDirectory::createOutput
virtual IndexOutputPtr createOutput(const String &name)
Creates a new, empty file in the directory with the given name. Returns a stream writing this file.
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Lucene::RAMDirectory::~RAMDirectory
virtual ~RAMDirectory()
Lucene::RAMDirectory::sizeInBytes
int64_t sizeInBytes()
Return total size in bytes of all files in this directory. This is currently quantized to RAMOutputSt...
Lucene::RAMDirectory::deleteFile
virtual void deleteFile(const String &name)
Removes an existing file in the directory.
Lucene::RAMDirectory::RAMDirectory
RAMDirectory(const DirectoryPtr &dir, bool closeDir)
Lucene::Directory
A Directory is a flat list of files. Files may be written once, when they are created....
Definition: Directory.h:18
Lucene::RAMDirectory::initialize
virtual void initialize()
Called directly after instantiation to create objects that depend on this object being fully construc...
Lucene::RAMDirectory::openInput
virtual IndexInputPtr openInput(const String &name)
Returns a stream reading an existing file.
Lucene::DirectoryWeakPtr
boost::weak_ptr< Directory > DirectoryWeakPtr
Definition: LuceneTypes.h:489
Lucene::RAMDirectory::close
virtual void close()
Closes the store.
Lucene::RAMDirectory::_dirSource
DirectoryWeakPtr _dirSource
Definition: RAMDirectory.h:44
Lucene::RAMDirectory::fileMap
MapStringRAMFile fileMap
Definition: RAMDirectory.h:41
Lucene::RAMDirectory::listAll
virtual HashSet< String > listAll()
Returns an array of strings, one for each file in the directory.
Lucene::RAMDirectory::RAMDirectory
RAMDirectory(const DirectoryPtr &dir)
Creates a new RAMDirectory instance from a different Directory implementation. This can be used to lo...
Lucene::RAMDirectory::fileLength
virtual int64_t fileLength(const String &name)
Returns the length of a file in the directory.
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::RAMDirectory::fileExists
virtual bool fileExists(const String &name)
Returns true if a file with the given name exists.
Lucene::RAMDirectory::touchFile
virtual void touchFile(const String &name)
Set the modified time of an existing file to now.
Lucene::IndexInputPtr
boost::shared_ptr< IndexInput > IndexInputPtr
Definition: LuceneTypes.h:493
Lucene::HashSet< String >
Lucene::RAMDirectory
A memory-resident Directory implementation. Locking implementation is by default the SingleInstanceLo...
Definition: RAMDirectory.h:17
Lucene::RAMDirectory::closeDir
bool closeDir
Definition: RAMDirectory.h:46
Lucene::RAMDirectory::copyDirectory
bool copyDirectory
Definition: RAMDirectory.h:45
Lucene::DirectoryPtr
boost::shared_ptr< Directory > DirectoryPtr
Definition: LuceneTypes.h:489
Directory.h
Lucene::RAMDirectory::fileModified
virtual uint64_t fileModified(const String &name)
Returns the time the named file was last modified.
Lucene::RAMDirectory::RAMDirectory
RAMDirectory()
Constructs an empty Directory.
Lucene::IndexOutputPtr
boost::shared_ptr< IndexOutput > IndexOutputPtr
Definition: LuceneTypes.h:494

clucene.sourceforge.net