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


lucene::store::RAMDirectory Class Reference

A memory-resident Directory implementation. More...

#include <RAMDirectory.h>

Inheritance diagram for lucene::store::RAMDirectory:

lucene::store::Directory

Public Member Functions

DEFINE_MUTABLE_MUTEX(files_mutex)
void list(std 
RAMDirectory ()
 Returns a null terminated array of strings, one for each file in the directory.
virtual ~RAMDirectory ()
 Destructor - only call this if you are sure the directory is not being used anymore.
 RAMDirectory (Directory *dir)
 RAMDirectory (const char *dir)
 Creates a new RAMDirectory instance from the FSDirectory.
bool fileExists (const char *name) const
 Returns true iff the named file exists in this directory.
int64_t fileModified (const char *name) const
 Returns the time the named file was last modified.
int64_t fileLength (const char *name) const
 Returns the length in bytes of a file in the directory.
virtual void renameFile (const char *from, const char *to)
 Removes an existing file in the directory.
void touchFile (const char *name)
 Set the modified time of an existing file to now.
virtual IndexOutputcreateOutput (const char *name)
 Creates a new, empty file in the directory with the given name.
IndexInputopenInput (const char *name)
 Returns a stream reading an existing file.
virtual void close ()
TCHAR * toString () const
const char * getDirectoryType ()

Static Public Member Functions

static const char * DirectoryType ()

Data Fields

int64_t sizeInBytes

Protected Member Functions

virtual bool doDeleteFile (const char *name)
 Removes an existing file in the directory.
void _copyFromDir (Directory *dir, bool closeDir)
 Creates a new RAMDirectory instance from a different Directory implementation.

Protected Attributes

FileMap * files

Detailed Description

A memory-resident Directory implementation.

Locking implementation is by default the SingleInstanceLockFactory but can be changed with setLockFactory.


Constructor & Destructor Documentation

DEFINE_MUTABLE_MUTEX (files_mutex) void list(std lucene::store::RAMDirectory::RAMDirectory (  ) 

Returns a null terminated array of strings, one for each file in the directory.

Constructs an empty Directory.

virtual lucene::store::RAMDirectory::~RAMDirectory (  )  [virtual]

Destructor - only call this if you are sure the directory is not being used anymore.

Otherwise use the ref-counting facilities of dir->close

lucene::store::RAMDirectory::RAMDirectory ( Directory dir  ) 

lucene::store::RAMDirectory::RAMDirectory ( const char *  dir  ) 

Creates a new RAMDirectory instance from the FSDirectory.

Parameters:
dir a String specifying the full index directory path


Member Function Documentation

virtual bool lucene::store::RAMDirectory::doDeleteFile ( const char *  name  )  [protected, virtual]

Removes an existing file in the directory.

Implements lucene::store::Directory.

void lucene::store::RAMDirectory::_copyFromDir ( Directory dir,
bool  closeDir 
) [protected]

Creates a new RAMDirectory instance from a different Directory implementation.

This can be used to load a disk-based index into memory.

This should be used only with indices that can fit into memory.

Parameters:
dir a Directory value
Exceptions:
IOException if an error occurs

bool lucene::store::RAMDirectory::fileExists ( const char *  name  )  const [virtual]

Returns true iff the named file exists in this directory.

Implements lucene::store::Directory.

int64_t lucene::store::RAMDirectory::fileModified ( const char *  name  )  const [virtual]

Returns the time the named file was last modified.

Implements lucene::store::Directory.

int64_t lucene::store::RAMDirectory::fileLength ( const char *  name  )  const [virtual]

Returns the length in bytes of a file in the directory.

Implements lucene::store::Directory.

virtual void lucene::store::RAMDirectory::renameFile ( const char *  from,
const char *  to 
) [virtual]

Removes an existing file in the directory.

Implements lucene::store::Directory.

void lucene::store::RAMDirectory::touchFile ( const char *  name  )  [virtual]

Set the modified time of an existing file to now.

Implements lucene::store::Directory.

virtual IndexOutput* lucene::store::RAMDirectory::createOutput ( const char *  name  )  [virtual]

Creates a new, empty file in the directory with the given name.

Returns a stream writing this file.

Implements lucene::store::Directory.

IndexInput* lucene::store::RAMDirectory::openInput ( const char *  name  )  [virtual]

Returns a stream reading an existing file.

Implements lucene::store::Directory.

virtual void lucene::store::RAMDirectory::close (  )  [virtual]

TCHAR* lucene::store::RAMDirectory::toString (  )  const [virtual]

static const char* lucene::store::RAMDirectory::DirectoryType (  )  [static]

const char* lucene::store::RAMDirectory::getDirectoryType (  ) 


Field Documentation

FileMap* lucene::store::RAMDirectory::files [protected]


The documentation for this class was generated from the following file:

clucene.sourceforge.net