#include <TGo4BufferQueue.h>
Public Member Functions | |
TGo4BufferQueue () | |
TGo4BufferQueue (const char *name) | |
void | AddBufferFromObject (TObject *object) |
Reconstruct a TObject queue entry from a given TBuffer pointer. | |
void | AddBuffer (TBuffer *buffer, Bool_t clone=kFALSE) |
Add buffer pointer to queue. | |
void | FreeBuffer (TBuffer *buffer) |
Free internal buffer to be re-used by the AddBuffer as clone method. | |
virtual void | Clear (Option_t *opt="") |
Empty the queue and give free buffers back. | |
TBuffer * | WaitBuffer () |
Wait for buffer object from queue. | |
TObject * | WaitObjectFromBuffer () |
Wait for buffer object from queue. | |
virtual | ~TGo4BufferQueue () |
Static Public Member Functions | |
static TBuffer * | CreateValueBuffer (UInt_t val) |
Create a root buffer that contains a single value val. | |
static Int_t | DecodeValueBuffer (TBuffer *buf) |
Extract value from buffer that was created by CreateValueBuffer method. | |
Static Public Attributes | |
static const Int_t | fgiISOWNER = BIT(14) |
.we emulate the protected owner flag of the TBuffer class, needed for reallocation! | |
Private Member Functions | |
void | InitBuffers () |
Initialization of internal queue buffer. | |
void | Realloc (TBuffer *buffer, Int_t oldsize, Int_t newsize) |
Reallocate buffer of TBuffer to newsize. | |
TBuffer * | NewEntry () |
Create dummy buffer for queue. | |
Private Attributes | |
TList * | fxBufferList |
List of preallocated buffer TBuffers which are used when TBuffer added to queue should be "cloned". | |
TList * | fxFreeList |
List of buffers which are free for the next add. | |
TMutex * | fxBufferMutex |
Int_t | fiOverflowcount |
TIterator * | fxBufferIterator |
Iterator for fxBufferList. | |
Int_t | fiMaxBuffers |
Number of preallocated buffer TBuffers (maximum entries in fxBufferList). |
Is able to stream any external TObject into a TBuffer which then is added to the queue.
Definition at line 27 of file TGo4BufferQueue.h.
TGo4BufferQueue::TGo4BufferQueue | ( | ) |
Definition at line 40 of file TGo4BufferQueue.cxx.
TGo4BufferQueue::TGo4BufferQueue | ( | const char * | name | ) |
Definition at line 48 of file TGo4BufferQueue.cxx.
TGo4BufferQueue::~TGo4BufferQueue | ( | ) | [virtual] |
Definition at line 73 of file TGo4BufferQueue.cxx.
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 205 of file TGo4BufferQueue.cxx.
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 135 of file TGo4BufferQueue.cxx.
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 252 of file TGo4BufferQueue.cxx.
void TGo4BufferQueue::Clear | ( | Option_t * | opt = "" |
) | [virtual] |
Empty the queue and give free buffers back.
Reimplemented from TGo4Queue.
Definition at line 287 of file TGo4BufferQueue.cxx.
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.
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 92 of file TGo4BufferQueue.cxx.
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 346 of file TGo4BufferQueue.cxx.
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 357 of file TGo4BufferQueue.cxx.
void TGo4BufferQueue::InitBuffers | ( | ) | [private] |
void TGo4BufferQueue::Realloc | ( | TBuffer * | buffer, | |
Int_t | oldsize, | |||
Int_t | newsize | |||
) | [private] |
TBuffer * TGo4BufferQueue::NewEntry | ( | ) | [private] |
const Int_t TGo4BufferQueue::fgiISOWNER = BIT(14) [static] |
.we emulate the protected owner flag of the TBuffer class, needed for reallocation!
Definition at line 98 of file TGo4BufferQueue.h.
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 129 of file TGo4BufferQueue.h.
TList* TGo4BufferQueue::fxFreeList [private] |
TMutex* TGo4BufferQueue::fxBufferMutex [private] |
Definition at line 133 of file TGo4BufferQueue.h.
Int_t TGo4BufferQueue::fiOverflowcount [private] |
Definition at line 134 of file TGo4BufferQueue.h.
TIterator* TGo4BufferQueue::fxBufferIterator [private] |
Int_t TGo4BufferQueue::fiMaxBuffers [private] |
Number of preallocated buffer TBuffers (maximum entries in fxBufferList).
Definition at line 143 of file TGo4BufferQueue.h.