MemIOHandler Class Reference

Allows the web server to read from a memory buffer instead of a file. More...

#include <mem_io_handler.h>

Inheritance diagram for MemIOHandler:
IOHandler zmm::Object

Public Member Functions

 MemIOHandler (void *buffer, int length)
 Initializes the internal buffer.
 MemIOHandler (zmm::String str)
virtual ~MemIOHandler ()
virtual void open (IN enum UpnpOpenFileMode mode)
virtual int read (OUT char *buf, IN size_t length)
virtual void seek (IN off_t offset, IN int whence)
virtual void open (enum UpnpOpenFileMode mode)
 Opens a data for the web server.
virtual int read (char *buf, size_t length)
 Reads previously opened/initialized data sequentially.
virtual int write (char *buf, size_t length)
 Writes to previously opened/initialized data sequentially.
virtual void seek (off_t offset, int whence)
 Performs a seek on an open/initialized data.
virtual void close ()
 Close/free previously opened/initialized data.
void retain ()
void release ()
int getRefCount ()

Static Public Member Functions

static void * operator new (size_t size)
static void operator delete (void *ptr)

Protected Attributes

char * buffer
 buffer that is holding our data.
off_t length
off_t pos
 current offset in the buffer
mt_atomic_t _ref_count
pthread_mutex_t mutex

Detailed Description

Allows the web server to read from a memory buffer instead of a file.

Definition at line 39 of file mem_io_handler.h.


Constructor & Destructor Documentation

MemIOHandler::MemIOHandler ( void *  buffer,
int  length 
)

Initializes the internal buffer.

Parameters:
buffer all operations will be done on this buffer.

Definition at line 55 of file mem_io_handler.cc.

References MALLOC.

MemIOHandler::MemIOHandler ( zmm::String  str  ) 

Definition at line 62 of file mem_io_handler.cc.

References buffer, zmm::String::c_str(), zmm::String::length(), length, and MALLOC.

MemIOHandler::~MemIOHandler (  )  [virtual]

Definition at line 69 of file mem_io_handler.cc.

References buffer, and FREE.


Member Function Documentation

void IOHandler::close (  )  [virtual, inherited]

Close/free previously opened/initialized data.

Reimplemented in BufferedIOHandler, DVDIOHandler, FDIOHandler, FileIOHandler, IOHandlerBufferHelper, and ProcessIOHandler.

Definition at line 136 of file io_handler.cc.

int Object::getRefCount (  )  [inherited]

Definition at line 78 of file object.cc.

References zmm::Object::_ref_count, and atomic_get().

virtual void IOHandler::open ( enum UpnpOpenFileMode  mode  )  [virtual, inherited]

Opens a data for the web server.

Parameters:
mode in which the data will be opened (we only support UPNP_READ)
Todo:
Genych, ya tut che to zapamyatowal kak gawno rabotaet? kto filename poluchaet??

Reimplemented in BufferedIOHandler, and IOHandlerBufferHelper.

void MemIOHandler::open ( IN enum UpnpOpenFileMode  mode  )  [virtual]

Definition at line 74 of file mem_io_handler.cc.

References pos.

void Object::operator delete ( void *  ptr  )  [static, inherited]

Definition at line 87 of file object.cc.

References FREE.

void * Object::operator new ( size_t  size  )  [static, inherited]

Definition at line 83 of file object.cc.

References MALLOC.

virtual int IOHandler::read ( char *  buf,
size_t  length 
) [virtual, inherited]

Reads previously opened/initialized data sequentially.

Parameters:
buf This buffer will be filled by our read functions.
length Number of bytes to read.

Reimplemented in IOHandlerBufferHelper.

Referenced by web_read().

int MemIOHandler::read ( OUT char *  buf,
IN size_t  length 
) [virtual]

Definition at line 79 of file mem_io_handler.cc.

References buffer, and pos.

void Object::release (  )  [inherited]
void Object::retain (  )  [inherited]
virtual void IOHandler::seek ( off_t  offset,
int  whence 
) [virtual, inherited]

Performs a seek on an open/initialized data.

Parameters:
offset Number of bytes to move in the buffer. For seeking forwards positive values are used, for seeking backwards - negative. Offset must be positive if origin is set to SEEK_SET
whence The position to move relative to. SEEK_CUR to move relative to current position, SEEK_END to move relative to the end of file, SEEK_SET to specify an absolute offset.

Reimplemented in IOHandlerBufferHelper.

Referenced by web_seek().

void MemIOHandler::seek ( IN off_t  offset,
IN int  whence 
) [virtual]

Definition at line 105 of file mem_io_handler.cc.

References _, _Exception, length, and pos.

virtual int IOHandler::write ( char *  buf,
size_t  length 
) [virtual, inherited]

Writes to previously opened/initialized data sequentially.

Parameters:
buf Data to be written.
length Number of bytes to write.

Field Documentation

mt_atomic_t zmm::Object::_ref_count [protected, inherited]
char* MemIOHandler::buffer [protected]

buffer that is holding our data.

Definition at line 43 of file mem_io_handler.h.

Referenced by MemIOHandler(), read(), and ~MemIOHandler().

off_t MemIOHandler::length [protected]

Definition at line 44 of file mem_io_handler.h.

Referenced by MemIOHandler(), and seek().

pthread_mutex_t zmm::Object::mutex [protected, inherited]
off_t MemIOHandler::pos [protected]

current offset in the buffer

Definition at line 47 of file mem_io_handler.h.

Referenced by open(), read(), and seek().


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

Generated on Fri Mar 26 20:16:57 2010 for MediaTomb by  doxygen 1.6.1