Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
async_filebuf Class Reference

#include <async_filebuf.h>

+ Inheritance diagram for async_filebuf:

Public Member Functions

 async_filebuf (int segsize=1000000, int segcount=3, int lookback=1)
 
virtual ~async_filebuf ()
 
async_filebufopen (const std::string fname, std::ios::openmode mode)
 
async_filebufclose ()
 
std::streamsize in_avail ()
 
int snextc ()
 
int sbumpc ()
 
int sgetc ()
 
int sputbackc (int c)
 
int sungetc ()
 

Protected Types

enum  segment_state { sFull, sEmptying, sEmpty, sFilling }
 

Protected Member Functions

int pbackfail (char c=EOF)
 
virtual std::streambuf * setbuf (char *s, std::streamsize n)
 
virtual std::streamsize showmanyc ()
 
virtual int uflow ()
 
virtual int underflow ()
 
virtual std::streamsize xsgetn (char *s, std::streamsize n)
 
virtual std::streampos seekoff (std::streamoff off, std::ios::seekdir way, std::ios::openmode which)
 
virtual std::streampos seekpos (std::streampos pos, std::ios::openmode which)
 
int readloop_initiate ()
 
int readloop_terminate ()
 
int readloop ()
 
int segment ()
 
int segoff ()
 
std::streampos getpos ()
 

Protected Attributes

char * buffer
 
char * buffer_start
 
char * buffer_end
 
char * buffer_eback
 
char * buffer_gptr
 
char * buffer_egptr
 
std::vector< segment_statesegment_cond
 
std::vector< std::streampos > segment_pos
 
std::vector< std::streamsize > segment_len
 
int segment_size
 
int segment_count
 
int segment_lookback
 
int segment_backstop
 
int readloop_active
 
std::mutex readloop_lock
 
std::condition_variable readloop_wake
 
std::condition_variable readloop_woke
 
std::thread * readloop_thread
 

Detailed Description

Definition at line 23 of file async_filebuf.h.

Member Enumeration Documentation

Enumerator
sFull 
sEmptying 
sEmpty 
sFilling 

Definition at line 180 of file async_filebuf.h.

Constructor & Destructor Documentation

async_filebuf::async_filebuf ( int  segsize = 1000000,
int  segcount = 3,
int  lookback = 1 
)
async_filebuf::~async_filebuf ( )
virtual

Definition at line 40 of file async_filebuf.cc.

References buffer, close(), and THIS_ASYNCFB.

Member Function Documentation

async_filebuf* async_filebuf::close ( )
inline

Definition at line 40 of file async_filebuf.h.

References close(), readloop_active, readloop_terminate(), and THIS_ASYNCFB.

Referenced by ~async_filebuf().

std::streampos async_filebuf::getpos ( )
inlineprotected
std::streamsize async_filebuf::in_avail ( )
inline

Definition at line 53 of file async_filebuf.h.

References buffer_egptr, buffer_gptr, readloop_active, and THIS_ASYNCFB.

async_filebuf* async_filebuf::open ( const std::string  fname,
std::ios::openmode  mode 
)
inline

Definition at line 29 of file async_filebuf.h.

References open(), and THIS_ASYNCFB.

Referenced by HDEVIO::HDEVIO().

int async_filebuf::pbackfail ( char  c = EOF)
inlineprotected

Definition at line 122 of file async_filebuf.h.

References c, and readloop_active.

Referenced by sputbackc(), and sungetc().

int async_filebuf::readloop_terminate ( )
protected
int async_filebuf::sbumpc ( )
inline

Definition at line 76 of file async_filebuf.h.

References buffer_egptr, buffer_gptr, readloop_active, and underflow().

std::streampos async_filebuf::seekoff ( std::streamoff  off,
std::ios::seekdir  way,
std::ios::openmode  which 
)
protectedvirtual
std::streampos async_filebuf::seekpos ( std::streampos  pos,
std::ios::openmode  which 
)
protectedvirtual
int async_filebuf::segment ( )
inlineprotected

Definition at line 203 of file async_filebuf.h.

References buffer_gptr, buffer_start, and segment_size.

Referenced by getpos(), seekpos(), and underflow().

int async_filebuf::segoff ( )
inlineprotected

Definition at line 204 of file async_filebuf.h.

References buffer_gptr, buffer_start, and segment_size.

Referenced by getpos(), and underflow().

virtual std::streambuf* async_filebuf::setbuf ( char *  s,
std::streamsize  n 
)
inlineprotectedvirtual
int async_filebuf::sgetc ( )
inline

Definition at line 87 of file async_filebuf.h.

References buffer_egptr, buffer_gptr, readloop_active, and underflow().

virtual std::streamsize async_filebuf::showmanyc ( )
inlineprotectedvirtual

Definition at line 142 of file async_filebuf.h.

References buffer_egptr, buffer_gptr, readloop_active, and underflow().

int async_filebuf::snextc ( )
inline

Definition at line 62 of file async_filebuf.h.

References buffer_egptr, buffer_gptr, readloop_active, THIS_ASYNCFB, and underflow().

int async_filebuf::sputbackc ( int  c)
inline

Definition at line 97 of file async_filebuf.h.

References buffer_gptr, buffer_start, pbackfail(), readloop_active, and segment_size.

int async_filebuf::sungetc ( )
inline

Definition at line 109 of file async_filebuf.h.

References buffer_gptr, buffer_start, pbackfail(), readloop_active, and segment_size.

virtual int async_filebuf::uflow ( )
inlineprotectedvirtual

Definition at line 151 of file async_filebuf.h.

References buffer_gptr, readloop_active, THIS_ASYNCFB, and underflow().

std::streamsize async_filebuf::xsgetn ( char *  s,
std::streamsize  n 
)
protectedvirtual

Member Data Documentation

char* async_filebuf::buffer
protected

Definition at line 173 of file async_filebuf.h.

Referenced by async_filebuf(), and ~async_filebuf().

char* async_filebuf::buffer_eback
protected

Definition at line 176 of file async_filebuf.h.

Referenced by readloop_initiate(), readloop_terminate(), seekpos(), setbuf(), and underflow().

char* async_filebuf::buffer_egptr
protected
char* async_filebuf::buffer_end
protected

Definition at line 175 of file async_filebuf.h.

Referenced by readloop(), readloop_initiate(), readloop_terminate(), and setbuf().

char* async_filebuf::buffer_gptr
protected
char* async_filebuf::buffer_start
protected
std::mutex async_filebuf::readloop_lock
protected

Definition at line 189 of file async_filebuf.h.

Referenced by readloop(), readloop_terminate(), and underflow().

std::thread* async_filebuf::readloop_thread
protected

Definition at line 192 of file async_filebuf.h.

Referenced by readloop_initiate(), and readloop_terminate().

std::condition_variable async_filebuf::readloop_wake
protected

Definition at line 190 of file async_filebuf.h.

Referenced by readloop(), readloop_terminate(), and underflow().

std::condition_variable async_filebuf::readloop_woke
protected

Definition at line 191 of file async_filebuf.h.

Referenced by readloop(), and underflow().

int async_filebuf::segment_backstop
protected

Definition at line 187 of file async_filebuf.h.

Referenced by readloop_initiate(), and underflow().

std::vector<segment_state> async_filebuf::segment_cond
protected

Definition at line 181 of file async_filebuf.h.

Referenced by readloop(), readloop_initiate(), readloop_terminate(), seekpos(), and underflow().

int async_filebuf::segment_count
protected

Definition at line 185 of file async_filebuf.h.

Referenced by async_filebuf(), readloop(), readloop_initiate(), seekpos(), and underflow().

std::vector<std::streamsize> async_filebuf::segment_len
protected
int async_filebuf::segment_lookback
protected

Definition at line 186 of file async_filebuf.h.

Referenced by async_filebuf(), seekoff(), seekpos(), underflow(), and xsgetn().

std::vector<std::streampos> async_filebuf::segment_pos
protected

Definition at line 182 of file async_filebuf.h.

Referenced by getpos(), readloop(), readloop_initiate(), readloop_terminate(), and seekpos().

int async_filebuf::segment_size
protected

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