Quick Links: |
#include <bmqt_messageguid.h>
Public Types | |
enum | Enum { e_SIZE_BINARY = 16, e_SIZE_HEX = 2 * e_SIZE_BINARY } |
Enum representing the size of a buffer needed to represent a GUID. More... | |
Public Member Functions | |
MessageGUID () | |
~MessageGUID () | |
MessageGUID & | fromBinary (const unsigned char *buffer) |
MessageGUID & | fromHex (const char *buffer) |
bool | isUnset () const |
void | toBinary (unsigned char *destination) const |
void | toHex (char *destination) const |
bsl::ostream & | print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const |
Static Public Member Functions | |
static bool | isValidHexRepresentation (const char *buffer) |
Friends | |
struct | MessageGUIDLess |
bool | operator== (const MessageGUID &lhs, const MessageGUID &rhs) |
bool | operator!= (const MessageGUID &lhs, const MessageGUID &rhs) |
template<class HASH_ALGORITHM > | |
void | hashAppend (HASH_ALGORITHM &hashAlgo, const MessageGUID &guid) |
This class provides a value-semantic type to represent a global unique ID for BlazingMQ messages.
See Component bmqt_messageguid
bmqt::MessageGUID::MessageGUID | ( | ) |
Create an un-initialized MessageGUID. Note that isUnset()
would return true.
bmqt::MessageGUID::~MessageGUID | ( | ) |
Destructor.
static bool bmqt::MessageGUID::isValidHexRepresentation | ( | const char * | buffer | ) | [static] |
Return true if the specified buffer
is a valid hex representation of a MessageGUID. The behavior is undefined unless buffer
is non-null and length of the buffer
is equal to e_SIZE_HEX
.
MessageGUID& bmqt::MessageGUID::fromBinary | ( | const unsigned char * | buffer | ) |
Initialize this MessageGUID with the binary representation from the specified buffer
, in binary format. Behavior is undefined unless buffer
is non-null and of length e_SIZE_BINARY
. Return a reference offering modifiable access to this object.
MessageGUID& bmqt::MessageGUID::fromHex | ( | const char * | buffer | ) |
Initialize this MessageGUID with the hexadecimal representation from the specified buffer
. Behavior is undefined unless isValidHexRepresentation()
returns true for the provided buffer
. Return a reference offering modifiable access to this object.
bool bmqt::MessageGUID::isUnset | ( | ) | const |
Return true
if the value of this object is not set.
void bmqt::MessageGUID::toBinary | ( | unsigned char * | destination | ) | const |
Write the binary representation of this object to the specified destination
. Behavior is undefined unless destination
is of length e_SIZE_BINARY
. Note that destination
can later be used to populate a MessageGUID object using fromBinary
method.
void bmqt::MessageGUID::toHex | ( | char * | destination | ) | const |
Write the hex representation of this object to the specified destination
. Behavior is undefined unless destination
is of length e_SIZE_HEX
. Note that destination
can later be used to populate a MessageGUID object using fromHex
method.
bsl::ostream& bmqt::MessageGUID::print | ( | bsl::ostream & | stream, | |
int | level = 0 , |
|||
int | spacesPerLevel = 4 | |||
) | const |
Write the value of this object to the specified output stream
in a human-readable format, and return a reference to stream
. Optionally specify an initial indentation level
. If level
is specified, optionally specify spacesPerLevel
, whose absolute value indicates the number of spaces per indentation level for this object. 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. Note that this human-readable format is not fully specified, and can change without notice. Applications relying on a fixed length format must use toHex
method.
friend struct MessageGUIDLess [friend] |
bool operator== | ( | const MessageGUID & | lhs, | |
const MessageGUID & | rhs | |||
) | [friend] |
Return true
if rhs
object contains the value of the same type as contained in lhs
object and the value itself is the same in both objects, return false otherwise.
bool operator!= | ( | const MessageGUID & | lhs, | |
const MessageGUID & | rhs | |||
) | [friend] |
Return false
if rhs
object contains the value of the same type as contained in lhs
object and the value itself is the same in both objects, return true
otherwise.
void hashAppend | ( | HASH_ALGORITHM & | hashAlgo, | |
const MessageGUID & | guid | |||
) | [friend] |