17 #ifndef INCLUDED_BMQT_CORRELATIONID
18 #define INCLUDED_BMQT_CORRELATIONID
175 #include <bdlb_variant.h>
177 #include <bsl_cstdint.h>
178 #include <bsl_iosfwd.h>
179 #include <bsl_memory.h>
180 #include <bslh_hash.h>
181 #include <bsls_assert.h>
182 #include <bsls_types.h>
202 template <
class HASH_ALGORITHM>
203 friend void hashAppend(HASH_ALGORITHM& hashAlgo,
211 typedef bsls::Types::Uint64 AutoValue;
218 bdlb::Variant4<bsls::Types::Int64, void*, bsl::shared_ptr<void>, AutoValue>
227 AutoValue theAutoValue()
const;
264 explicit CorrelationId(
const bsl::shared_ptr<void>& sharedPtr);
333 print(bsl::ostream& stream,
int level = 0,
int spacesPerLevel = 4)
const;
380 inline CorrelationId::AutoValue CorrelationId::theAutoValue()
const
385 return d_variant.the<AutoValue>();
408 : d_variant(sharedPtr)
422 d_variant.assign(numeric);
428 d_variant.assign(pointer);
435 d_variant.assign(sharedPtr);
442 return d_variant.isUnset();
447 return d_variant.is<bsls::Types::Int64>();
452 return d_variant.is<
void*>();
457 return d_variant.is<bsl::shared_ptr<void> >();
462 return d_variant.is<AutoValue>();
470 return d_variant.the<bsls::Types::Int64>();
478 return d_variant.the<
void*>();
486 return d_variant.the<bsl::shared_ptr<void> >();
497 BSLS_ASSERT_OPT(-1 != result &&
"Unknown correlation type");
499 return static_cast<Type>(result);
503 template <
class HASH_ALGORITHM>
528 BSLS_ASSERT_OPT(
false &&
"Unknown correlationId type");
545 if (lhs.d_variant.typeIndex() != rhs.d_variant.typeIndex()) {
546 result = lhs.d_variant.typeIndex() < rhs.d_variant.typeIndex();
552 result =
reinterpret_cast<bsl::uintptr_t
>(lhs.
thePointer()) <
553 reinterpret_cast<bsl::uintptr_t
>(rhs.
thePointer());
559 result = lhs.theAutoValue() < rhs.theAutoValue();
562 BSLS_ASSERT_OPT(
false &&
"Unknown correlator type");
579 return lhs.d_variant == rhs.d_variant;
585 return lhs.d_variant != rhs.d_variant;
592 return less(lhs, rhs);
598 return rhs.
print(stream, 0, -1);
Definition: bmqt_correlationid.h:193
friend bool operator==(const CorrelationId &lhs, const CorrelationId &rhs)
CorrelationId & setSharedPointer(const bsl::shared_ptr< void > &sharedPtr)
Definition: bmqt_correlationid.h:433
const bsl::shared_ptr< void > & theSharedPtr() const
Definition: bmqt_correlationid.h:481
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
bool isNumeric() const
Definition: bmqt_correlationid.h:445
bool isSharedPtr() const
Definition: bmqt_correlationid.h:455
bool isUnset() const
Return true if the value of this object is unset;.
Definition: bmqt_correlationid.h:440
Type type() const
Return the type of the value of this object.
Definition: bmqt_correlationid.h:489
void * thePointer() const
Definition: bmqt_correlationid.h:473
bool isPointer() const
Definition: bmqt_correlationid.h:450
CorrelationId & setPointer(void *pointer)
Definition: bmqt_correlationid.h:426
Type
Definition: bmqt_correlationid.h:231
@ e_SHARED_PTR
Definition: bmqt_correlationid.h:236
@ e_AUTO_VALUE
Definition: bmqt_correlationid.h:238
@ e_NUMERIC
Definition: bmqt_correlationid.h:232
@ e_UNSET
Definition: bmqt_correlationid.h:240
@ e_POINTER
Definition: bmqt_correlationid.h:234
static CorrelationId autoValue()
bsls::Types::Int64 theNumeric() const
Definition: bmqt_correlationid.h:465
friend void hashAppend(HASH_ALGORITHM &hashAlgo, const CorrelationId &value)
Definition: bmqt_correlationid.h:504
bool isAutoValue() const
Definition: bmqt_correlationid.h:460
CorrelationId & setNumeric(bsls::Types::Int64 numeric)
Definition: bmqt_correlationid.h:420
friend bool operator!=(const CorrelationId &lhs, const CorrelationId &rhs)
CorrelationId & makeUnset()
Unset the value of this object.
Definition: bmqt_correlationid.h:414
friend bsl::ostream & operator<<(bsl::ostream &stream, const CorrelationId &rhs)
CorrelationId()
Create a CorrelationId having the default, unset, value.
Definition: bmqt_correlationid.h:389
void hashAppend(HASH_ALGORITHM &hashAlgo, const CorrelationId &value)
Definition: bmqt_correlationid.h:504
bsl::ostream & operator<<(bsl::ostream &stream, CompressionAlgorithmType::Enum value)
Definition: bmqt_compressionalgorithmtype.h:141
bool operator!=(const CorrelationId &lhs, const CorrelationId &rhs)
Definition: bmqt_correlationid.h:582
bool operator==(const CorrelationId &lhs, const CorrelationId &rhs)
Definition: bmqt_correlationid.h:576
bool operator<(const CorrelationId &lhs, const CorrelationId &rhs)
Definition: bmqt_correlationid.h:588
Definition: bmqa_abstractsession.h:42
Definition: bmqt_correlationid.h:364
bool operator()(const CorrelationId &lhs, const CorrelationId &rhs) const
Definition: bmqt_correlationid.h:538