v2.10-0 (21000JUN2005)

Go4Queue
Class TGo4BufferQueue


class TGo4BufferQueue
derived from TGo4Queue

Class containing a pointer queue for TBuffers. Is able to stream
any external TObject into a TBuffer which then is added to the queue.


Field Summary
 const static const Int_tfgiISOWNER
          .we emulate the protected owner flag of the TBuffer class, needed for reallocation!
 private Int_tfiMaxBuffers
          Number of preallocated buffer TBuffers
(maximum entries in fxBufferList).
 private Int_tfiOverflowcount
           
 private TIterator*fxBufferIterator
          Iterator for fxBufferList.
 private TList*fxBufferList
          List of preallocated buffer TBuffers which
are used when TBuffer added to queue should
be "cloned".
 private TMutex*fxBufferMutex
           
 private TList*fxFreeList
          List of buffers which are free for the next add.

Fields inherited from class TNamed
fName, fTitle

Constructor Summary
TGo4BufferQueue()
           
TGo4BufferQueue(const char * name)
           

Destructor Summary
 virtual synchronized ~TGo4BufferQueue()
           

Method Summary
 voidAddBuffer(TBuffer* buffer, Bool_t clone)
          Add buffer pointer to queue.
 voidAddBufferFromObject(TObject* object)
          Reconstruct a TObject queue entry from a given TBuffer pointer.
 virtual voidClear(Option_t* opt)
          Empty the queue and give free buffers back
 static TBuffer*CreateValueBuffer(UInt_t val)
          Create a root buffer that contains a single value val.
 static Int_tDecodeValueBuffer(TBuffer* buf)
          Extract value from buffer that was created by
CreateValueBuffer method.
 voidFreeBuffer(TBuffer* buffer)
          Free internal buffer to be re-used by the AddBuffer as clone
method.
 private voidInitBuffers()
          Initialization of internal queue buffer.
 private TBuffer*NewEntry()
          Create dummy buffer for queue.
 private voidRealloc(TBuffer* buffer, Int_t oldsize, Int_t newsize)
          Reallocate buffer of TBuffer to newsize.
 TBuffer*WaitBuffer()
          Wait for buffer object from queue.
 TObject*WaitObjectFromBuffer()
          Wait for buffer object from queue.

Methods inherited from class Go4Queue.TGo4Queue
Add, GetEntries, IsEmpty, Next, SetMaxEntries, Wait, Wake

Methods inherited from class TNamed
operator=, Clone, Compare, Copy, FillBuffer, GetName, GetTitle, Hash, IsSortable, SetName, SetNameTitle, SetTitle, ls, Print, Sizeof, Class, Class_Name, Class_Version, Dictionary, IsA, ShowMembers, Streamer, StreamerNVirtual, DeclFileName, ImplFileLine, ImplFileName, DeclFileLine

Field Detail

fgiISOWNER

public const static const Int_t fgiISOWNER
.we emulate the protected owner flag of the TBuffer class, needed for reallocation!

fiMaxBuffers

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

fiOverflowcount

private Int_t fiOverflowcount

fxBufferIterator

private TIterator* fxBufferIterator
Iterator for fxBufferList.

fxBufferList

private TList* fxBufferList
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.

fxBufferMutex

private TMutex* fxBufferMutex

fxFreeList

private TList* fxFreeList
List of buffers which are free for the next add.
Constructor Detail

TGo4BufferQueue

public TGo4BufferQueue()

TGo4BufferQueue

public TGo4BufferQueue(const char * name)
Method Detail

~TGo4BufferQueue

public virtual synchronized ~TGo4BufferQueue()
Method Detail

AddBuffer

public void AddBuffer(TBuffer* buffer, Bool_t clone)
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.

AddBufferFromObject

public void 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.

Clear

public virtual void Clear(Option_t* opt)
Empty the queue and give free buffers back

CreateValueBuffer

public static TBuffer* CreateValueBuffer(UInt_t val)
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.

DecodeValueBuffer

public static Int_t DecodeValueBuffer(TBuffer* buf)
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.

FreeBuffer

public void 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.

InitBuffers

private void InitBuffers()
Initialization of internal queue buffer.

NewEntry

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

Realloc

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

WaitBuffer

public TBuffer* WaitBuffer()
Wait for buffer object from queue. We Renamed the protected baseclass method
to avoid user confusion.

WaitObjectFromBuffer

public TObject* 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.

Association Links

to Class TList

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.

to Class TList

List of buffers which are free for the next add.

to Class TMutex

to Class TIterator

Iterator for fxBufferList.

J.Adamczewski, M.Al-Turany, D.Bertini, H.G.Essel, S.Linev

30-06-2005