BLPAPI C++ 3.26.5
Loading...
Searching...
No Matches
Component blpapi_event

Namespaces

namespace  BloombergLP
namespace  BloombergLP::blpapi

Classes

class  Event
class  EventQueue
class  MessageIterator

Functions

bool operator== (const Event::iterator &lhs, const Event::iterator &rhs)
bool operator!= (const Event::iterator &lhs, const Event::iterator &rhs)
void swap (Event::iterator &lhs, Event::iterator &rhs)
 Swap the contents of the lhs and rhs iterators.

Detailed Description

Purpose:
A component which defines events related operations
Classes:
blpapi::Eventan event resulting from a subscription or request.
blpapi::EventQueueA construct to handle replies synchronously.
blpapi::MessageIteratorAn iterator over the Messages within an Event.
Description:
This file defines an Event. One or more Events are generated as a result of a subscription or a request. Events contain Message objects which can be accessed using range based for loop or a MessageIterator. This file also defines a EventQueue for handling replies synchronously.
Usage:
There are two ways to iterate the messages in an Event.
for (Message msg : event) {
...
}
OR
MessageIterator iter(event);
while (iter.next()) {
Message msg = iter.message();
...
}
The following code snippet shows a how a EventQueue is used with a generateToken request. For any established session session pass an EventQueue object tokenEventQueue when calling generateToken. All Events in responses to generateToken request will be returned in tokenEventQueue.
//...
EventQueue tokenEventQueue;
session->generateToken(CorrelationId(), &tokenEventQueue);
Synchronously read the response event and parse over messages
Event event = tokenEventQueue.nextEvent();
if (event.eventType() == Event::TOKEN_STATUS) {
for (Message msg : event) {
//...
}
}

Function Documentation

◆ operator!=()

bool operator!= ( const Event::iterator & lhs,
const Event::iterator & rhs )

Return true if the specified lhs and rhs are not equal.

◆ operator==()

bool operator== ( const Event::iterator & lhs,
const Event::iterator & rhs )

Return true if the specified lhs and rhs are the same iterator, or both are end iterators.

◆ swap()

void swap ( Event::iterator & lhs,
Event::iterator & rhs )

Swap the contents of the lhs and rhs iterators.