libbmq  a5f8a06ba1d16cb5a65643e1fa7f1a1d6aadef40
BloombergLP::bmqa::MessageProperties Class Reference

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. More...
 
MessagePropertiesoperator= (const MessageProperties &rhs)
 Assign to this object the value of the specified rhs object. More...
 
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. More...
 
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. More...
 
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. More...
 
static const int k_MAX_PROPERTY_VALUE_LENGTH = 67104745
 

Friends

class MessagePropertiesIterator
 

Constructor & Destructor Documentation

◆ MessageProperties() [1/2]

BloombergLP::bmqa::MessageProperties::MessageProperties ( bslma::Allocator *  basicAllocator = 0)
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.

◆ MessageProperties() [2/2]

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.

◆ ~MessageProperties()

BloombergLP::bmqa::MessageProperties::~MessageProperties ( )

Member Function Documentation

◆ operator=()

MessageProperties& BloombergLP::bmqa::MessageProperties::operator= ( const MessageProperties rhs)

◆ remove()

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.

◆ clear()

void BloombergLP::bmqa::MessageProperties::clear ( )

Remove all properties from this instance. Note that numProperties will return zero after invoking this method.

◆ setPropertyAsBool()

int BloombergLP::bmqa::MessageProperties::setPropertyAsBool ( const bsl::string &  name,
bool  value 
)

◆ setPropertyAsChar()

int BloombergLP::bmqa::MessageProperties::setPropertyAsChar ( const bsl::string &  name,
char  value 
)

◆ setPropertyAsShort()

int BloombergLP::bmqa::MessageProperties::setPropertyAsShort ( const bsl::string &  name,
short  value 
)

◆ setPropertyAsInt32()

int BloombergLP::bmqa::MessageProperties::setPropertyAsInt32 ( const bsl::string &  name,
bsl::int32_t  value 
)

◆ setPropertyAsInt64()

int BloombergLP::bmqa::MessageProperties::setPropertyAsInt64 ( const bsl::string &  name,
bsls::Types::Int64  value 
)

◆ setPropertyAsString()

int BloombergLP::bmqa::MessageProperties::setPropertyAsString ( const bsl::string &  name,
const bsl::string &  value 
)

◆ setPropertyAsBinary()

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.

◆ streamIn()

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.

◆ numProperties()

int BloombergLP::bmqa::MessageProperties::numProperties ( ) const

◆ totalSize()

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.

◆ hasProperty()

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.

◆ propertyType()

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.

◆ getPropertyAsBool()

bool BloombergLP::bmqa::MessageProperties::getPropertyAsBool ( const bsl::string &  name) const

◆ getPropertyAsChar()

char BloombergLP::bmqa::MessageProperties::getPropertyAsChar ( const bsl::string &  name) const

◆ getPropertyAsShort()

short BloombergLP::bmqa::MessageProperties::getPropertyAsShort ( const bsl::string &  name) const

◆ getPropertyAsInt32()

bsl::int32_t BloombergLP::bmqa::MessageProperties::getPropertyAsInt32 ( const bsl::string &  name) const

◆ getPropertyAsInt64()

bsls::Types::Int64 BloombergLP::bmqa::MessageProperties::getPropertyAsInt64 ( const bsl::string &  name) const

◆ getPropertyAsString()

const bsl::string& BloombergLP::bmqa::MessageProperties::getPropertyAsString ( const bsl::string &  name) const

◆ getPropertyAsBinary()

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.

◆ getPropertyAsBoolOr()

bool BloombergLP::bmqa::MessageProperties::getPropertyAsBoolOr ( const bsl::string &  name,
bool  value 
) const

◆ getPropertyAsCharOr()

char BloombergLP::bmqa::MessageProperties::getPropertyAsCharOr ( const bsl::string &  name,
char  value 
) const

◆ getPropertyAsShortOr()

short BloombergLP::bmqa::MessageProperties::getPropertyAsShortOr ( const bsl::string &  name,
short  value 
) const

◆ getPropertyAsInt32Or()

bsl::int32_t BloombergLP::bmqa::MessageProperties::getPropertyAsInt32Or ( const bsl::string &  name,
bsl::int32_t  value 
) const

◆ getPropertyAsInt64Or()

bsls::Types::Int64 BloombergLP::bmqa::MessageProperties::getPropertyAsInt64Or ( const bsl::string &  name,
bsls::Types::Int64  value 
) const

◆ getPropertyAsStringOr()

const bsl::string& BloombergLP::bmqa::MessageProperties::getPropertyAsStringOr ( const bsl::string &  name,
const bsl::string &  value 
) const

◆ getPropertyAsBinaryOr()

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.

◆ streamOut()

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.

◆ print()

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<<().

Friends And Related Function Documentation

◆ MessagePropertiesIterator

friend class MessagePropertiesIterator
friend

Member Data Documentation

◆ k_MAX_NUM_PROPERTIES

const int BloombergLP::bmqa::MessageProperties::k_MAX_NUM_PROPERTIES = 255
static

◆ k_MAX_PROPERTIES_AREA_LENGTH

const int BloombergLP::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.

◆ k_MAX_PROPERTY_NAME_LENGTH

const int BloombergLP::bmqa::MessageProperties::k_MAX_PROPERTY_NAME_LENGTH = 4095
static

◆ k_MAX_PROPERTY_VALUE_LENGTH

const int BloombergLP::bmqa::MessageProperties::k_MAX_PROPERTY_VALUE_LENGTH = 67104745
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.


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