IOHandlerChainer Class Reference

gets two IOHandler, starts a thread which reads from one IOHandler and writes the data to the other IOHandler More...

#include <io_handler_chainer.h>

Inheritance diagram for IOHandlerChainer:
ThreadExecutor Executor zmm::Object

Public Member Functions

 IOHandlerChainer (zmm::Ref< IOHandler > readFrom, zmm::Ref< IOHandler > writeTo, int chunkSize)
 initialize the IOHandlerChainer
virtual int getStatus ()
 the exit status of the thread - needs to be overridden
virtual bool isAlive ()
 method to check if the executor is still running
virtual bool kill ()
 kill the thread (pthread_join)
void retain ()
void release ()
int getRefCount ()

Static Public Member Functions

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

Protected Member Functions

virtual void threadProc ()
 abstract thread method, which needs to be overridden
void startThread ()
 start the thread
bool threadShutdownCheck ()
 check if the thread should shutdown should be called by the threadProc in short intervals

Protected Attributes

bool threadShutdown
bool threadRunning
 if the thread is currently running
zmm::Ref< Condcond
zmm::Ref< Mutexmutex
mt_atomic_t _ref_count

Private Attributes

int status
char * buf
int chunkSize
zmm::Ref< IOHandlerreadFrom
zmm::Ref< IOHandlerwriteTo

Detailed Description

gets two IOHandler, starts a thread which reads from one IOHandler and writes the data to the other IOHandler

Definition at line 47 of file io_handler_chainer.h.


Constructor & Destructor Documentation

IOHandlerChainer::IOHandlerChainer ( zmm::Ref< IOHandler readFrom,
zmm::Ref< IOHandler writeTo,
int  chunkSize 
)

initialize the IOHandlerChainer

Parameters:
readFrom the IOHandler to read from
writeTo the IOHandler to write to
chunkSize the amount of bytes to read/write at once. a buffer of this size will be allocated

Definition at line 41 of file io_handler_chainer.cc.

References _, _Exception, buf, MALLOC, NULL, ThreadExecutor::startThread(), status, and UPNP_READ.


Member Function Documentation

int Object::getRefCount (  )  [inherited]

Definition at line 78 of file object.cc.

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

virtual int IOHandlerChainer::getStatus (  )  [inline, virtual]

the exit status of the thread - needs to be overridden

Implements ThreadExecutor.

Definition at line 56 of file io_handler_chainer.h.

References status.

virtual bool ThreadExecutor::isAlive (  )  [inline, virtual, inherited]

method to check if the executor is still running

Returns:
true if the executor is still running, false otherwise

Implements Executor.

Definition at line 49 of file thread_executor.h.

References ThreadExecutor::threadRunning.

bool ThreadExecutor::kill (  )  [virtual, inherited]

kill the thread (pthread_join)

Returns:
always true - this function only returns after the thread has died

Implements Executor.

Definition at line 64 of file thread_executor.cc.

References AUTOLOCK, AUTOUNLOCK, ThreadExecutor::cond, ThreadExecutor::mutex, NULL, ThreadExecutor::thread, ThreadExecutor::threadRunning, and ThreadExecutor::threadShutdown.

Referenced by ThreadExecutor::~ThreadExecutor().

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.

void Object::release (  )  [inherited]
void Object::retain (  )  [inherited]
void ThreadExecutor::startThread (  )  [protected, inherited]

start the thread

Definition at line 53 of file thread_executor.cc.

References NULL, ThreadExecutor::staticThreadProc(), ThreadExecutor::thread, and ThreadExecutor::threadRunning.

Referenced by IOHandlerChainer().

void IOHandlerChainer::threadProc (  )  [protected, virtual]
bool ThreadExecutor::threadShutdownCheck (  )  [inline, protected, inherited]

check if the thread should shutdown should be called by the threadProc in short intervals

Definition at line 73 of file thread_executor.h.

References ThreadExecutor::threadShutdown.

Referenced by threadProc().


Field Documentation

mt_atomic_t zmm::Object::_ref_count [protected, inherited]
char* IOHandlerChainer::buf [private]

Definition at line 61 of file io_handler_chainer.h.

Referenced by IOHandlerChainer(), and threadProc().

Definition at line 62 of file io_handler_chainer.h.

Referenced by threadProc().

zmm::Ref<Cond> ThreadExecutor::cond [protected, inherited]

Definition at line 62 of file thread_executor.h.

Referenced by ThreadExecutor::kill(), and ThreadExecutor::ThreadExecutor().

zmm::Ref<Mutex> ThreadExecutor::mutex [protected, inherited]

Reimplemented from zmm::Object.

Definition at line 63 of file thread_executor.h.

Referenced by ThreadExecutor::kill(), and ThreadExecutor::ThreadExecutor().

Definition at line 63 of file io_handler_chainer.h.

Referenced by threadProc().

int IOHandlerChainer::status [private]

Definition at line 60 of file io_handler_chainer.h.

Referenced by getStatus(), IOHandlerChainer(), and threadProc().

bool ThreadExecutor::threadRunning [protected, inherited]

if the thread is currently running

Definition at line 60 of file thread_executor.h.

Referenced by ThreadExecutor::isAlive(), ThreadExecutor::kill(), and ThreadExecutor::startThread().

bool ThreadExecutor::threadShutdown [protected, inherited]

Definition at line 64 of file io_handler_chainer.h.

Referenced by threadProc().


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