interreality.org [VOS]
[Home] [About]
[Screenshots]
[Download]
[News]
[Community]
[Documentation] [Manual]
[Bugs & Requests] [Wiki]

VOS::MessageBlock Class Reference
[libvos]

#include <vos/vos/messageblock.hh>

Inheritance diagram for VOS::MessageBlock:

VUtil::RefCounted List of all members.

Detailed Description

A message block is a list of messages which have been bundled together into a single block.

It is used for various purposes. One useful feature of a message block is that it is processed all at once: the first message will not be delivered until the entire message block has been received, parsed and queued. This may be useful for supporting transactions.

Definition at line 121 of file messageblock.hh.

Public Member Functions


Constructor & Destructor Documentation

VOS::MessageBlock::MessageBlock (  ) 

VOS::MessageBlock::~MessageBlock (  ) 


Member Function Documentation

void VOS::MessageBlock::appendMessage ( Message m  )  [inline]

Add a message to the message block.

Parameters:
m the message to insert

Definition at line 155 of file messageblock.hh.

std::string VOS::MessageBlock::getBinaryEncoding (  ) 

Get the binary representation of this messageblock, suitable for sending over the network.

unsigned int VOS::MessageBlock::getExpectedBytes (  ) 

Returns:
the number of bytes expected in total for this message or message block

std::string VOS::MessageBlock::getFormattedString (  ) 

Get the XML-like textual representation of this messageblock, suitable for logging to the user.

VUtil::vRef<Message> VOS::MessageBlock::getMessage ( int  n  ) 

Retrieve a message from this messageblock.

Parameters:
n The desired position. May be negative, in which case the position will be counted from the end. The very last element can be accessed using -1.
Returns:
The message at the desired position, or 0 if the index is invalid.

std::string VOS::MessageBlock::getName (  ) 

Returns:
the message block name

unsigned int VOS::MessageBlock::getReceivedBytes (  ) 

Returns:
the number of bytes received so far in the process of downloading this message or message block

void VOS::MessageBlock::insertMessage ( int  n,
Message m 
)

Add a message to the message block.

Parameters:
n The position to insert into. May be negative, in which case the position will be counted from the end. To append to the end, use -1.
m the message to insert

VUtil::vRef<Message> VOS::MessageBlock::lastMessage (  ) 

Returns:
The last message or a null vRef if the message block is empty.

int VOS::MessageBlock::numMessages (  ) 

Returns:
the number of messages in the messageblock.

int VOS::MessageBlock::parseUpdate ( const std::string &  s,
uint32_t &  nonce 
)

Internal parsing function.

Update the current partial parse of this messageblock with new data.

Parameters:
s the new data
Returns:
The number of bytes from the beginning of 's' which were read in.

void VOS::MessageBlock::removeMessage ( int  n  ) 

Remove a message from the message block.

Parameters:
n The position to remove.

void VOS::MessageBlock::setName ( const std::string &  s  ) 

Set the message block name.

This means the message block will be saved with this name rather than executed immediately.

Parameters:
s the name


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