org::xmlBlaster::util::MessageUnit Class Reference

Holding a message. More...

Collaboration diagram for org::xmlBlaster::util::MessageUnit:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MessageUnit (org::xmlBlaster::util::key::KeyData &key, unsigned long len, unsigned char *content, org::xmlBlaster::util::qos::QosData &qos)
 Constructs with a 'char *' and its length 'len'.
 MessageUnit (org::xmlBlaster::util::key::KeyData &key, std::string &content, org::xmlBlaster::util::qos::QosData &qos)
 Constructs a MessageUnit with a std::string.
 MessageUnit (org::xmlBlaster::client::key::PublishKey &xmlKey, std::string &content, org::xmlBlaster::client::qos::PublishQos &publishQos)
 Constructs a MessageUnit with a std::string and a org::xmlBlaster::client::qos::PublishQos object.
 MessageUnit (org::xmlBlaster::util::key::KeyData &xmlKey, std::vector< unsigned char > &contentVec, org::xmlBlaster::util::qos::QosData &qos)
 Constructs the message unit.
 MessageUnit (org::xmlBlaster::client::key::PublishKey &xmlKey, std::vector< unsigned char > &contentVec, org::xmlBlaster::client::qos::PublishQos &publishQos)
 Constructs the message unit by taking a org::xmlBlaster::client::qos::PublishQos object.
 MessageUnit (MessageUnit &rhs)
 Copy constructor.
MessageUnitoperator= (MessageUnit &rhs)
 Assignment constructor.
virtual ~MessageUnit ()
 Destructor.
org::xmlBlaster::util::key::KeyDataRef getKeyRef ()
 
Returns:
The xml based key, reference counted

org::xmlBlaster::util::key::KeyDatagetKey ()
 The life cycle of the returned object is limited to this MessageUnit.
std::vector< unsigned char > getContentVec ()
 
Returns:
The user data carried with this message This is created for each invocation so use it sparingly

unsigned char * getContent ()
 Access the raw user data, use getContentLen() to access the length.
unsigned long getContentLen ()
 Access the length of the raw user data.
std::string getContentStr ()
 
Returns:
The user data carried with this message as a std::string

org::xmlBlaster::util::qos::QosDataRef getQosRef ()
 
Returns:
The xml based QoS, reference counted

org::xmlBlaster::util::qos::QosDatagetQos ()
 The life cycle of the returned object is limited to this MessageUnit.
size_t getSizeInBytes ()
 Get the immutable size of this message.
std::string toXml (std::string &extraOffset="")
 Dump state of this object into a XML ASCII std::string.

Detailed Description

Holding a message.

This class corresponds to the CORBA serverIdl::MessageUnit struct but uses standard STL only.

Since:
0.79e
Author:
xmlBlaster@marcelruff.info

laghi@swissinfo.org

Definition at line 32 of file MessageUnit.h.


Constructor & Destructor Documentation

org::xmlBlaster::util::MessageUnit::MessageUnit ( org::xmlBlaster::util::key::KeyData key,
unsigned long  len,
unsigned char *  content,
org::xmlBlaster::util::qos::QosData qos 
)

Constructs with a 'char *' and its length 'len'.

Definition at line 29 of file MessageUnit.cpp.

org::xmlBlaster::util::MessageUnit::MessageUnit ( org::xmlBlaster::util::key::KeyData key,
std::string &  content,
org::xmlBlaster::util::qos::QosData qos 
)

Constructs a MessageUnit with a std::string.

org::xmlBlaster::util::MessageUnit::MessageUnit ( org::xmlBlaster::client::key::PublishKey xmlKey,
std::string &  content,
org::xmlBlaster::client::qos::PublishQos publishQos 
)

Constructs a MessageUnit with a std::string and a org::xmlBlaster::client::qos::PublishQos object.

org::xmlBlaster::util::MessageUnit::MessageUnit ( org::xmlBlaster::util::key::KeyData xmlKey,
std::vector< unsigned char > &  contentVec,
org::xmlBlaster::util::qos::QosData qos 
)

Constructs the message unit.

org::xmlBlaster::util::MessageUnit::MessageUnit ( org::xmlBlaster::client::key::PublishKey xmlKey,
std::vector< unsigned char > &  contentVec,
org::xmlBlaster::client::qos::PublishQos publishQos 
)

Constructs the message unit by taking a org::xmlBlaster::client::qos::PublishQos object.

org::xmlBlaster::util::MessageUnit::MessageUnit ( MessageUnit rhs  ) 

Copy constructor.

The content is cloned but the KeyData and QosData is referenced.

Definition at line 123 of file MessageUnit.cpp.

References getContent().

org::xmlBlaster::util::MessageUnit::~MessageUnit (  )  [virtual]

Destructor.

Definition at line 154 of file MessageUnit.cpp.


Member Function Documentation

MessageUnit & org::xmlBlaster::util::MessageUnit::operator= ( MessageUnit rhs  ) 

Assignment constructor.

The content is cloned but the KeyData and QosData is referenced.

Definition at line 139 of file MessageUnit.cpp.

References getContent(), getContentLen(), getKeyRef(), getQosRef(), and getSizeInBytes().

KeyDataRef org::xmlBlaster::util::MessageUnit::getKeyRef (  ) 

Returns:
The xml based key, reference counted

Definition at line 165 of file MessageUnit.cpp.

Referenced by operator=().

KeyData & org::xmlBlaster::util::MessageUnit::getKey (  ) 

The life cycle of the returned object is limited to this MessageUnit.

Returns:
The xml based key

Definition at line 160 of file MessageUnit.cpp.

Referenced by org::xmlBlaster::client::protocol::corba::CorbaConnection::copyToCorba(), org::xmlBlaster::util::queue::MsgQueueEntry::getEmbeddedObject(), org::xmlBlaster::util::queue::EraseQueueEntry::getEraseKey(), org::xmlBlaster::util::queue::SubscribeQueueEntry::getSubscribeKey(), org::xmlBlaster::util::queue::UnSubscribeQueueEntry::getUnSubscribeKey(), org::xmlBlaster::util::dispatch::ConnectionsHandler::publish(), org::xmlBlaster::client::protocol::socket::SocketDriver::publish(), and org::xmlBlaster::util::dispatch::ConnectionsHandler::queuePublish().

vector< unsigned char > org::xmlBlaster::util::MessageUnit::getContentVec (  ) 

Returns:
The user data carried with this message This is created for each invocation so use it sparingly

Definition at line 170 of file MessageUnit.cpp.

unsigned char* org::xmlBlaster::util::MessageUnit::getContent (  ) 

Access the raw user data, use getContentLen() to access the length.

Definition at line 129 of file MessageUnit.h.

Referenced by org::xmlBlaster::client::protocol::corba::CorbaConnection::copyToCorba(), org::xmlBlaster::util::queue::MsgQueueEntry::getEmbeddedObject(), MessageUnit(), operator=(), and org::xmlBlaster::client::protocol::socket::SocketDriver::publish().

unsigned long org::xmlBlaster::util::MessageUnit::getContentLen (  ) 

Access the length of the raw user data.

Definition at line 136 of file MessageUnit.h.

Referenced by org::xmlBlaster::client::protocol::corba::CorbaConnection::copyToCorba(), org::xmlBlaster::util::queue::MsgQueueEntry::getEmbeddedObject(), operator=(), and org::xmlBlaster::client::protocol::socket::SocketDriver::publish().

std::string org::xmlBlaster::util::MessageUnit::getContentStr (  ) 

Returns:
The user data carried with this message as a std::string

Definition at line 190 of file MessageUnit.cpp.

QosDataRef org::xmlBlaster::util::MessageUnit::getQosRef (  ) 

Returns:
The xml based QoS, reference counted

Definition at line 202 of file MessageUnit.cpp.

Referenced by operator=().

QosData & org::xmlBlaster::util::MessageUnit::getQos (  ) 

The life cycle of the returned object is limited to this MessageUnit.

Returns:
The quality of service of this message.

Definition at line 197 of file MessageUnit.cpp.

Referenced by org::xmlBlaster::client::protocol::corba::CorbaConnection::copyToCorba(), org::xmlBlaster::util::queue::MsgQueueEntry::getEmbeddedObject(), org::xmlBlaster::util::queue::EraseQueueEntry::getEraseQos(), org::xmlBlaster::util::queue::SubscribeQueueEntry::getSubscribeQos(), org::xmlBlaster::util::queue::UnSubscribeQueueEntry::getUnSubscribeQos(), org::xmlBlaster::util::dispatch::ConnectionsHandler::publish(), org::xmlBlaster::client::protocol::socket::SocketDriver::publish(), org::xmlBlaster::util::queue::PublishQueueEntry::PublishQueueEntry(), org::xmlBlaster::util::dispatch::ConnectionsHandler::queuePublish(), org::xmlBlaster::util::queue::MsgQueueEntry::setSender(), and org::xmlBlaster::test::TestQueue::testWithOnePublishEntry().

size_t org::xmlBlaster::util::MessageUnit::getSizeInBytes (  ) 

Get the immutable size of this message.

Definition at line 182 of file MessageUnit.cpp.

Referenced by org::xmlBlaster::util::queue::PublishQueueEntry::getSizeInBytes(), org::xmlBlaster::util::queue::MsgQueueEntry::getSizeInBytes(), and operator=().

std::string org::xmlBlaster::util::MessageUnit::toXml ( std::string &  extraOffset = ""  ) 

Dump state of this object into a XML ASCII std::string.


Parameters:
extraOffset indenting of tags for nice output
Returns:
The MessageUnit as a XML ASCII std::string

Referenced by TestEmptyContent::execute(), HelloWorld2::execute(), org::xmlBlaster::util::queue::MsgQueueEntry::getEmbeddedObject(), org::xmlBlaster::util::dispatch::ConnectionsHandler::publish(), org::xmlBlaster::client::XmlBlasterAccess::publish(), org::xmlBlaster::client::protocol::corba::CorbaConnection::publish(), and PublishDemo::publish().


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