#include <blpapi_event.h>
Public Member Functions | |
MessageIterator (const Event &event) | |
~MessageIterator () | |
bool | next () |
bool | isValid () const |
Message | message (bool createClonable=false) const |
An iterator over the Message objects within an Event.
MessageIterator objects are used to process the individual Message objects in an Event received in an EventHandler, from EventQueue::nextEvent() or from Session::nextEvent().
This class is used to iterate over each message in an Event. The user must ensure that the Event this iterator is created for is not destroyed before the iterator.
blpapi::MessageIterator::MessageIterator | ( | const Event & | event | ) |
Construct a forward iterator to iterate over the message in the specified event
object. The MessageIterator is created in a state where next() must be called to advance it to the first item.
blpapi::MessageIterator::~MessageIterator | ( | ) |
Destructor.
bool blpapi::MessageIterator::next | ( | ) |
Attempts to advance this MessageIterator to the next Message in this Event. Returns 0 on success and non-zero if there are no more messages. After next() returns 0 isValid() returns true, even if called repeatedly until the next call to next(). After next() returns non-zero then isValid() always returns false.
bool blpapi::MessageIterator::isValid | ( | ) | const |
Returns true if this iterator is currently positioned on a valid Message. Returns false otherwise.
Message blpapi::MessageIterator::message | ( | bool | createClonable = false |
) | const |
Returns the Message at the current position of this iterator. If the specified createClonable
flag is set, the internal handle of the message returned is added a reference and the message can outlive the call to next(). If the createClonable
flag is set to false, the use of message outside the scope of the iterator or after the next() call is undefined. The behavior is undefined if isValid() returns false.