Public Types | Public Member Functions

blpapi::CorrelationId Class Reference

#include <blpapi_correlationid.h>

List of all members.

Public Types

enum  ValueType { UNSET_VALUE = BLPAPI_CORRELATION_TYPE_UNSET, INT_VALUE = BLPAPI_CORRELATION_TYPE_INT, POINTER_VALUE = BLPAPI_CORRELATION_TYPE_POINTER, AUTOGEN_VALUE = BLPAPI_CORRELATION_TYPE_AUTOGEN }
enum  { MAX_CLASS_ID = BLPAPI_CORRELATION_MAX_CLASS_ID }

Public Member Functions

 CorrelationId ()
 CorrelationId (const blpapi_CorrelationId_t &correlation)
 CorrelationId (const CorrelationId &original)
 CorrelationId (long long value, int classId=0)
 CorrelationId (void *value, int classId=0)
template<typename TYPE >
 CorrelationId (const TYPE &smartPtr, void *pointerValue, int classId=0)
 ~CorrelationId ()
blpapi_CorrelationId_timpl ()
void swap (CorrelationId &other)
CorrelationIdoperator= (const CorrelationId &rhs)
ValueType valueType () const
unsigned short classId () const
void * asPointer () const
template<typename TYPE >
TYPE asSmartPointer () const
long long asInteger () const
const blpapi_CorrelationId_timpl () const

Detailed Description

A key used to identify individual subscriptions or requests.

CorrelationId objects are passed to many of the Session object methods which initiate an asynchronous operations and are obtained from Message objects which are delivered as a result of those asynchronous operations.

When subscribing or requesting information an application has the choice of providing a CorrelationId they construct themselves or allowing the session to construct one for them. If the application supplies a CorrelationId it must not re-use the value contained in it in another CorrelationId whilst the original request or subscription is still active.

It is possible that an application supplied CorrelationId and a CorrelationId constructed by the API could return the same result for asInteger(). However, they will not compare equal using the defined operator== for CorrelationId and there is a consistent order defined using the defined operator< for CorrelationId.

A CorrelationId constructed by an application can contain either

For 64 bit integers and simple pointers the values are copied when CorrelationIds are copied and compared when CorrelationIds are compared.

For "smart" pointers the API can accommodate smart pointer classes that meet the following restrictions.

The API will embed a smart pointer in the CorrelationId without allocating memory separately for it. The specified smartPtr will have its copy constructor invoked when the CorrelationId is copied and its destructor invoked when the CorrelationId is destroyed so its resource management will continue to work as normal.

CorrelationId's based on a simple pointer and CorrelationId's based on a smart pointer have the same ValueType (POINTER_VALUE) which allows them to be compared to each other.

A CorrelationId based on a simple pointer and a CorrelationId based on a smart pointer will compare equally with operator== as long as the pointer is the same.

Likewise, when comparing two CorrelationId's based on a smart pointer only the pointer value itself is used for the comparison, the contents of the smart pointer object are ignored.


Member Enumeration Documentation

Enumerator:
UNSET_VALUE 

The CorrelationId is unset. That is, it was created by the default CorrelationId constructor.

INT_VALUE 

The CorrelationId was created from an integer supplied by the user.

POINTER_VALUE 

The CorrelationId was created from a pointer supplied by the user.

AUTOGEN_VALUE 

The CorrelationId was created internally by API.

anonymous enum
Enumerator:
MAX_CLASS_ID 

The maximum value allowed for classId


Constructor & Destructor Documentation

blpapi::CorrelationId::CorrelationId (  ) 

The default constructor creates an uninitialized CorrelationId. This will compare equal to another CorrelationId object constructed using the default constructor. The only valid operations on an uninitialized CorrelationId are assignment, comparison for equality and destruction.

blpapi::CorrelationId::CorrelationId ( const blpapi_CorrelationId_t correlation  ) 
blpapi::CorrelationId::CorrelationId ( const CorrelationId original  ) 

Copy constructor. If the specified original contains a smart pointer it will be copy constructed into this CorrelationId.

blpapi::CorrelationId::CorrelationId ( long long  value,
int  classId = 0 
) [explicit]

Construct a CorrelationId object and initialize it with the specified integer value.

blpapi::CorrelationId::CorrelationId ( void *  value,
int  classId = 0 
) [explicit]

Construct a CorrelationId object and initialize it with the specified pointer value.

template<typename TYPE >
blpapi::CorrelationId::CorrelationId ( const TYPE &  smartPtr,
void *  pointerValue,
int  classId = 0 
)

Construct a CorrelationId object and initialize it with the specified smartPtr (whose copy constructor will be called in the process) and with the specified pointerValue which should be the result of operator-> on the specified smartPtr.

blpapi::CorrelationId::~CorrelationId (  ) 

Destroy this CorrelationId. If this CorrelationId contains a smart pointer its destructor will be called.


Member Function Documentation

blpapi_CorrelationId_t& blpapi::CorrelationId::impl (  ) 
void blpapi::CorrelationId::swap ( CorrelationId other  ) 

Swap the value of this CorrelationId object and the specified other CorrelationId object.

CorrelationId& blpapi::CorrelationId::operator= ( const CorrelationId rhs  ) 

Assign to this CorrelationId object the value of the specified rhs CorrelationId object. Return a modifiable reference to this object.

ValueType blpapi::CorrelationId::valueType (  )  const

Return the type of this CorrelationId object.

unsigned short blpapi::CorrelationId::classId (  )  const

Return the user defined classification of this correlation correlation id object.

void* blpapi::CorrelationId::asPointer (  )  const

Return the value of this CorrelationId as a pointer value. The result is undefined if this CorrelationId does not have valueType()==POINTER_VALUE.

template<typename TYPE >
TYPE blpapi::CorrelationId::asSmartPointer (  )  const

Return the CorrelationId as a smart pointer.

long long blpapi::CorrelationId::asInteger (  )  const

Return the value of this CorrelationId as an integer value. The result is undefined if this CorrelationId does not have valueType()==INT_VALUE or valueType()==AUTOGEN_VALUE.

const blpapi_CorrelationId_t& blpapi::CorrelationId::impl (  )  const

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