BLPAPI C++
3.23.2
|
#include <blpapi_message.h>
Classes | |
struct | RecapType |
Public Types | |
enum | Fragment { FRAGMENT_NONE = 0, FRAGMENT_START = 1, FRAGMENT_INTERMEDIATE = 2, FRAGMENT_END = 3 } |
Public Member Functions | |
Message (const Message &original) | |
~Message () | |
Message & | operator= (const Message &rhs) |
Name | messageType () const |
const char * | topicName () const |
Service | service () const |
int | numCorrelationIds () const |
CorrelationId | correlationId (size_t index=0) const |
RecapType::Type | recapType () 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 |
Bytes | getElementAsBytes (const Name &name) const |
const char * | getRequestId () 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 |
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.
enum Fragment |
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 |
~Message | ( | ) |
Destroy this message.
const Element asElement | ( | ) | const |
CorrelationId correlationId | ( | size_t | index = 0 | ) | const |
Returns the specified index
th CorrelationId associated with this message. If index
>=numCorrelationIds() then an exception is thrown.
Message::Fragment 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.
Equivalent to asElement().getElement(name).
const Element getElement | ( | const char * | name | ) | const |
Equivalent to asElement().getElement(name).
bool getElementAsBool | ( | const Name & | name | ) | const |
Equivalent to asElement().getElementAsBool(name).
bool getElementAsBool | ( | const char * | name | ) | const |
Equivalent to asElement().getElementAsBool(name).
Equivalent to asElement().getElementAsBytes(name).
char getElementAsChar | ( | const Name & | name | ) | const |
Equivalent to asElement().getElementAsChar(name).
char getElementAsChar | ( | const char * | name | ) | const |
Equivalent to asElement().getElementAsChar(name).
Equivalent to asElement().getElementAsDatetime(name).
Datetime getElementAsDatetime | ( | const char * | name | ) | const |
Equivalent to asElement().getElementAsDatetime(name).
Equivalent to asElement().getElementAsFloat32(name).
Float32 getElementAsFloat32 | ( | const char * | name | ) | const |
Equivalent to asElement().getElementAsFloat32(name).
Equivalent to asElement().getElementAsFloat64(name).
Float64 getElementAsFloat64 | ( | const char * | name | ) | const |
Equivalent to asElement().getElementAsFloat64(name).
Equivalent to asElement().getElementAsInt32(name).
Int32 getElementAsInt32 | ( | const char * | name | ) | const |
Equivalent to asElement().getElementAsInt32(name).
Equivalent to asElement().getElementAsInt64(name).
Int64 getElementAsInt64 | ( | const char * | name | ) | const |
Equivalent to asElement().getElementAsInt64(name).
const char * getElementAsString | ( | const Name & | name | ) | const |
Equivalent to asElement().getElementAsString(name).
const char * getElementAsString | ( | const char * | name | ) | const |
Equivalent to asElement().getElementAsString(name).
const char * getPrivateData | ( | size_t * | size | ) | const |
DEPRECATED
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.
const char * getRequestId | ( | ) | const |
Return a pointer offering unmodifiable access to the message's request id if one exists, otherwise return null.
When present, the request id can be reported to Bloomberg to troubleshoot the cause of failure messages, or issues with the data contained in the message.
Note that request id is not the same as correlation id and should not be used for correlation purposes.
bool hasElement | ( | const Name & | name, |
bool | excludeNullElements = false |
||
) | const |
Equivalent to asElement().hasElement(name).
bool hasElement | ( | const char * | name, |
bool | excludeNullElements = false |
||
) | const |
Equivalent to asElement().hasElement(name).
Name messageType | ( | ) | const |
Returns the type of this message.
int 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.
size_t numElements | ( | ) | const |
Equivalent to asElement().numElements().
Copies the message specified by rhs
into the current message.
std::ostream & 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
).
Message::RecapType::Type recapType | ( | ) | const |
Return the recap type of this message. The return value is a value of enum RecapType::Type
to indicate whether this message is a solicited recap, an unsolicited recap, or neither.
int 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
.
const char * 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.
This function has been deprecated because messages could contain multiple payloads with different correlation ids, and each of these correlation ids may map to different topic strings.
In such scenario, it will be incorrect to return one out of the topics(for the various correlation ids in the message) as the topic name for the message.Trying to make this correct will result in some extra look up costs.
For correctness, users are encouraged to maintain a data structure in their application to help retrieve the topic name associated with the cid's present in the delivered message.