Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

TGo4BufferQueue Class Reference

Class containing a pointer queue for TBuffers. More...

#include <TGo4BufferQueue.h>

Inheritance diagram for TGo4BufferQueue:

TGo4Queue List of all members.

Public Methods

 TGo4BufferQueue ()
 TGo4BufferQueue (const char *name)
void AddBufferFromObject (TObject *object)
 Reconstruct a TObject queue entry from a given TBuffer pointer. More...

void AddBuffer (TBuffer *buffer, Bool_t clone=kFALSE)
 Add buffer pointer to queue. More...

void FreeBuffer (TBuffer *buffer)
 Free internal buffer to be re-used by the AddBuffer as clone method. More...

virtual void Clear (Option_t *opt="")
 Empty the queue and give free buffers back. More...

TBuffer * WaitBuffer ()
 Wait for buffer object from queue. More...

TObject * WaitObjectFromBuffer ()
 Wait for buffer object from queue. More...

virtual ~TGo4BufferQueue ()

Static Public Methods

TBuffer * CreateValueBuffer (UInt_t val)
 Create a root buffer that contains a single value val. More...

Int_t DecodeValueBuffer (TBuffer *buf)
 Extract value from buffer that was created by CreateValueBuffer method. More...


Static Public Attributes

const Int_t fgiISOWNER = BIT(14)
 .we emulate the protected owner flag of the TBuffer class, needed for reallocation! More...


Private Methods

void InitBuffers ()
 Initialization of internal queue buffer. More...

void Realloc (TBuffer *buffer, Int_t oldsize, Int_t newsize)
 Reallocate buffer of TBuffer to newsize. More...

TBuffer * NewEntry ()
 Create dummy buffer for queue. More...


Private Attributes

TList * fxBufferList
 List of preallocated buffer TBuffers which are used when TBuffer added to queue should be "cloned". More...

TList * fxFreeList
 List of buffers which are free for the next add. More...

TMutex * fxBufferMutex
Int_t fiOverflowcount
TIterator * fxBufferIterator
 Iterator for fxBufferList. More...

Int_t fiMaxBuffers
 Number of preallocated buffer TBuffers (maximum entries in fxBufferList). More...


Detailed Description

Class containing a pointer queue for TBuffers.

Is able to stream any external TObject into a TBuffer which then is added to the queue.

Definition at line 30 of file TGo4BufferQueue.h.


Constructor & Destructor Documentation

TGo4BufferQueue::TGo4BufferQueue  
 

Definition at line 40 of file TGo4BufferQueue.cxx.

References InitBuffers(), and TRACE.

TGo4BufferQueue::TGo4BufferQueue const char *    name
 

Definition at line 48 of file TGo4BufferQueue.cxx.

References InitBuffers(), and TRACE.

TGo4BufferQueue::~TGo4BufferQueue   [virtual]
 

Definition at line 73 of file TGo4BufferQueue.cxx.

References fxBufferIterator, fxBufferList, fxBufferMutex, and TRACE.


Member Function Documentation

void TGo4BufferQueue::AddBufferFromObject TObject *    object
 

Reconstruct a TObject queue entry from a given TBuffer pointer.

To be used for streaming the receiving socket contents into the queue. Operation should be thread locked by the calling user.

Definition at line 209 of file TGo4BufferQueue.cxx.

References TGo4Queue::Add(), and TRACE.

Referenced by TGo4ClientTask::AddLocalCommand(), TGo4Task::GetStatus(), main(), TGo4ExampleApplication::SendData(), TGo4Task::SendObject(), TGo4Task::SendStatus(), TGo4ServerTask::SendStatus(), TGo4ExampleServer::StopWorkThreads(), and TGo4Task::SubmitCommand().

void TGo4BufferQueue::AddBuffer TBuffer *    buffer,
Bool_t    clone = kFALSE
 

Add buffer pointer to queue.

We Renamed the protected baseclass method to avoid user confusion. If clone is true, a clone (deep streamer copy) of the given buffer will be done and this clone is added to the queue.

Definition at line 139 of file TGo4BufferQueue.cxx.

References TGo4Queue::Add(), TGo4Log::Debug(), fiMaxBuffers, fxBufferList, fxBufferMutex, fxFreeList, NewEntry(), Realloc(), and TRACE.

Referenced by main(), TGo4StatusRunnable::Run(), TGo4DataRunnable::Run(), TGo4CommandRunnable::Run(), TGo4Task::SendStatusBuffer(), TGo4ServerTask::SendStatusBuffer(), TGo4Task::SendStopBuffers(), TGo4Task::SubmitEmergencyCommand(), and TGo4Task::SubmitEmergencyData().

void TGo4BufferQueue::FreeBuffer TBuffer *    buffer
 

Free internal buffer to be re-used by the AddBuffer as clone method.

To be used by the thread that got the buffer from WaitBuffer after working on it. If buffer does not belong to the internal buffers list of this queue, it is _not_ added to the free buffer list.

Definition at line 256 of file TGo4BufferQueue.cxx.

References TGo4Socket::fgiBUFINITSIZE, fxBufferList, fxBufferMutex, fxFreeList, Realloc(), and TRACE.

Referenced by Clear(), TGo4StatusRunnable::Run(), TGo4DataRunnable::Run(), TGo4CommandRunnable::Run(), and WaitObjectFromBuffer().

void TGo4BufferQueue::Clear Option_t *    opt = "" [virtual]
 

Empty the queue and give free buffers back.

Reimplemented from TGo4Queue.

Definition at line 291 of file TGo4BufferQueue.cxx.

References FreeBuffer(), and TGo4Queue::Next().

Referenced by TGo4GUIRegistry::StopMonitoring().

TBuffer * TGo4BufferQueue::WaitBuffer  
 

Wait for buffer object from queue.

We Renamed the protected baseclass method to avoid user confusion.

Definition at line 84 of file TGo4BufferQueue.cxx.

References TRACE, and TGo4Queue::Wait().

Referenced by main(), TGo4StatusRunnable::Run(), TGo4DataRunnable::Run(), TGo4CommandRunnable::Run(), and WaitObjectFromBuffer().

TObject * TGo4BufferQueue::WaitObjectFromBuffer  
 

Wait for buffer object from queue.

When buffer is received, object is reconstructed out of it (thread mainlock aqcuired!). NULL in case of unknown class.

Definition at line 93 of file TGo4BufferQueue.cxx.

References FreeBuffer(), TRACE, and WaitBuffer().

Referenced by TGo4Task::NextCommand(), TGo4ServerTask::NextCommand(), TGo4Task::NextObject(), and TGo4Task::NextStatus().

TBuffer * TGo4BufferQueue::CreateValueBuffer UInt_t    val [static]
 

Create a root buffer that contains a single value val.

This feature is used to wrap direct (emergency) commands into a TBuffer to send it via the taskhandler queues and sockets. Also used to indicate disconnect mode for the taskhandler threads.

Definition at line 347 of file TGo4BufferQueue.cxx.

Referenced by TGo4Task::SubmitEmergencyCommand(), TGo4Task::SubmitEmergencyData(), and TGo4Task::TGo4Task().

Int_t TGo4BufferQueue::DecodeValueBuffer TBuffer *    buf [static]
 

Extract value from buffer that was created by CreateValueBuffer method.

Used to decode a direct command or disconnect value that is received from queue or socket connection. Negative value means no valid value buffer.

Definition at line 358 of file TGo4BufferQueue.cxx.

Referenced by TGo4TaskHandlerRunnable::CheckStopBuffer().

void TGo4BufferQueue::InitBuffers   [private]
 

Initialization of internal queue buffer.

Definition at line 56 of file TGo4BufferQueue.cxx.

References fiMaxBuffers, fxBufferIterator, fxBufferList, fxBufferMutex, fxFreeList, i, NewEntry(), and TRACE.

Referenced by TGo4BufferQueue().

void TGo4BufferQueue::Realloc TBuffer *    buffer,
Int_t    oldsize,
Int_t    newsize
[private]
 

Reallocate buffer of TBuffer to newsize.

Definition at line 306 of file TGo4BufferQueue.cxx.

References TGo4Socket::fgiBUFEXTRASPACE, and fgiISOWNER.

Referenced by AddBuffer(), and FreeBuffer().

TBuffer * TGo4BufferQueue::NewEntry   [private]
 

Create dummy buffer for queue.

Definition at line 333 of file TGo4BufferQueue.cxx.

References TGo4Socket::fgiBUFINITSIZE.

Referenced by AddBuffer(), and InitBuffers().


Member Data Documentation

const Int_t TGo4BufferQueue::fgiISOWNER = BIT(14) [static]
 

.we emulate the protected owner flag of the TBuffer class, needed for reallocation!

Definition at line 34 of file TGo4BufferQueue.cxx.

Referenced by Realloc().

TList* TGo4BufferQueue::fxBufferList [private]
 

List of preallocated buffer TBuffers which are used when TBuffer added to queue should be "cloned".

Each AddBuffer with option clone will memcopy the input buffer char field to the next TBuffer field in this list. Output buffer after WaitBuffer is then this internal TBuffer, not the input TBuffer. If all buffer buffers are in use, no further buffer is allowed to be added as clone.

Definition at line 132 of file TGo4BufferQueue.h.

Referenced by AddBuffer(), FreeBuffer(), InitBuffers(), and ~TGo4BufferQueue().

TList* TGo4BufferQueue::fxFreeList [private]
 

List of buffers which are free for the next add.

Definition at line 135 of file TGo4BufferQueue.h.

Referenced by AddBuffer(), FreeBuffer(), and InitBuffers().

TMutex* TGo4BufferQueue::fxBufferMutex [private]
 

Definition at line 136 of file TGo4BufferQueue.h.

Referenced by AddBuffer(), FreeBuffer(), InitBuffers(), and ~TGo4BufferQueue().

Int_t TGo4BufferQueue::fiOverflowcount [private]
 

Definition at line 137 of file TGo4BufferQueue.h.

TIterator* TGo4BufferQueue::fxBufferIterator [private]
 

Iterator for fxBufferList.

Definition at line 140 of file TGo4BufferQueue.h.

Referenced by InitBuffers(), and ~TGo4BufferQueue().

Int_t TGo4BufferQueue::fiMaxBuffers [private]
 

Number of preallocated buffer TBuffers (maximum entries in fxBufferList).

Definition at line 146 of file TGo4BufferQueue.h.

Referenced by AddBuffer(), and InitBuffers().


The documentation for this class was generated from the following files:
Generated on Tue Nov 8 10:56:30 2005 for Go4-v2.10-5 by doxygen1.2.15