Public Types | Public Member Functions

blpapi::Message Class Reference

#include <blpapi_message.h>

List of all members.

Public Types

enum  Fragment { FRAGMENT_NONE = 0, FRAGMENT_START, FRAGMENT_INTERMEDIATE, FRAGMENT_END }

Public Member Functions

 Message (blpapi_Message_t *handle, bool clonable=false)
 Message (const Message &original)
 ~Message ()
Messageoperator= (const Message &rhs)
Name messageType () const
const char * topicName () const
Service service () const
int numCorrelationIds () const
CorrelationId correlationId (size_t index=0) const
bool hasElement (const Name &name, bool excludeNullElements=false) const
bool hasElement (const char *name, bool excludeNullElements=false) const
size_t numElements () const
const Element getElement (const Name &name) const
const Element getElement (const char *name) const
bool getElementAsBool (const Name &name) const
bool getElementAsBool (const char *name) const
char getElementAsChar (const Name &name) const
char getElementAsChar (const char *name) const
Int32 getElementAsInt32 (const Name &name) const
Int32 getElementAsInt32 (const char *name) const
Int64 getElementAsInt64 (const Name &name) const
Int64 getElementAsInt64 (const char *name) const
Float32 getElementAsFloat32 (const Name &name) const
Float32 getElementAsFloat32 (const char *name) const
Float64 getElementAsFloat64 (const Name &name) const
Float64 getElementAsFloat64 (const char *name) const
Datetime getElementAsDatetime (const Name &name) const
Datetime getElementAsDatetime (const char *name) const
const char * getElementAsString (const Name &name) const
const char * getElementAsString (const char *name) const
const Element asElement () const
const char * getPrivateData (size_t *size) const
Fragment fragmentType () const
int timeReceived (TimePoint *timestamp) const
std::ostream & print (std::ostream &stream, int level=0, int spacesPerLevel=4) const
const blpapi_Message_timpl () const
blpapi_Message_timpl ()

Detailed Description

A handle to a single message.

Message objects are obtained from a MessageIterator. Each Message is associated with a Service and with one or more CorrelationId values. The Message contents are represented as an Element and some convenient shortcuts are supplied to the Element accessors.

A Message is a handle to a single underlying protocol message. The underlying messages are reference counted - the underlying Message object is freed when the last Message object which references it is destroyed.


Member Enumeration Documentation

A message could be split into more than one fragments to reduce each message size. This enum is used to indicate whether a message is a fragmented message and the position in the fragmented messages.

Enumerator:
FRAGMENT_NONE 

message is not fragmented

FRAGMENT_START 

the first fragmented message

FRAGMENT_INTERMEDIATE 

intermediate fragmented messages

FRAGMENT_END 

the last fragmented message


Constructor & Destructor Documentation

blpapi::Message::Message ( blpapi_Message_t handle,
bool  clonable = false 
)

Construct the Message with the specified handle and set the isCloned flag with the specified value of clonable. This flag will used to release reference on message handle when the destructor is called.

blpapi::Message::Message ( const Message original  ) 

Construct the message using the handle of the original. This will add a reference to the handle and set the d_isCloned flag to true, to ensure that release reference is called when destructor is invoked.

blpapi::Message::~Message (  ) 

Destroy this message. Call release reference on handle if the d_isCloned is set.


Member Function Documentation

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

Copies the message specified by rhs into the current message and set the d_isCloned flag with the specified value of true. This flag will used to release reference on message handle when the destructor is called.

Name blpapi::Message::messageType (  )  const

Returns the type of this message.

const char* blpapi::Message::topicName (  )  const

Returns a pointer to a null-terminated string containing the topic string associated with this message. If there is no topic associated with this message then an empty string is returned. The pointer returned remains valid until the Message is destroyed.

Service blpapi::Message::service (  )  const

Returns the service which sent this Message.

int blpapi::Message::numCorrelationIds (  )  const

Returns the number of CorrelationIds associated with this message.

Note: A Message will have exactly one CorrelationId unless allowMultipleCorrelatorsPerMsg option was enabled for the Session this Message came from. When allowMultipleCorrelatorsPerMsg is disabled (the default) and more than one active subscription would result in the same Message the Message is delivered multiple times (without making physical copied). Each Message is accompanied by a single CorrelationId. When allowMultipleCorrelatorsPerMsg is enabled and more than one active subscription would result in the same Message the Message is delivered once with a list of corresponding CorrelationId values.

CorrelationId blpapi::Message::correlationId ( size_t  index = 0  )  const

Returns the specified indexth CorrelationId associated with this message. If index>=numCorrelationIds() then an exception is thrown.

bool blpapi::Message::hasElement ( const Name name,
bool  excludeNullElements = false 
) const
bool blpapi::Message::hasElement ( const char *  name,
bool  excludeNullElements = false 
) const

Equivalent to asElement().hasElement(name).

size_t blpapi::Message::numElements (  )  const

Equivalent to asElement().numElements().

const Element blpapi::Message::getElement ( const Name name  )  const

Equivalent to asElement().getElement(name).

const Element blpapi::Message::getElement ( const char *  name  )  const

Equivalent to asElement().getElement(name).

bool blpapi::Message::getElementAsBool ( const Name name  )  const
bool blpapi::Message::getElementAsBool ( const char *  name  )  const

Equivalent to asElement().getElementAsBool(name).

char blpapi::Message::getElementAsChar ( const Name name  )  const
char blpapi::Message::getElementAsChar ( const char *  name  )  const

Equivalent to asElement().getElementAsChar(name).

Int32 blpapi::Message::getElementAsInt32 ( const Name name  )  const
Int32 blpapi::Message::getElementAsInt32 ( const char *  name  )  const

Equivalent to asElement().getElementAsInt32(name).

Int64 blpapi::Message::getElementAsInt64 ( const Name name  )  const
Int64 blpapi::Message::getElementAsInt64 ( const char *  name  )  const

Equivalent to asElement().getElementAsInt64(name).

Float32 blpapi::Message::getElementAsFloat32 ( const Name name  )  const
Float32 blpapi::Message::getElementAsFloat32 ( const char *  name  )  const

Equivalent to asElement().getElementAsFloat32(name).

Float64 blpapi::Message::getElementAsFloat64 ( const Name name  )  const
Float64 blpapi::Message::getElementAsFloat64 ( const char *  name  )  const

Equivalent to asElement().getElementAsFloat64(name).

Datetime blpapi::Message::getElementAsDatetime ( const Name name  )  const
Datetime blpapi::Message::getElementAsDatetime ( const char *  name  )  const

Equivalent to asElement().getElementAsDatetime(name).

const char* blpapi::Message::getElementAsString ( const Name name  )  const
const char* blpapi::Message::getElementAsString ( const char *  name  )  const

Equivalent to asElement().getElementAsString(name).

const Element blpapi::Message::asElement (  )  const

Returns the contents of this Message as a read-only Element. The Element returned remains valid until this Message is destroyed.

const char* blpapi::Message::getPrivateData ( size_t *  size  )  const

Return a raw pointer to the message private data if it had any. If size is a valid pointer (not 0), it will be filled with the size of the private data. If the message has no private data attached to it the return value is 0 and the size pointer (if valid) is set to 0.

Fragment blpapi::Message::fragmentType (  )  const

Return fragment type of this message. The return value is a value of enum Fragment to indicate whether it is a fragmented message of a big message and its positions in fragmentation if it is.

int blpapi::Message::timeReceived ( TimePoint timestamp  )  const

Load into the specified timestamp, the time when the message was received by the sdk. This method will fail if there is no timestamp associated with Message. On failure, the timestamp is not modified. Return 0 on success and a non-zero value otherwise. Note that by default the subscription data messages are not timestamped (but all the other messages are). To enable recording receive time for subscription data, set SessionOptions::recordSubscriptionDataReceiveTimes.

std::ostream& blpapi::Message::print ( std::ostream &  stream,
int  level = 0,
int  spacesPerLevel = 4 
) const

Format this Message 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).

const blpapi_Message_t* blpapi::Message::impl (  )  const

Returns the internal implementation.

blpapi_Message_t* blpapi::Message::impl (  ) 

Returns the internal implementation.


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