Public Member Functions

blpapi::EventFormatter Class Reference

#include <blpapi_eventformatter.h>

List of all members.

Public Member Functions

 EventFormatter (Event &event)
 ~EventFormatter ()
void appendMessage (const char *messageType, const Topic &topic)
void appendMessage (const Name &messageType, const Topic &topic)
void appendMessage (const char *messageType, const Topic &topic, unsigned int sequenceNumber)
void appendMessage (const Name &messageType, const Topic &topic, unsigned int sequenceNumber)
void appendResponse (const char *opType)
void appendResponse (const Name &opType)
void appendRecapMessage (const Topic &topic, const CorrelationId *cid=0)
void appendRecapMessage (const Topic &topic, unsigned int sequenceNumber, const CorrelationId *cid=0)
void setElement (const char *name, bool value)
void setElement (const char *name, char value)
void setElement (const char *name, Int32 value)
void setElement (const char *name, Int64 value)
void setElement (const char *name, Float32 value)
void setElement (const char *name, Float64 value)
void setElement (const char *name, const Datetime &value)
void setElement (const char *name, const char *value)
void setElement (const char *name, const Name &value)
void setElementNull (const char *name)
void setElement (const Name &name, bool value)
void setElement (const Name &name, char value)
void setElement (const Name &name, Int32 value)
void setElement (const Name &name, Int64 value)
void setElement (const Name &name, Float32 value)
void setElement (const Name &name, Float64 value)
void setElement (const Name &name, const Datetime &value)
void setElement (const Name &name, const char *value)
void setElement (const Name &name, const Name &value)
void setElementNull (const Name &name)
void pushElement (const char *name)
void pushElement (const Name &name)
void popElement ()
void appendValue (bool value)
void appendValue (char value)
void appendValue (Int32 value)
void appendValue (Int64 value)
void appendValue (Float32 value)
void appendValue (Float64 value)
void appendValue (const Datetime &value)
void appendValue (const char *value)
void appendValue (const Name &value)
void appendElement ()

Detailed Description

EventFormatter is used to populate Events for publishing.

An EventFormatter is created from an Event obtained from createPublishEvent() on Service. Once the Message or Messages have been appended to the Event using the EventFormatter the Event can be published using publish() on the ProviderSession.

EventFormatter objects cannot be copied or assigned so as to ensure there is no ambiguity about what happens if two EventFormatters are both formatting the same Event.

The EventFormatter supportes appending message of the same type multiple time in the same Event. However the EventFormatter supports write once only to each field. It is an error to call setElement() or pushElement() for the same name more than once at a particular level of the schema when creating a message.


Constructor & Destructor Documentation

blpapi::EventFormatter::EventFormatter ( Event event  ) 

Create an EventFormatter to create Messages in the specified Event. An Event may only be reference by one EventFormatter at any time. Attempting to create a second EventFormatter referencing the same Event will result in an exception being thrown.

blpapi::EventFormatter::~EventFormatter (  ) 

Destroy this EventFormatter object.


Member Function Documentation

void blpapi::EventFormatter::appendMessage ( const char *  messageType,
const Topic topic 
)

Append an (empty) message of the specified messageType that will be published under the specified topic to the Event referenced by this EventFormatter. After a message has been appended its elements can be set using the various setElement() methods.

void blpapi::EventFormatter::appendMessage ( const Name messageType,
const Topic topic 
)

Append an (empty) message of the specified messageType that will be published under the specified topic to the Event referenced by this EventFormatter. After a message has been appended its elements can be set using the various setElement() methods.

void blpapi::EventFormatter::appendMessage ( const char *  messageType,
const Topic topic,
unsigned int  sequenceNumber 
)

Append an (empty) message of the specified messageType that will be published under the specified topic with the specified sequenceNumber to the Event referenced by this EventFormatter. It is expected that sequenceNumber is greater (unless the value wrapped) than the last value used in any previous message on this topic, otherwise the behavior is undefined. After a message has been appended its elements can be set using the various setElement() methods.

void blpapi::EventFormatter::appendMessage ( const Name messageType,
const Topic topic,
unsigned int  sequenceNumber 
)

Append an (empty) message of the specified messageType that will be published under the specified topic with the specified sequenceNumber to the Event referenced by this EventFormatter. It is expected that sequenceNumber is greater (unless the value wrapped) than the last value used in any previous message on this topic, otherwise the behavior is undefined. After a message has been appended its elements can be set using the various setElement() methods.

void blpapi::EventFormatter::appendResponse ( const char *  opType  ) 

Append an (empty) response message of the specified opType that will be sent in response to previously received operation request. After a message has been appended its elements can be set using the various setElement() methods. Only one response can be appended.

void blpapi::EventFormatter::appendResponse ( const Name opType  ) 

Append an (empty) response message of the specified opType that will be sent in response to previously received operation request. After a message has been appended its elements can be set using the various setElement() methods. Only one response can be appended.

void blpapi::EventFormatter::appendRecapMessage ( const Topic topic,
const CorrelationId cid = 0 
)

Append a (empty) recap message that will be published under the specified topic to the Publish Event referenced by this EventFormatter. Specify the optional CorrelationId pointer cid if this recap message is added in response to a TOPIC_RECAP message. After a message has been appended its elements can be set using the various setElement() methods. It is an error to create append a recap message to an Admin event.

void blpapi::EventFormatter::appendRecapMessage ( const Topic topic,
unsigned int  sequenceNumber,
const CorrelationId cid = 0 
)

Append a (empty) recap message that will be published under the specified topic with the specified sequenceNumber to the Publish Event referenced by this EventFormatter. Specify the optional CorrelationId pointer cid if this recap message is added in response to a TOPIC_RECAP message. It is expected that sequenceNumber is greater (unless the value wrapped) than the last value used in any previous message on this topic, otherwise the behavior is undefined. After a message has been appended its elements can be set using the various setElement() methods. It is an error to create append a recap message to an Admin event.

void blpapi::EventFormatter::setElement ( const char *  name,
bool  value 
)

Set the element with the specified name to the specified value in the current message in the Event referenced by this EventFormatter. If the name is invalid for the current message, if appendMessage() has never been called or if the element identified by name has already been set an exception is thrown.

void blpapi::EventFormatter::setElement ( const char *  name,
char  value 
)

Set the element with the specified name to the specified value in the current message in the Event referenced by this EventFormatter. If the name is invalid for the current message, if appendMessage() has never been called or if the element identified by name has already been set an exception is thrown.

void blpapi::EventFormatter::setElement ( const char *  name,
Int32  value 
)

Set the element with the specified name to the specified value in the current message in the Event referenced by this EventFormatter. If the name is invalid for the current message, if appendMessage() has never been called or if the element identified by name has already been set an exception is thrown.

void blpapi::EventFormatter::setElement ( const char *  name,
Int64  value 
)

Set the element with the specified name to the specified value in the current message in the Event referenced by this EventFormatter. If the name is invalid for the current message, if appendMessage() has never been called or if the element identified by name has already been set an exception is thrown.

void blpapi::EventFormatter::setElement ( const char *  name,
Float32  value 
)

Set the element with the specified name to the specified value in the current message in the Event referenced by this EventFormatter. If the name is invalid for the current message, if appendMessage() has never been called or if the element identified by name has already been set an exception is thrown.

void blpapi::EventFormatter::setElement ( const char *  name,
Float64  value 
)

Set the element with the specified name to the specified value in the current message in the Event referenced by this EventFormatter. If the name is invalid for the current message, if appendMessage() has never been called or if the element identified by name has already been set an exception is thrown.

void blpapi::EventFormatter::setElement ( const char *  name,
const Datetime value 
)

Set the element with the specified name to the specified value in the current message in the Event referenced by this EventFormatter. If the name is invalid for the current message, if appendMessage() has never been called or if the element identified by name has already been set an exception is thrown.

void blpapi::EventFormatter::setElement ( const char *  name,
const char *  value 
)

Set the element with the specified name to the specified value in the current message in the Event referenced by this EventFormatter. If the name is invalid for the current message, if appendMessage() has never been called or if the element identified by name has already been set an exception is thrown. The behavior is undefined unless value is not NULL. Clients wishing to format and publish null values (e.g. for the purpose of cache management) should not use this function; use setElementNull instead.

void blpapi::EventFormatter::setElement ( const char *  name,
const Name value 
)

Set the element with the specified name to the specified value in the current message in the Event referenced by this EventFormatter. If the name is invalid for the current message, if appendMessage() has never been called or if the element identified by name has already been set an exception is thrown.

void blpapi::EventFormatter::setElementNull ( const char *  name  ) 

Create a null element with the specified name. Note that whether or not fields containing null values are published to subscribers is dependent upon details of the service and schema configuration. If the name is invalid for the current message, if appendMessage() has never been called or if the element identified by name has already been set an exception is thrown.

void blpapi::EventFormatter::setElement ( const Name name,
bool  value 
)

Set the element with the specified name to the specified value in the current message in the Event referenced by this EventFormatter. If the name is invalid for the current message, if appendMessage() has never been called or if the element identified by name has already been set an exception is thrown.

void blpapi::EventFormatter::setElement ( const Name name,
char  value 
)

Set the element with the specified name to the specified value in the current message in the Event referenced by this EventFormatter. If the name is invalid for the current message, if appendMessage() has never been called or if the element identified by name has already been set an exception is thrown.

void blpapi::EventFormatter::setElement ( const Name name,
Int32  value 
)

Set the element with the specified name to the specified value in the current message in the Event referenced by this EventFormatter. If the name is invalid for the current message, if appendMessage() has never been called or if the element identified by name has already been set an exception is thrown.

void blpapi::EventFormatter::setElement ( const Name name,
Int64  value 
)

Set the element with the specified name to the specified value in the current message in the Event referenced by this EventFormatter. If the name is invalid for the current message, if appendMessage() has never been called or if the element identified by name has already been set an exception is thrown.

void blpapi::EventFormatter::setElement ( const Name name,
Float32  value 
)

Set the element with the specified name to the specified value in the current message in the Event referenced by this EventFormatter. If the name is invalid for the current message, if appendMessage() has never been called or if the element identified by name has already been set an exception is thrown.

void blpapi::EventFormatter::setElement ( const Name name,
Float64  value 
)

Set the element with the specified name to the specified value in the current message in the Event referenced by this EventFormatter. If the name is invalid for the current message, if appendMessage() has never been called or if the element identified by name has already been set an exception is thrown.

void blpapi::EventFormatter::setElement ( const Name name,
const Datetime value 
)

Set the element with the specified name to the specified value in the current message in the Event referenced by this EventFormatter. If the name is invalid for the current message, if appendMessage() has never been called or if the element identified by name has already been set an exception is thrown.

void blpapi::EventFormatter::setElement ( const Name name,
const char *  value 
)

Set the element with the specified name to the specified value in the current message in the Event referenced by this EventFormatter. If the name is invalid for the current message, if appendMessage() has never been called or if the element identified by name has already been set an exception is thrown. The behavior is undefined unless value is not NULL. Clients wishing to format and publish null values (e.g. for the purpose of cache management) should not use this function; use setElementNull instead.

void blpapi::EventFormatter::setElement ( const Name name,
const Name value 
)

Set the element with the specified name to the specified value in the current message in the Event referenced by this EventFormatter. If the name is invalid for the current message, if appendMessage() has never been called or if the element identified by name has already been set an exception is thrown.

void blpapi::EventFormatter::setElementNull ( const Name name  ) 

Create a null element with the specified name. Note that whether or not fields containing null values are published to subscribers is dependent upon details of the service and schema configuration. If the name is invalid for the current message, if appendMessage() has never been called or if the element identified by name has already been set an exception is thrown.

void blpapi::EventFormatter::pushElement ( const char *  name  ) 
void blpapi::EventFormatter::pushElement ( const Name name  ) 

Changes the level at which this EventFormatter is operating to the specified element name. The element name must identify either a choice, a sequence or an array at the current level of the schema or the behavior is undefined. If the name is invalid for the current message, if appendMessage() has never been called or if the element identified by name has already been set an exception is thrown. After this returns the context of the EventFormatter is set to the element name in the schema and any calls to setElement() or pushElement() are applied at that level. If name represents an array of scalars then appendValue() must be used to add values. If name represents an array of complex types then appendElement() creates the first entry and set the context of the EventFormatter to that element. Calling appendElement() again will create another entry.

void blpapi::EventFormatter::popElement (  ) 

Undoes the most recent call to pushLevel() on this EventFormatter and returns the context of the EventFormatter to where it was before the call to pushElement(). Once popElement() has been called it is invalid to attempt to re-visit the same context.

void blpapi::EventFormatter::appendValue ( bool  value  ) 
void blpapi::EventFormatter::appendValue ( char  value  ) 
void blpapi::EventFormatter::appendValue ( Int32  value  ) 
void blpapi::EventFormatter::appendValue ( Int64  value  ) 
void blpapi::EventFormatter::appendValue ( Float32  value  ) 
void blpapi::EventFormatter::appendValue ( Float64  value  ) 
void blpapi::EventFormatter::appendValue ( const Datetime value  ) 
void blpapi::EventFormatter::appendValue ( const char *  value  ) 
void blpapi::EventFormatter::appendValue ( const Name value  ) 
void blpapi::EventFormatter::appendElement (  ) 

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