Sirikata
|
A queue router element which buffers packets. More...
#include <QueueRouterElement.hpp>
Public Types | |
typedef std::tr1::function < uint32(PacketType *) | SizeFunctor ) |
Public Member Functions | |
QueueRouterElement (uint32 max_size, SizeFunctor sizefunc) | |
~QueueRouterElement () | |
bool | empty () |
bool | push (PacketType *pkt) |
virtual bool | push (uint32 port, PacketType *pkt) |
Push a packet to this element on the given port. | |
bool | push (PacketType *pkt, bool force) |
bool | push (uint32 port, PacketType *pkt, bool force) |
bool | wentNonEmpty () |
If a push causes the queue to go from empty to non-empty, this will return true. | |
PacketType * | pull () |
virtual PacketType * | pull (uint32 port) |
Pull a packet from the element on the specified port. | |
Private Types | |
typedef boost::mutex | mutex |
typedef boost::unique_lock< mutex > | unique_lock |
typedef std::queue< PacketType * > | PacketQueue |
Private Attributes | |
boost::mutex | mMutex |
PacketQueue | mPackets |
const SizeFunctor | mSizeFunctor |
uint32 | mMaxSize |
Sirikata::AtomicValue< uint32 > | mSize |
bool | mWentNonEmpty |
A queue router element which buffers packets.
The size of the queue and a method for determining the size of a packet is provided. If the maximum size would be violated, drops the last item in the queue. Only has a single input and output.
typedef boost::mutex Sirikata::QueueRouterElement< PacketType >::mutex [private] |
typedef std::queue<PacketType*> Sirikata::QueueRouterElement< PacketType >::PacketQueue [private] |
typedef std::tr1::function<uint32(PacketType*) Sirikata::QueueRouterElement< PacketType >::SizeFunctor) |
typedef boost::unique_lock<mutex> Sirikata::QueueRouterElement< PacketType >::unique_lock [private] |
Sirikata::QueueRouterElement< PacketType >::QueueRouterElement | ( | uint32 | max_size, |
SizeFunctor | sizefunc | ||
) | [inline] |
Sirikata::QueueRouterElement< PacketType >::~QueueRouterElement | ( | ) | [inline] |
bool Sirikata::QueueRouterElement< PacketType >::empty | ( | ) | [inline] |
Referenced by Sirikata::SpaceNodeConnection::empty().
virtual PacketType* Sirikata::QueueRouterElement< PacketType >::pull | ( | uint32 | port | ) | [inline, virtual] |
Pull a packet from the element on the specified port.
port | the port to request the packet from |
Implements Sirikata::UpstreamElementBase< PacketType >.
PacketType* Sirikata::QueueRouterElement< PacketType >::pull | ( | ) | [inline] |
bool Sirikata::QueueRouterElement< PacketType >::push | ( | PacketType * | pkt, |
bool | force | ||
) | [inline] |
bool Sirikata::QueueRouterElement< PacketType >::push | ( | uint32 | port, |
PacketType * | pkt, | ||
bool | force | ||
) | [inline] |
bool Sirikata::QueueRouterElement< PacketType >::push | ( | PacketType * | pkt | ) | [inline] |
Referenced by Sirikata::QueueRouterElement< ObjectMessage >::push().
virtual bool Sirikata::QueueRouterElement< PacketType >::push | ( | uint32 | port, |
PacketType * | pkt | ||
) | [inline, virtual] |
Push a packet to this element on the given port.
port | the port to push the packet to |
pkt | the packet to push |
Implements Sirikata::DownstreamElementBase< PacketType >.
bool Sirikata::QueueRouterElement< PacketType >::wentNonEmpty | ( | ) | [inline] |
If a push causes the queue to go from empty to non-empty, this will return true.
Calling this resets the value.
uint32 Sirikata::QueueRouterElement< PacketType >::mMaxSize [private] |
Referenced by Sirikata::QueueRouterElement< ObjectMessage >::push().
boost::mutex Sirikata::QueueRouterElement< PacketType >::mMutex [private] |
PacketQueue Sirikata::QueueRouterElement< PacketType >::mPackets [private] |
Sirikata::AtomicValue<uint32> Sirikata::QueueRouterElement< PacketType >::mSize [private] |
const SizeFunctor Sirikata::QueueRouterElement< PacketType >::mSizeFunctor [private] |
bool Sirikata::QueueRouterElement< PacketType >::mWentNonEmpty [private] |