OSG::DgramQueue Class Reference

Stream socket connection.

#include <OSGDgramQueue.h>

List of all members.


Public Types

typedef std::list< Dgram * > QueueT

Public Member Functions

Constructors


 DgramQueue (void)
Destructor


virtual ~DgramQueue (void)
data put,get


void put (Dgram *dgram)
Dgramget (Lock *lock)
bool empty (void)
void wait (Lock *lock)
bool waiting (void)

Protected Attributes

member


Barrier_barrier
QueueT _queue
bool _waiting

Private Member Functions

 DgramQueue (const DgramQueue &source)
 prohibit default function (move to 'public' if needed)
void operator= (const DgramQueue &source)

Detailed Description

Definition at line 60 of file OSGDgramQueue.h.


Member Typedef Documentation

typedef std::list<Dgram*> OSG::DgramQueue::QueueT

Definition at line 66 of file OSGDgramQueue.h.


Constructor & Destructor Documentation

DgramQueue::DgramQueue ( void   ) 

Definition at line 67 of file OSGDgramQueue.cpp.

References _barrier, and OSG::Barrier::get().

00067                       :
00068     _queue(),
00069     _waiting(false)
00070 {
00071     char barrierName[256];
00072     sprintf(barrierName,"DgramQueue%p",this);
00073 
00074     // create barrier
00075     _barrier = Barrier::get(barrierName);
00076 }

DgramQueue::~DgramQueue ( void   )  [virtual]

Definition at line 80 of file OSGDgramQueue.cpp.

00081 {
00082 }

OSG::DgramQueue::DgramQueue ( const DgramQueue source  )  [private]


Member Function Documentation

void DgramQueue::put ( Dgram dgram  ) 

Dgram * DgramQueue::get ( Lock lock  ) 

get a dgram from the queue. Block if queue is empty

Definition at line 101 of file OSGDgramQueue.cpp.

References _barrier, _queue, _waiting, OSG::Lock::acquire(), OSG::Barrier::enter(), and OSG::Lock::release().

Referenced by OSG::PointMCastConnection::read(), OSG::PointMCastConnection::readBuffer(), OSG::PointMCastConnection::recvQueue(), OSG::GroupMCastConnection::sendQueue(), OSG::GroupMCastConnection::write(), OSG::GroupMCastConnection::~GroupMCastConnection(), and OSG::PointMCastConnection::~PointMCastConnection().

00102 {
00103     Dgram *result;
00104 
00105     if(_queue.empty())
00106     {
00107         _waiting = true;
00108         lock->release();
00109         _barrier->enter(2);
00110         lock->acquire();
00111     }
00112     result = _queue.front();
00113     _queue.pop_front();
00114 
00115     return result;
00116 }

bool DgramQueue::empty ( void   ) 

void DgramQueue::wait ( Lock lock  ) 

wait for a dgram but dont read

Definition at line 120 of file OSGDgramQueue.cpp.

References _barrier, _queue, _waiting, OSG::Lock::acquire(), OSG::Barrier::enter(), and OSG::Lock::release().

Referenced by OSG::PointMCastConnection::selectChannel().

00121 {
00122     if(_queue.empty())
00123     {
00124         _waiting = true;
00125         lock->release();
00126         _barrier->enter(2);
00127         lock->acquire();
00128     }
00129 }

bool DgramQueue::waiting ( void   ) 

true, if reader is waiting

Definition at line 133 of file OSGDgramQueue.cpp.

References _waiting.

Referenced by OSG::GroupMCastConnection::write().

00134 {
00135     return _waiting;
00136 }

void OSG::DgramQueue::operator= ( const DgramQueue source  )  [private]


Member Data Documentation

Definition at line 101 of file OSGDgramQueue.h.

Referenced by DgramQueue(), get(), put(), and wait().

Definition at line 102 of file OSGDgramQueue.h.

Referenced by empty(), get(), put(), and wait().

bool OSG::DgramQueue::_waiting [protected]

Definition at line 103 of file OSGDgramQueue.h.

Referenced by get(), put(), wait(), and waiting().


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