xapian-core  2.0.0
Public Member Functions | Private Attributes | List of all members
BufferedFile Class Reference

#include <honey_table.h>

+ Collaboration diagram for BufferedFile:

Public Member Functions

 BufferedFile ()
 
 BufferedFile (const BufferedFile &o)
 
 BufferedFile (int fd_, off_t offset_, off_t pos_, bool read_only_)
 
 ~BufferedFile ()
 
off_t get_offset () const
 
void close (bool fd_owned)
 
void force_close (bool fd_owned)
 
bool is_open () const
 
bool was_forced_closed () const
 
bool open (const std::string &path, bool read_only_)
 
off_t get_pos () const
 
void set_pos (off_t pos_)
 
void skip (size_t delta) const
 
void write (unsigned char ch)
 
void write (const char *p, size_t len)
 
int read () const
 
uint4 read_uint4_be () const
 
void read (char *p, size_t len) const
 
void flush ()
 
void sync ()
 
void rewind (off_t start)
 

Private Attributes

BufferedFileCommoncommon = nullptr
 
off_t pos = 0
 Offset in file. More...
 
bool read_only = true
 
size_t buf_end = 0
 Index into buf where buffered data ends. More...
 
char buf [4096]
 
const int FORCED_CLOSE = -2
 

Detailed Description

Definition at line 91 of file honey_table.h.

Constructor & Destructor Documentation

◆ BufferedFile() [1/3]

BufferedFile::BufferedFile ( )
inline

Definition at line 110 of file honey_table.h.

◆ BufferedFile() [2/3]

BufferedFile::BufferedFile ( const BufferedFile o)
inline

Definition at line 112 of file honey_table.h.

References BufferedFileCommon::_refs, buf, buf_end, common, and read_only.

◆ BufferedFile() [3/3]

BufferedFile::BufferedFile ( int  fd_,
off_t  offset_,
off_t  pos_,
bool  read_only_ 
)
inline

Definition at line 123 of file honey_table.h.

◆ ~BufferedFile()

BufferedFile::~BufferedFile ( )
inline

Definition at line 127 of file honey_table.h.

References BufferedFileCommon::_refs, and common.

Member Function Documentation

◆ close()

void BufferedFile::close ( bool  fd_owned)
inline

Definition at line 134 of file honey_table.h.

References common, and BufferedFileCommon::fd.

Referenced by HoneyTable::close(), force_close(), and HoneyTable::~HoneyTable().

◆ flush()

void BufferedFile::flush ( )
inline

Definition at line 319 of file honey_table.h.

References buf, buf_end, common, BufferedFileCommon::fd, io_write(), pos, and read_only.

Referenced by HoneyTable::flush_db(), and set_pos().

◆ force_close()

void BufferedFile::force_close ( bool  fd_owned)
inline

Definition at line 141 of file honey_table.h.

References close(), common, BufferedFileCommon::fd, and FORCED_CLOSE.

Referenced by HoneyTable::close().

◆ get_offset()

off_t BufferedFile::get_offset ( ) const
inline

Definition at line 132 of file honey_table.h.

References common, and BufferedFileCommon::offset.

◆ get_pos()

off_t BufferedFile::get_pos ( ) const
inline

Definition at line 171 of file honey_table.h.

References buf_end, pos, and read_only.

Referenced by HoneyCursor::HoneyCursor(), and SSTIndex::write().

◆ is_open()

bool BufferedFile::is_open ( ) const
inline

Definition at line 148 of file honey_table.h.

References common, and BufferedFileCommon::fd.

Referenced by HoneyTable::is_open().

◆ open()

bool BufferedFile::open ( const std::string &  path,
bool  read_only_ 
)
inline

◆ read() [1/2]

int BufferedFile::read ( ) const
inline

Definition at line 275 of file honey_table.h.

References buf, buf_end, common, BufferedFileCommon::fd, io_pread(), and pos.

Referenced by read_uint4_be().

◆ read() [2/2]

void BufferedFile::read ( char *  p,
size_t  len 
) const
inline

◆ read_uint4_be()

uint4 BufferedFile::read_uint4_be ( ) const
inline

Definition at line 292 of file honey_table.h.

References read().

◆ rewind()

void BufferedFile::rewind ( off_t  start)
inline

Definition at line 331 of file honey_table.h.

References buf_end, pos, and read_only.

◆ set_pos()

void BufferedFile::set_pos ( off_t  pos_)
inline

Definition at line 175 of file honey_table.h.

References buf_end, flush(), pos, and read_only.

Referenced by HoneyCursor::HoneyCursor(), and HoneyCursor::rewind().

◆ skip()

void BufferedFile::skip ( size_t  delta) const
inline

Definition at line 194 of file honey_table.h.

References buf_end, pos, and read_only.

◆ sync()

void BufferedFile::sync ( )
inline

Definition at line 327 of file honey_table.h.

References common, BufferedFileCommon::fd, and io_sync().

Referenced by HoneyTable::sync().

◆ was_forced_closed()

bool BufferedFile::was_forced_closed ( ) const
inline

Definition at line 150 of file honey_table.h.

References common, BufferedFileCommon::fd, and FORCED_CLOSE.

Referenced by HoneyCursor::next().

◆ write() [1/2]

void BufferedFile::write ( const char *  p,
size_t  len 
)
inline

Definition at line 225 of file honey_table.h.

References buf, buf_end, common, BufferedFileCommon::fd, io_write(), p, and pos.

◆ write() [2/2]

void BufferedFile::write ( unsigned char  ch)
inline

Definition at line 215 of file honey_table.h.

References buf, buf_end, common, BufferedFileCommon::fd, io_write(), and pos.

Referenced by SSTIndex::write().

Member Data Documentation

◆ buf

char BufferedFile::buf[4096]
mutableprivate

Definition at line 105 of file honey_table.h.

Referenced by BufferedFile(), flush(), read(), and write().

◆ buf_end

size_t BufferedFile::buf_end = 0
mutableprivate

Index into buf where buffered data ends.

Definition at line 104 of file honey_table.h.

Referenced by BufferedFile(), flush(), get_pos(), read(), rewind(), set_pos(), skip(), and write().

◆ common

BufferedFileCommon* BufferedFile::common = nullptr
private

◆ FORCED_CLOSE

const int BufferedFile::FORCED_CLOSE = -2
private

Definition at line 107 of file honey_table.h.

Referenced by force_close(), and was_forced_closed().

◆ pos

off_t BufferedFile::pos = 0
mutableprivate

Offset in file.

When reading, this is the offset of the end of any buffered data.

When writing, this is the offset of the start of any buffered data.

Definition at line 100 of file honey_table.h.

Referenced by flush(), get_pos(), read(), rewind(), set_pos(), skip(), and write().

◆ read_only

bool BufferedFile::read_only = true
private

Definition at line 101 of file honey_table.h.

Referenced by BufferedFile(), flush(), get_pos(), open(), rewind(), set_pos(), and skip().


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