BLPAPI C++  3.23.2
MessageFormatter Class Reference

#include <blpapi_messageformatter.h>

Public Member Functions

 MessageFormatter (blpapi_MessageFormatter_t *handle)
 
 MessageFormatter (const MessageFormatter &original)
 
 ~MessageFormatter ()
 
MessageFormatteroperator= (const MessageFormatter &rhs)
 
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 Datetime::HighPrecision &value)
 
void setElement (const Name &name, const char *value)
 
void setElement (const Name &name, const std::string &value)
 
void setElement (const Name &name, const Name &value)
 
void setElement (const Name &name, const void *value, size_t length)
 
template<typename BYTES , typename std::enable_if< IsByteSequence< BYTES >::value, bool >::type = true>
void setElement (const Name &name, const BYTES &value)
 
void setElementNull (const Name &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 Datetime::HighPrecision &value)
 
void appendValue (const char *value)
 
void appendValue (const std::string &value)
 
void appendValue (const Name &value)
 
void appendElement ()
 
void formatMessageJson (const char *message)
 
void formatMessageXml (const char *message)
 
blpapi_MessageFormatter_timpl () const
 

Detailed Description

MessageFormatter is used to populate/format a message. It supports writing once only to each field. Attempting to set an already set element will fail.

Note that the behavior is undefined if

See Component blpapi_messageformatter

Constructor & Destructor Documentation

◆ MessageFormatter() [1/2]

Creates MessageFormatter from handle and takes ownership of the handle.

◆ MessageFormatter() [2/2]

MessageFormatter ( const MessageFormatter original)

Creates MessageFormatter from original. Changes made by one copy is visible to the other.

◆ ~MessageFormatter()

Destroy this MessageFormatter and release the d_handle.

Member Function Documentation

◆ appendElement()

void appendElement ( )

Create an element and append it to the array element on which this MessageFormatter is operating on. Throw an exception if the schema of the message is flat or the current element to which value is appended is not an array, a sequence or a choice.

◆ appendValue() [1/11]

void appendValue ( bool  value)

Append the specified value to element on which this MessageFormatter is operating. Throw an exception if the schema of the message is flat or the current element to which value is appended is not an array.

◆ appendValue() [2/11]

void appendValue ( char  value)

Append the specified value to element on which this MessageFormatter is operating. Throw an exception if the schema of the message is flat or the current element to which value is appended is not an array.

◆ appendValue() [3/11]

void appendValue ( Int32  value)

Append the specified value to element on which this MessageFormatter is operating. Throw an exception if the schema of the message is flat or the current element to which value is appended is not an array.

◆ appendValue() [4/11]

void appendValue ( Int64  value)

Append the specified value to element on which this MessageFormatter is operating. Throw an exception if the schema of the message is flat or the current element to which value is appended is not an array.

◆ appendValue() [5/11]

void appendValue ( Float32  value)

Append the specified value to element on which this MessageFormatter is operating. Throw an exception if the schema of the message is flat or the current element to which value is appended is not an array.

◆ appendValue() [6/11]

void appendValue ( Float64  value)

Append the specified value to element on which this MessageFormatter is operating. Throw an exception if the schema of the message is flat or the current element to which value is appended is not an array.

◆ appendValue() [7/11]

void appendValue ( const Datetime value)

Append the specified value to element on which this MessageFormatter is operating. Throw an exception if the schema of the message is flat or the current element to which value is appended is not an array.

◆ appendValue() [8/11]

void appendValue ( const Datetime::HighPrecision value)

Append the specified value to element on which this MessageFormatter is operating. Throw an exception if the schema of the message is flat or the current element to which value is appended is not an array.

◆ appendValue() [9/11]

void appendValue ( const char *  value)

Append the specified value to element on which this MessageFormatter is operating. Throw an exception if the schema of the message is flat or the current element to which value is appended is not an array.

◆ appendValue() [10/11]

void appendValue ( const std::string &  value)

Append the specified value to element on which this MessageFormatter is operating. Throw an exception if the schema of the message is flat or the current element to which value is appended is not an array. The behaviour is undefined if the specified value contains embedded zero-characters.

◆ appendValue() [11/11]

void appendValue ( const Name value)

Append the specified value to element on which this MessageFormatter is operating. Throw an exception if the schema of the message is flat or the current element to which value is appended is not an array.

◆ formatMessageJson()

void formatMessageJson ( const char *  message)

Format the message from its JSON representation. An exception is thrown if the method fails to format the message. The behavior is undefined if further formatting is done using this MessageFormatter.

◆ formatMessageXml()

void formatMessageXml ( const char *  message)

Format the message from its XML representation. An exception is thrown if the method fails to format the message. The behavior is undefined if further formatting is done using this MessageFormatter.

◆ impl()

blpapi_MessageFormatter_t * impl ( ) const

Returns underlying implementation of MessageFormatter. For internal use only.

◆ operator=()

MessageFormatter & operator= ( const MessageFormatter rhs)

Make this MessageFormatter same as rhs.

◆ popElement()

void popElement ( )

Undo the most recent call to pushElement() or appendElement() on this MessageFormatter and return the context of the MessageFormatter to where it was before the call to pushElement() or appendElement(). Once popElement() has been called it is invalid to attempt to re-visit the same context.

◆ pushElement()

void pushElement ( const Name name)

Change the level at which this MessageFormatter 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 or if the element identified by name has already been set an exception is thrown.

After this returns, the context of the MessageFormatter 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() must be used.

◆ setElement() [1/13]

void setElement ( const Name name,
bool  value 
)

Set the element with the specified name to the specified value in the current message referenced by this MessageFormatter. If the name is invalid for the current message or if the element identified by name has already been set an exception is thrown.

◆ setElement() [2/13]

void setElement ( const Name name,
char  value 
)

Set the element with the specified name to the specified value in the current message referenced by this MessageFormatter. If the name is invalid for the current message or if the element identified by name has already been set an exception is thrown.

◆ setElement() [3/13]

void setElement ( const Name name,
Int32  value 
)

Set the element with the specified name to the specified value in the current message referenced by this MessageFormatter. If the name is invalid for the current message or if the element identified by name has already been set an exception is thrown.

◆ setElement() [4/13]

void setElement ( const Name name,
Int64  value 
)

Set the element with the specified name to the specified value in the current message referenced by this MessageFormatter. If the name is invalid for the current message or if the element identified by name has already been set an exception is thrown.

◆ setElement() [5/13]

void setElement ( const Name name,
Float32  value 
)

Set the element with the specified name to the specified value in the current message referenced by this MessageFormatter. If the name is invalid for the current message or if the element identified by name has already been set an exception is thrown.

◆ setElement() [6/13]

void setElement ( const Name name,
Float64  value 
)

Set the element with the specified name to the specified value in the current message referenced by this MessageFormatter. If the name is invalid for the current message or if the element identified by name has already been set an exception is thrown.

◆ setElement() [7/13]

void setElement ( const Name name,
const Datetime value 
)

Set the element with the specified name to the specified value in the current message referenced by this MessageFormatter. If the name is invalid for the current message or if the element identified by name has already been set an exception is thrown.

◆ setElement() [8/13]

void setElement ( const Name name,
const Datetime::HighPrecision value 
)

Set the element with the specified name to the specified value in the current message referenced by this MessageFormatter. If the name is invalid for the current message or if the element identified by name has already been set an exception is thrown.

◆ setElement() [9/13]

void setElement ( const Name name,
const char *  value 
)

Set the element with the specified name to the specified value in the current message referenced by this MessageFormatter. If the name is invalid for the current message, 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 null values (e.g. for the purpose of cache management) should not use this function; use setElementNull instead.

◆ setElement() [10/13]

void setElement ( const Name name,
const std::string &  value 
)

Set the element with the specified name to the specified value in the current message referenced by this MessageFormatter. If the name is invalid for the current message, or if the element identified by name has already been set an exception is thrown. The behaviour is undefined if the specified value contains embedded zero-characters.

◆ setElement() [11/13]

void setElement ( const Name name,
const Name value 
)

Set the element with the specified name to the specified value in the current message referenced by this MessageFormatter. If the name is invalid for the current message or if the element identified by name has already been set an exception is thrown.

◆ setElement() [12/13]

void setElement ( const Name name,
const void *  value,
size_t  length 
)

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

◆ setElement() [13/13]

void setElement ( const Name name,
const BYTES &  value 
)

Set the element with the specified name to the specified value in the current message referenced by this MessageFormatter. If the name is invalid for the current message or if the element identified by name has already been set an exception is thrown. This function accepts any BYTES that provides const BYTES::value_type * BYTES::data() const method, does not provide BYTES::c_str() method and sizeof(BYTES::value_type) == 1, for example std::vector<char>. The behaviour of this function is undefined unless data() returns a pointer to a contiguous block of memory.

◆ setElementNull()

void 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 or if the element identified by name has already been set an exception is thrown.


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