Quick Links: |
#include <bmqa_messageproperties.h>
Public Member Functions | |
BSLMF_NESTED_TRAIT_DECLARATION(MessageProperties, bslma::UsesBslmaAllocator) explicit MessageProperties(bslma | MessageProperties (const MessageProperties &other, bslma::Allocator *basicAllocator=0) |
~MessageProperties () | |
MessageProperties & | operator= (const MessageProperties &rhs) |
bool | remove (const bsl::string &name, bmqt::PropertyType::Enum *buffer=0) |
void | clear () |
int | setPropertyAsBool (const bsl::string &name, bool value) |
int | setPropertyAsChar (const bsl::string &name, char value) |
int | setPropertyAsShort (const bsl::string &name, short value) |
int | setPropertyAsInt32 (const bsl::string &name, bsl::int32_t value) |
int | setPropertyAsInt64 (const bsl::string &name, bsls::Types::Int64 value) |
int | setPropertyAsString (const bsl::string &name, const bsl::string &value) |
int | setPropertyAsBinary (const bsl::string &name, const bsl::vector< char > &value) |
int | streamIn (const bdlbb::Blob &blob) |
int | numProperties () const |
int | totalSize () const |
bool | hasProperty (const bsl::string &name, bmqt::PropertyType::Enum *type=0) const |
bmqt::PropertyType::Enum | propertyType (const bsl::string &name) const |
bool | getPropertyAsBool (const bsl::string &name) const |
char | getPropertyAsChar (const bsl::string &name) const |
short | getPropertyAsShort (const bsl::string &name) const |
bsl::int32_t | getPropertyAsInt32 (const bsl::string &name) const |
bsls::Types::Int64 | getPropertyAsInt64 (const bsl::string &name) const |
const bsl::string & | getPropertyAsString (const bsl::string &name) const |
const bsl::vector< char > & | getPropertyAsBinary (const bsl::string &name) const |
bool | getPropertyAsBoolOr (const bsl::string &name, bool value) const |
char | getPropertyAsCharOr (const bsl::string &name, char value) const |
short | getPropertyAsShortOr (const bsl::string &name, short value) const |
bsl::int32_t | getPropertyAsInt32Or (const bsl::string &name, bsl::int32_t value) const |
bsls::Types::Int64 | getPropertyAsInt64Or (const bsl::string &name, bsls::Types::Int64 value) const |
const bsl::string & | getPropertyAsStringOr (const bsl::string &name, const bsl::string &value) const |
const bsl::vector< char > & | getPropertyAsBinaryOr (const bsl::string &name, const bsl::vector< char > &value) const |
const bdlbb::Blob & | streamOut (bdlbb::BlobBufferFactory *bufferFactory) const |
bsl::ostream & | print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const |
Static Public Attributes | |
static const int | k_MAX_NUM_PROPERTIES = 255 |
static const int | k_MAX_PROPERTIES_AREA_LENGTH = (64 * 1024 * 1024) - 8 |
static const int | k_MAX_PROPERTY_NAME_LENGTH = 4095 |
static const int | k_MAX_PROPERTY_VALUE_LENGTH = 67104745 |
Friends | |
class | MessagePropertiesIterator |
Provide a VST representing message properties.
See Component bmqa_messageproperties
BSLMF_NESTED_TRAIT_DECLARATION (MessageProperties, bslma::UsesBslmaAllocator) explicit MessageProperties(bslma bmqa::MessageProperties::MessageProperties | ( | const MessageProperties & | other, | |
bslma::Allocator * | basicAllocator = 0 | |||
) |
< Create an empty instance of MessageProperties
. Optionally specify a basicAllocator
used to supply memory. Note that it is more efficient to use a MessageProperties
object retrieved via Session::loadMessageProperties
, instead of creating it via this constructor. Create an instance of MessageProperties
having the same value as the specified other
, that will use the optionally specified basicAllocator
to supply memory.
bmqa::MessageProperties::~MessageProperties | ( | ) |
Destroy this object.
MessageProperties& bmqa::MessageProperties::operator= | ( | const MessageProperties & | rhs | ) |
Assign to this object the value of the specified rhs
object.
bool bmqa::MessageProperties::remove | ( | const bsl::string & | name, | |
bmqt::PropertyType::Enum * | buffer = 0 | |||
) |
Remove the property with the specified name
if one exists and return true and load into the optionally specified buffer
the data type of the property. Return false if the name
property does not exist, and leave the buffer
unchanged.
void bmqa::MessageProperties::clear | ( | ) |
Remove all properties from this instance. Note that numProperties
will return zero after invoking this method.
int bmqa::MessageProperties::setPropertyAsBool | ( | const bsl::string & | name, | |
bool | value | |||
) |
int bmqa::MessageProperties::setPropertyAsChar | ( | const bsl::string & | name, | |
char | value | |||
) |
int bmqa::MessageProperties::setPropertyAsShort | ( | const bsl::string & | name, | |
short | value | |||
) |
int bmqa::MessageProperties::setPropertyAsInt32 | ( | const bsl::string & | name, | |
bsl::int32_t | value | |||
) |
int bmqa::MessageProperties::setPropertyAsInt64 | ( | const bsl::string & | name, | |
bsls::Types::Int64 | value | |||
) |
int bmqa::MessageProperties::setPropertyAsString | ( | const bsl::string & | name, | |
const bsl::string & | value | |||
) |
int bmqa::MessageProperties::setPropertyAsBinary | ( | const bsl::string & | name, | |
const bsl::vector< char > & | value | |||
) |
Set a property with the specified name
having the specified value
with the corresponding data type. Return zero on success, and a non-zero value in case of failure. Note that if a property with name
and the same type exists, it will be updated with the provided value
, however if the data type of the existing property differs, an error will be returned.
int bmqa::MessageProperties::streamIn | ( | const bdlbb::Blob & | blob | ) |
Populate this instance with its BlazingMQ wire protocol representation from the specified blob
. Return zero on success, and a non-zero value otherwise.
int bmqa::MessageProperties::numProperties | ( | ) | const |
Return the total number of properties set in this instance.
int bmqa::MessageProperties::totalSize | ( | ) | const |
Return the total size (in bytes) of the wire representation of this instance. Note that returned value includes the BlazingMQ wire protocol overhead as well.
bool bmqa::MessageProperties::hasProperty | ( | const bsl::string & | name, | |
bmqt::PropertyType::Enum * | type = 0 | |||
) | const |
Return true if a property with the specified name
exists and load into the optionally specified type
the type of the property. Return false otherwise.
bmqt::PropertyType::Enum bmqa::MessageProperties::propertyType | ( | const bsl::string & | name | ) | const |
Return the type of property having the specified name
. Behavior is undefined unless hasProperty
returns true for the property name
.
bool bmqa::MessageProperties::getPropertyAsBool | ( | const bsl::string & | name | ) | const |
char bmqa::MessageProperties::getPropertyAsChar | ( | const bsl::string & | name | ) | const |
short bmqa::MessageProperties::getPropertyAsShort | ( | const bsl::string & | name | ) | const |
bsl::int32_t bmqa::MessageProperties::getPropertyAsInt32 | ( | const bsl::string & | name | ) | const |
bsls::Types::Int64 bmqa::MessageProperties::getPropertyAsInt64 | ( | const bsl::string & | name | ) | const |
const bsl::string& bmqa::MessageProperties::getPropertyAsString | ( | const bsl::string & | name | ) | const |
const bsl::vector<char>& bmqa::MessageProperties::getPropertyAsBinary | ( | const bsl::string & | name | ) | const |
Return the property having the corresponding type and the specified name
. Behavior is undefined unless property with name
exists.
bool bmqa::MessageProperties::getPropertyAsBoolOr | ( | const bsl::string & | name, | |
bool | value | |||
) | const |
char bmqa::MessageProperties::getPropertyAsCharOr | ( | const bsl::string & | name, | |
char | value | |||
) | const |
short bmqa::MessageProperties::getPropertyAsShortOr | ( | const bsl::string & | name, | |
short | value | |||
) | const |
bsl::int32_t bmqa::MessageProperties::getPropertyAsInt32Or | ( | const bsl::string & | name, | |
bsl::int32_t | value | |||
) | const |
bsls::Types::Int64 bmqa::MessageProperties::getPropertyAsInt64Or | ( | const bsl::string & | name, | |
bsls::Types::Int64 | value | |||
) | const |
const bsl::string& bmqa::MessageProperties::getPropertyAsStringOr | ( | const bsl::string & | name, | |
const bsl::string & | value | |||
) | const |
const bsl::vector<char>& bmqa::MessageProperties::getPropertyAsBinaryOr | ( | const bsl::string & | name, | |
const bsl::vector< char > & | value | |||
) | const |
Return the property having the corresponding type and the specified name
if property with such a name exists. Return the specified value
if property with name
does not exist.
const bdlbb::Blob& bmqa::MessageProperties::streamOut | ( | bdlbb::BlobBufferFactory * | bufferFactory | ) | const |
Return a blob having the BlazingMQ wire protocol representation of this instance, using the specified bufferFactory
to build the blob. Behavior is undefined unless bufferFactory
is non-null. Note that if this instance is empty (i.e., numProperties()
== 0), returned blob will be empty. In other words, an empty instance has no wire representation.
bsl::ostream& bmqa::MessageProperties::print | ( | bsl::ostream & | stream, | |
int | level = 0 , |
|||
int | spacesPerLevel = 4 | |||
) | const |
Format this object to the specified output stream
at the (absolute value of) the optionally specified indentation level
and return a reference to stream
. If level
is specified, optionally specify spacesPerLevel
, the number of spaces per indentation level for this and all of its nested objects. If level
is negative, suppress indentation of the first line. If spacesPerLevel
is negative format the entire output on one line, suppressing all but the initial indentation (as governed by level
). If stream
is not valid on entry, this operation has no effect.
friend class MessagePropertiesIterator [friend] |
const int bmqa::MessageProperties::k_MAX_NUM_PROPERTIES = 255 [static] |
const int bmqa::MessageProperties::k_MAX_PROPERTIES_AREA_LENGTH = (64 * 1024 * 1024) - 8 [static] |
Maximum length of all the properties (including their names, values and the wire protocol overhead). Note that this value is just under 64 MB.
const int bmqa::MessageProperties::k_MAX_PROPERTY_NAME_LENGTH = 4095 [static] |
const int bmqa::MessageProperties::k_MAX_PROPERTY_VALUE_LENGTH = 67104745 [static] |
~64 MB