MAK RTIspy API Documentation for HLA Evolved
List of all members | Public Member Functions | Protected Attributes
DtMsgBundler Class Reference

The DtMsgBundler class provides a means for bundling and unbundling messages. More...

+ Collaboration diagram for DtMsgBundler:

Public Member Functions

 DtMsgBundler (DtBoost::shared_ptr< DtMsgHeaderReader > hdrReader, size_t maxBundleSize=0)
 Constructor.
virtual ~DtMsgBundler ()
 Destructor.
virtual bool addToBundle (char *msg, size_t msgSize)
 Adds a message to the current bundle.
virtual bool getBundle (char **bundlePtr, size_t &bundleSize)
 Returns the location and size of the current bundle.
virtual bool isBundled (const char *bufferPtr, size_t size) const
 Returns true if the given message is bundled.
virtual bool unbundle (char *bufferPtr, size_t size)
 Unbundle new packet.
virtual bool recvNextMsgFromBundle (char **msgPtr, size_t &msgSize)
 Returns the location and size of the next message in the received bundle.
virtual size_t maxSendBundleSize () const
 Get/Set the maximum outgoing bundle size.
virtual void setMaxSendBundleSize (size_t maxSize)

Protected Attributes

std::vector< char > mySendBundlingBuff
 The buffer for storing messages in the current outgoing bundle.
size_t myCurrSendBundleSize
 The size of the current outgoing bundle.
size_t myRemainingRecvBundleSize
 The remaining size of the current received bundle.
char * myNextRecvMsg
 The location of the next message in the received bundle.
bool myResizeSendBuff
 Whether the maximum send bundle must be resized next time it is emptied.
size_t myNewSendBuffSize
 The new size for the send buffer.
DtBoost::shared_ptr
< DtMsgHeaderReader
myHeaderReader
 Reads data from message header.

Detailed Description

The DtMsgBundler class provides a means for bundling and unbundling messages.

Constructor & Destructor Documentation

DtMsgBundler::DtMsgBundler ( DtBoost::shared_ptr< DtMsgHeaderReader hdrReader,
size_t  maxBundleSize = 0 
)

Constructor.

DtMsgBundler::~DtMsgBundler ( )
virtual

Destructor.

Member Function Documentation

bool DtMsgBundler::addToBundle ( char *  msg,
size_t  msgSize 
)
virtual

Adds a message to the current bundle.

Returns false if message was too large to be added to the bundle.

References myCurrSendBundleSize, myHeaderReader, and mySendBundlingBuff.

Referenced by DtUdpMsgSocket::sendMessage(), and DtTcpMsgSocket::sendMessage().

bool DtMsgBundler::getBundle ( char **  bundlePtr,
size_t &  bundleSize 
)
virtual

Returns the location and size of the current bundle.

A new bundle will be started the next time addToBundle is called. Return value is false if there are no bundled messages.

References myCurrSendBundleSize, myNewSendBuffSize, myResizeSendBuff, and mySendBundlingBuff.

Referenced by DtUdpMsgSocket::flush(), DtTcpMsgSocket::flush(), DtUdpMsgSocket::sendMessage(), and DtTcpMsgSocket::sendMessage().

bool DtMsgBundler::isBundled ( const char *  bufferPtr,
size_t  size 
) const
virtual

Returns true if the given message is bundled.

References myHeaderReader.

Referenced by DtUdpMsgSocket::recv().

size_t DtMsgBundler::maxSendBundleSize ( ) const
virtual

Get/Set the maximum outgoing bundle size.

Changes may not take affect until after the current bundle is sent.

References myNewSendBuffSize, myResizeSendBuff, and mySendBundlingBuff.

Referenced by DtTcpMsgSocket::bundleSize(), and DtUdpMsgSocket::sendMessage().

bool DtMsgBundler::recvNextMsgFromBundle ( char **  msgPtr,
size_t &  msgSize 
)
virtual

Returns the location and size of the next message in the received bundle.

Returns false if there were no messages left in bundle.

References myHeaderReader, myNextRecvMsg, and myRemainingRecvBundleSize.

Referenced by DtUdpMsgSocket::recv().

void DtMsgBundler::setMaxSendBundleSize ( size_t  maxSize)
virtual
bool DtMsgBundler::unbundle ( char *  bufferPtr,
size_t  size 
)
virtual

Unbundle new packet.

Buffer must remain valid until bundle is completely processed. If unbundling already in progress, previous bundle is lost. Returns false if an error occurs.

References myNextRecvMsg, and myRemainingRecvBundleSize.

Referenced by DtUdpMsgSocket::recv().

Member Data Documentation

size_t DtMsgBundler::myCurrSendBundleSize
protected

The size of the current outgoing bundle.

Referenced by addToBundle(), getBundle(), and setMaxSendBundleSize().

DtBoost::shared_ptr<DtMsgHeaderReader> DtMsgBundler::myHeaderReader
protected

Reads data from message header.

Referenced by addToBundle(), isBundled(), and recvNextMsgFromBundle().

size_t DtMsgBundler::myNewSendBuffSize
protected

The new size for the send buffer.

Referenced by getBundle(), maxSendBundleSize(), and setMaxSendBundleSize().

char* DtMsgBundler::myNextRecvMsg
protected

The location of the next message in the received bundle.

Referenced by recvNextMsgFromBundle(), and unbundle().

size_t DtMsgBundler::myRemainingRecvBundleSize
protected

The remaining size of the current received bundle.

Referenced by recvNextMsgFromBundle(), and unbundle().

bool DtMsgBundler::myResizeSendBuff
protected

Whether the maximum send bundle must be resized next time it is emptied.

Referenced by getBundle(), maxSendBundleSize(), and setMaxSendBundleSize().

std::vector<char> DtMsgBundler::mySendBundlingBuff
protected

The buffer for storing messages in the current outgoing bundle.

Referenced by addToBundle(), getBundle(), maxSendBundleSize(), and setMaxSendBundleSize().


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

Document ID: Generated on Fri Mar 14 19:08:55 EDT 2014 from SVN revision 137085
Copyright © 2005-2014 VT MÄK Inc. All Rights Reserved (www.mak.com)