libbmq  a5f8a06ba1d16cb5a65643e1fa7f1a1d6aadef40
BloombergLP::bmqt::MessageGUID Class Reference

#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 ()
 Destructor. More...
 
MessageGUIDfromBinary (const unsigned char *buffer)
 
MessageGUIDfromHex (const char *buffer)
 
bool isUnset () const
 Return true if the value of this object is not set. More...
 
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)
 

Detailed Description

This class provides a value-semantic type to represent a global unique ID for BlazingMQ messages.

Member Enumeration Documentation

◆ Enum

Enumerator
e_SIZE_BINARY 

Binary format of the GUID.

e_SIZE_HEX 

Hexadecimal string representation of the GUID.

Constructor & Destructor Documentation

◆ MessageGUID()

BloombergLP::bmqt::MessageGUID::MessageGUID ( )
inline

Create an un-initialized MessageGUID. Note that isUnset() would return true.

References e_SIZE_BINARY.

◆ ~MessageGUID()

BloombergLP::bmqt::MessageGUID::~MessageGUID ( )
inline

References e_SIZE_BINARY.

Member Function Documentation

◆ isValidHexRepresentation()

static bool BloombergLP::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.

◆ fromBinary()

MessageGUID& BloombergLP::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.

◆ fromHex()

MessageGUID& BloombergLP::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.

◆ isUnset()

bool BloombergLP::bmqt::MessageGUID::isUnset ( ) const
inline

References e_SIZE_BINARY.

◆ toBinary()

void BloombergLP::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.

◆ toHex()

void BloombergLP::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.

◆ print()

bsl::ostream& BloombergLP::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.

Referenced by BloombergLP::bmqt::operator<<().

Friends And Related Function Documentation

◆ MessageGUIDLess

friend struct MessageGUIDLess
friend

◆ operator==

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.

◆ operator!=

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.

◆ hashAppend

template<class HASH_ALGORITHM >
void hashAppend ( HASH_ALGORITHM &  hashAlgo,
const MessageGUID guid 
)
friend

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