|
libbmq b6028b29b733bc7541593d2905a5f79a9f0192fc
|
Provide a VST representing message properties.
#include <bmqa_messageproperties.h>
Public Member Functions | |
| MessageProperties (bslma::Allocator *basicAllocator=0) | |
| MessageProperties (const MessageProperties &other, bslma::Allocator *basicAllocator=0) | |
| ~MessageProperties () | |
| Destroy this object. | |
| MessageProperties & | operator= (const MessageProperties &rhs) |
Assign to this object the value of the specified rhs object. | |
| 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 |
| Return the total number of properties set in this instance. | |
| 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 |
Maximum number of properties that can appear in a bmqa::Message. | |
| static const int | k_MAX_PROPERTIES_AREA_LENGTH = (64 * 1024 * 1024) - 8 |
| static const int | k_MAX_PROPERTY_NAME_LENGTH = 4095 |
| Maximum length of a property name. | |
| static const int | k_MAX_PROPERTY_VALUE_LENGTH = 67104745 |
Friends | |
| class | MessagePropertiesIterator |
|
explicit |
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.
| BloombergLP::bmqa::MessageProperties::MessageProperties | ( | const MessageProperties & | other, |
| bslma::Allocator * | basicAllocator = 0 |
||
| ) |
Create an instance of MessageProperties having the same value as the specified other, that will use the optionally specified basicAllocator to supply memory.
| BloombergLP::bmqa::MessageProperties::~MessageProperties | ( | ) |
| MessageProperties & BloombergLP::bmqa::MessageProperties::operator= | ( | const MessageProperties & | rhs | ) |
| bool BloombergLP::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 BloombergLP::bmqa::MessageProperties::clear | ( | ) |
Remove all properties from this instance. Note that numProperties will return zero after invoking this method.
| int BloombergLP::bmqa::MessageProperties::setPropertyAsBool | ( | const bsl::string & | name, |
| bool | value | ||
| ) |
| int BloombergLP::bmqa::MessageProperties::setPropertyAsChar | ( | const bsl::string & | name, |
| char | value | ||
| ) |
| int BloombergLP::bmqa::MessageProperties::setPropertyAsShort | ( | const bsl::string & | name, |
| short | value | ||
| ) |
| int BloombergLP::bmqa::MessageProperties::setPropertyAsInt32 | ( | const bsl::string & | name, |
| bsl::int32_t | value | ||
| ) |
| int BloombergLP::bmqa::MessageProperties::setPropertyAsInt64 | ( | const bsl::string & | name, |
| bsls::Types::Int64 | value | ||
| ) |
| int BloombergLP::bmqa::MessageProperties::setPropertyAsString | ( | const bsl::string & | name, |
| const bsl::string & | value | ||
| ) |
| int BloombergLP::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 BloombergLP::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 BloombergLP::bmqa::MessageProperties::numProperties | ( | ) | const |
| int BloombergLP::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 BloombergLP::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 BloombergLP::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 BloombergLP::bmqa::MessageProperties::getPropertyAsBool | ( | const bsl::string & | name | ) | const |
| char BloombergLP::bmqa::MessageProperties::getPropertyAsChar | ( | const bsl::string & | name | ) | const |
| short BloombergLP::bmqa::MessageProperties::getPropertyAsShort | ( | const bsl::string & | name | ) | const |
| bsl::int32_t BloombergLP::bmqa::MessageProperties::getPropertyAsInt32 | ( | const bsl::string & | name | ) | const |
| bsls::Types::Int64 BloombergLP::bmqa::MessageProperties::getPropertyAsInt64 | ( | const bsl::string & | name | ) | const |
| const bsl::string & BloombergLP::bmqa::MessageProperties::getPropertyAsString | ( | const bsl::string & | name | ) | const |
| const bsl::vector< char > & BloombergLP::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 BloombergLP::bmqa::MessageProperties::getPropertyAsBoolOr | ( | const bsl::string & | name, |
| bool | value | ||
| ) | const |
| char BloombergLP::bmqa::MessageProperties::getPropertyAsCharOr | ( | const bsl::string & | name, |
| char | value | ||
| ) | const |
| short BloombergLP::bmqa::MessageProperties::getPropertyAsShortOr | ( | const bsl::string & | name, |
| short | value | ||
| ) | const |
| bsl::int32_t BloombergLP::bmqa::MessageProperties::getPropertyAsInt32Or | ( | const bsl::string & | name, |
| bsl::int32_t | value | ||
| ) | const |
| bsls::Types::Int64 BloombergLP::bmqa::MessageProperties::getPropertyAsInt64Or | ( | const bsl::string & | name, |
| bsls::Types::Int64 | value | ||
| ) | const |
| const bsl::string & BloombergLP::bmqa::MessageProperties::getPropertyAsStringOr | ( | const bsl::string & | name, |
| const bsl::string & | value | ||
| ) | const |
| const bsl::vector< char > & BloombergLP::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 & BloombergLP::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 & BloombergLP::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.
Referenced by BloombergLP::bmqa::operator<<().
|
friend |
|
static |
|
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.
|
static |
|
static |
~64 MB Maximum length of a property value. Note that this value is just under 64 MB. Also note that this value is calculated assuming that there is only one property and property's name has maximum allowable length, and also takes into consideration the protocol overhead.