BLPAPI C++  3.21.0
Element Class Reference

#include <blpapi_element.h>

Public Member Functions

 Element ()
 
 Element (blpapi_Element_t *element)
 
void rebind (blpapi_Element_t *element)
 
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 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 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 setValue (bool value, size_t index=0)
 
void setValue (char value, size_t index=0)
 
void setValue (Int32 value, size_t index=0)
 
void setValue (Int64 value, size_t index=0)
 
void setValue (Float32 value, size_t index=0)
 
void setValue (Float64 value, size_t index=0)
 
void setValue (const Datetime &value, size_t index=0)
 
void setValue (const char *value, size_t index=0)
 
void setValue (const std::string &value, size_t index=0)
 
void setValue (const Name &valueName, size_t index=0)
 
void setValue (const void *value, size_t length, size_t index)
 
template<typename BYTES , typename std::enable_if< IsByteSequence< BYTES >::value, bool >::type = true>
void setValue (const BYTES &value, size_t index=0)
 
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 std::string &value)
 
void appendValue (const Name &value)
 
Element appendElement ()
 
Element setChoice (const char *selectionName)
 
Element setChoice (const Name &selectionName)
 
blpapi_Element_thandle ()
 
Name name () const
 
int datatype () const
 
bool isComplexType () const
 
bool isArray () const
 
bool isNull () const
 
bool isReadOnly () const
 
SchemaElementDefinition elementDefinition () const
 
size_t numValues () const
 
size_t numElements () const
 
bool isValid () const
 
bool isNullValue (size_t position=0) const
 
bool hasElement (const char *name, bool excludeNullElements=false) const
 
bool hasElement (const Name &name, bool excludeNullElements=false) const
 
int getValueAs (bool *result, size_t index=0) const
 
int getValueAs (char *result, size_t index=0) const
 
int getValueAs (Int32 *result, size_t index=0) const
 
int getValueAs (Int64 *result, size_t index=0) const
 
int getValueAs (Float32 *result, size_t index=0) const
 
int getValueAs (Float64 *result, size_t index=0) const
 
int getValueAs (Datetime *result, size_t index=0) const
 
int getValueAs (std::string *result, size_t index=0) const
 
int getValueAs (Bytes *result, size_t index=0) const
 
int getValueAs (Element *result, size_t index=0) const
 
int getValueAs (Name *result, size_t index=0) const
 
bool getValueAsBool (size_t index=0) const
 
char getValueAsChar (size_t index=0) const
 
Int32 getValueAsInt32 (size_t index=0) const
 
Int64 getValueAsInt64 (size_t index=0) const
 
Float32 getValueAsFloat32 (size_t index=0) const
 
Float64 getValueAsFloat64 (size_t index=0) const
 
Datetime getValueAsDatetime (size_t index=0) const
 
const char * getValueAsString (size_t index=0) const
 
Bytes getValueAsBytes (size_t index=0) const
 
Element getValueAsElement (size_t index=0) const
 
Name getValueAsName (size_t index=0) const
 
int getElement (Element *result, const char *name) const
 
int getElement (Element *result, const Name &name) const
 
int getElement (Element *result, size_t position) const
 
Element getElement (size_t position) const
 
Element getElement (const Name &name) const
 
Element getElement (const char *name) const
 
bool getElementAsBool (const char *name) const
 
bool getElementAsBool (const Name &name) const
 
char getElementAsChar (const char *name) const
 
char getElementAsChar (const Name &name) const
 
Int32 getElementAsInt32 (const char *name) const
 
Int32 getElementAsInt32 (const Name &name) const
 
Int64 getElementAsInt64 (const char *name) const
 
Int64 getElementAsInt64 (const Name &name) const
 
Float32 getElementAsFloat32 (const char *name) const
 
Float32 getElementAsFloat32 (const Name &name) const
 
Float64 getElementAsFloat64 (const char *name) const
 
Float64 getElementAsFloat64 (const Name &name) const
 
Datetime getElementAsDatetime (const char *name) const
 
Datetime getElementAsDatetime (const Name &name) const
 
const char * getElementAsString (const char *name) const
 
const char * getElementAsString (const Name &name) const
 
Bytes getElementAsBytes (const Name &name) const
 
Name getElementAsName (const char *name) const
 
Name getElementAsName (const Name &name) const
 
Element getChoice () const
 
const blpapi_Element_thandle () const
 
std::ostream & print (std::ostream &stream, int level=0, int spacesPerLevel=4) const
 

Detailed Description

Element represents an item in a message.

An Element can represent: a single value of any data type supported by the Bloomberg API; an array of values; a sequence or a choice.

The value(s) in an Element can be queried in a number of ways. For an Element which represents a single value or an array of values use the getValueAs() functions or getValueAsBool() etc. For an Element which represents a sequence or choice use getElementAsBool() etc. In addition, for choices and sequences, hasElement() and getElement() are useful.

This example shows how to access the value of a scalar element s as a floating point number:

float f = s.getValueAsFloat32();

Similarly, this example shows how to retrieve the third value in an array element a, as a floating pointer number:

float f = a.getValueAsFloat32(2);

Use numValues() to determine the number of values available. For single values, it will return either 0 or 1. For arrays it will return the actual number of values in the array.

To retrieve values from a complex element types (sequences and choices) use the getElementAs...() family of methods. This example shows how to get the value of the element city in the sequence element address:

static const Name k_city { "city" };
const char* city = address.getElementAsString(k_city);

The value(s) of an Element can be set in a number of ways. For an Element which represents a single value or an array of values use the setValue() or appendValue() functions. For an element which represents a sequence or a choice use the setElement() functions.

This example shows how to set the value of an Element s from an integer:

Int32 value=5;
s.setValue(value);

This example shows how to append an integer a value to an array element a:

Int32 value=5;
s.appendValue(value);

To set values in a complex element (a sequence or a choice) use the setElement() family of functions. This example shows how to set the value of the element city in the sequence element address to a string.

static const Name k_city { "city" };
Element address;
...
address.setElement(k_city, "New York");

The API will convert data types as long as there is no loss of precision involved. So:

  • A BOOL can be returned as bool, char, Int32, Int64, Float32, Float64, std::string (the string will be "true" or "false")
  • A BOOL can be set from bool, std::string (if it has a value of "y", "n", "yes", "no", "true" or "false")
  • A CHAR can be returned as char, Int32, Int64, Float32, Float64, std::string
  • A CHAR can be set from char
  • An INT32 can be returned as Int32, Int64, Float64, std::string
  • An INT32 can be set from char, Int32, Int64 if the value is in Int32 range.
  • An INT64 can be returned as Int64, std::string
  • An INT64 can be set from char, Int32, Int64
  • A FLOAT32 can be returned as Float32, Float64, std::string
  • A FLOAT32 can be set from char
  • A FLOAT64 can be returned as Float64, std::string
  • A FLOAT64 can be set from char, Int32, Float32
  • A STRING can be returned as std::string, Name
  • A STRING can be set from bool (the string will be set to "true" or "false"), char, Int32, Int64, Float32, Float64, Name
  • A DATETIME can be returned as Datetime
  • A DATETIME can be set from Datetime
  • A BYTEARRAY can be set from a type that represents a contiguous sequence of bytes and returned as blpapi::Bytes.

See Component blpapi_element

Constructor & Destructor Documentation

◆ Element() [1/2]

Element ( )

Create an uninitialized Element. The only valid operations to perform on an uninitialized Element are assignment, isValid() and destruction.

◆ Element() [2/2]

Element ( blpapi_Element_t element)

Member Function Documentation

◆ appendElement()

Element appendElement ( )

If this Element is an array of sequence or choice Elements, then append an element to this element and return the appended element; otherwise an exception is thrown.

◆ appendValue() [1/10]

void appendValue ( bool  value)

Appends the specified value to this Element as the last element. An exception is thrown if this Element's DataType means it cannot be initialized from an instance of the supplied value, or if the current size of this Element (numValues()) is equal to the maximum defined by elementDefinition().maxValues().

◆ appendValue() [2/10]

void appendValue ( char  value)

Appends the specified value to this Element as the last element. An exception is thrown if this Element's DataType means it cannot be initialized from an instance of the supplied value, or if the current size of this Element (numValues()) is equal to the maximum defined by elementDefinition().maxValues().

◆ appendValue() [3/10]

void appendValue ( Int32  value)

Appends the specified value to this Element as the last element. An exception is thrown if this Element's DataType means it cannot be initialized from an instance of the supplied value, or if the current size of this Element (numValues()) is equal to the maximum defined by elementDefinition().maxValues().

◆ appendValue() [4/10]

void appendValue ( Int64  value)

Appends the specified value to this Element as the last element. An exception is thrown if this Element's DataType means it cannot be initialized from an instance of the supplied value, or if the current size of this Element (numValues()) is equal to the maximum defined by elementDefinition().maxValues().

◆ appendValue() [5/10]

void appendValue ( Float32  value)

Appends the specified value to this Element as the last element. An exception is thrown if this Element's DataType means it cannot be initialized from an instance of the supplied value, or if the current size of this Element (numValues()) is equal to the maximum defined by elementDefinition().maxValues().

◆ appendValue() [6/10]

void appendValue ( Float64  value)

Appends the specified value to this Element as the last element. An exception is thrown if this Element's DataType means it cannot be initialized from an instance of the supplied value, or if the current size of this Element (numValues()) is equal to the maximum defined by elementDefinition().maxValues().

◆ appendValue() [7/10]

void appendValue ( const Datetime value)

Appends the specified value to this Element as the last element. An exception is thrown if this Element's DataType means it cannot be initialized from an instance of the supplied value, or if the current size of this Element (numValues()) is equal to the maximum defined by elementDefinition().maxValues().

◆ appendValue() [8/10]

void appendValue ( const char *  value)

Appends the specified value to this Element as the last element. An exception is thrown if this Element's DataType means it cannot be initialized from an instance of the supplied value, or if the current size of this Element (numValues()) is equal to the maximum defined by elementDefinition().maxValues().

◆ appendValue() [9/10]

void appendValue ( const std::string &  value)

Appends the specified value to this Element as the last element. An exception is thrown if this Element's DataType means it cannot be initialized from an instance of the supplied value, or if the current size of this Element (numValues()) is equal to the maximum defined by elementDefinition().maxValues(). The behaviour is undefined if the specified value contains embedded zero-characters.

◆ appendValue() [10/10]

void appendValue ( const Name value)

Appends the specified value to this Element as the last element. An exception is thrown if this element's datatype is not an enumeration type, or if value does not refer to a constant in the enumeration type of this element. An exception is also thrown if the current size of this Element (numValues()) is equal to the maximum defined by elementDefinition().maxValues().

◆ datatype()

int datatype ( ) const

Return the basic data type used to represent a value in this element as an integer specified by the blpapi_DataType_t enumeration defined in blpapi_types.h.

◆ elementDefinition()

SchemaElementDefinition elementDefinition ( ) const

Return a reference to the read-only element definition object that defines the properties of this elements value.

◆ getChoice()

Element getChoice ( ) const

Return the selection name of this element if this element is a "choice" element. Otherwise, an exception is thrown.

◆ getElement() [1/6]

int getElement ( Element result,
const char *  name 
) const
Deprecated:
Use the form that takes Name instead of const char*.

If this Element is either a sequence or a choice and contains a valid Element identified by the specified name then load that element into the specified result and return 0; otherwise, return an error (non-zero). The behavior of this function is undefined unless name is a valid null-terminated string.

◆ getElement() [2/6]

int getElement ( Element result,
const Name name 
) const

If this Element is either a sequence or a choice and contains a valid Element identified by the specified name then load that element into the specified result and return 0; otherwise, return an error (non-zero). The behavior of this function is undefined if name is uninitialized.

◆ getElement() [3/6]

int getElement ( Element result,
size_t  position 
) const

If this Element is either a sequence or a choice and numElements() is greater than the specified position, then load the element at position into the specified result and return 0; otherwise return an error (non-zero).

◆ getElement() [4/6]

Element getElement ( size_t  position) const

If this Element is either a sequence or a choice and numElements() is greater than the specified position return the positionth element. Otherwise, an exception is thrown.

◆ getElement() [5/6]

Element getElement ( const Name name) const

If this Element is either a sequence or a choice and contains a valid Element identified by the specified name, then return that Element. Otherwise, an exception is thrown. The behavior of this function is undefined if name is uninitialized.

◆ getElement() [6/6]

Element getElement ( const char *  name) const
Deprecated:
Use the form that takes Name instead of const char*.

If this Element is either a sequence or a choice and contains a valid Element identified by the specified name, then return that Element. Otherwise, an exception is thrown. The behavior of this function is undefined unless name is a valid null-terminated string.

◆ getElementAsBool() [1/2]

bool getElementAsBool ( const char *  name) const
Deprecated:
Use the form that takes Name instead of const char*.

If this Element is either a sequence or a choice and contains a valid Element identified by the specified name which can be returned as a bool then its value is returned. Otherwise an exception is thrown. The behavior of this function is undefined unless name is a valid null-terminated string.

◆ getElementAsBool() [2/2]

bool getElementAsBool ( const Name name) const

If this Element is either a sequence or a choice and contains a valid Element identified by the specified name which can be returned as a bool then its value is returned. Otherwise an exception is thrown. The behavior of this function is undefined if name is uninitialized.

◆ getElementAsBytes()

Bytes getElementAsBytes ( const Name name) const

If this Element is either a sequence or a choice and contains a valid Element identified by the specified name which can be returned as a byte array, then a byte array struct is returned. The pointer remains valid until this Element is destroyed. Otherwise an exception is thrown. The behavior of this function is undefined if name is uninitialized.

◆ getElementAsChar() [1/2]

char getElementAsChar ( const char *  name) const
Deprecated:
Use the form that takes Name instead of const char*.

If this Element is either a sequence or a choice and contains a valid Element identified by the specified name which can be returned as a char then its value is returned. Otherwise an exception is thrown. The behavior of this function is undefined unless name is a valid null-terminated string.

◆ getElementAsChar() [2/2]

char getElementAsChar ( const Name name) const

If this Element is either a sequence or a choice and contains a valid Element identified by the specified name which can be returned as a char then its value is returned. Otherwise an exception is thrown. The behavior of this function is undefined if name is uninitialized.

◆ getElementAsDatetime() [1/2]

Datetime getElementAsDatetime ( const char *  name) const
Deprecated:
Use the form that takes Name instead of const char*.

If this Element is either a sequence or a choice and contains a valid Element identified by the specified name which can be returned as a Datetime then its value is returned. Otherwise an exception is thrown. The behavior of this function is undefined unless name is a valid null-terminated string. Note this function will not necessarily set all fields of the returned value – callers should check rv.hasParts(...) or rv.parts() before accessing the fields of the returned value rv.

◆ getElementAsDatetime() [2/2]

Datetime getElementAsDatetime ( const Name name) const

If this Element is either a sequence or a choice and contains a valid Element identified by the specified name which can be returned as Datetime then its value is returned. Otherwise an exception is thrown. The behavior of this function is undefined if name is uninitialized. Note that this function will not necessarily set all fields of the returned value – callers should check rv.hasParts(...) or rv.parts() before accessing the fields of the returned value rv.

◆ getElementAsFloat32() [1/2]

Float32 getElementAsFloat32 ( const char *  name) const
Deprecated:
Use the form that takes Name instead of const char*.

If this Element is either a sequence or a choice and contains a valid Element identified by the specified name which can be returned as a Float32 then its value is returned. Otherwise an exception is thrown. The behavior of this function is undefined unless name is a valid null-terminated string.

◆ getElementAsFloat32() [2/2]

Float32 getElementAsFloat32 ( const Name name) const

If this Element is either a sequence or a choice and contains a valid Element identified by the specified name which can be returned as a Float32 then its value is returned. Otherwise an exception is thrown. The behavior of this function is undefined if name is uninitialized.

◆ getElementAsFloat64() [1/2]

Float64 getElementAsFloat64 ( const char *  name) const
Deprecated:
Use the form that takes Name instead of const char*.

If this Element is either a sequence or a choice and contains a valid Element identified by the specified name which can be returned as a Float64 then its value is returned. Otherwise an exception is thrown. The behavior of this function is undefined unless name is a valid null-terminated string.

◆ getElementAsFloat64() [2/2]

Float64 getElementAsFloat64 ( const Name name) const

If this Element is either a sequence or a choice and contains a valid Element identified by the specified name which can be returned as a Float64 then its value is returned. Otherwise an exception is thrown. The behavior of this function is undefined if name is uninitialized.

◆ getElementAsInt32() [1/2]

Int32 getElementAsInt32 ( const char *  name) const
Deprecated:
Use the form that takes Name instead of const char*.

If this Element is either a sequence or a choice and contains a valid Element identified by the specified name which can be returned as an Int32 then its value is returned. Otherwise an exception is thrown. The behavior of this function is undefined unless name is a valid null-terminated string.

◆ getElementAsInt32() [2/2]

Int32 getElementAsInt32 ( const Name name) const

If this Element is either a sequence or a choice and contains a valid Element identified by the specified name which can be returned as an Int32 then its value is returned. Otherwise an exception is thrown. The behavior of this function is undefined if name is uninitialized.

◆ getElementAsInt64() [1/2]

Int64 getElementAsInt64 ( const char *  name) const
Deprecated:
Use the form that takes Name instead of const char*.

If this Element is either a sequence or a choice and contains a valid Element identified by the specified name which can be returned as an Int64 then its value is returned. Otherwise an exception is thrown. The behavior of this function is undefined unless name is a valid null-terminated string.

◆ getElementAsInt64() [2/2]

Int64 getElementAsInt64 ( const Name name) const

If this Element is either a sequence or a choice and contains a valid Element identified by the specified name which can be returned as an Int64 then its value is returned. Otherwise an exception is thrown. The behavior of this function is undefined if name is uninitialized.

◆ getElementAsName() [1/2]

Name getElementAsName ( const char *  name) const
Deprecated:
Use the form that takes Name instead of const char*.

If this Element is either a sequence or a choice and contains a valid Element identified by the specified name which can be returned as a Name then its value is returned. Otherwise an exception is thrown. The behavior of this function is undefined unless name is a valid null-terminated string.

◆ getElementAsName() [2/2]

Name getElementAsName ( const Name name) const

If this Element is either a sequence or a choice and contains a valid Element identified by the specified name which can be returned as a Name then its value is returned. Otherwise an exception is thrown. The behavior of this function is undefined if name is uninitialized.

◆ getElementAsString() [1/2]

const char * getElementAsString ( const char *  name) const
Deprecated:
Use the form that takes Name instead of const char*.

If this Element is either a sequence or a choice and contains a valid Element identified by the specified name which can be returned as a null-terminated string then a pointer to a string is returned. The pointer remains valid until this Element is destroyed. Otherwise an exception is thrown. The behavior of this function is undefined unless name is a valid null-terminated string.

◆ getElementAsString() [2/2]

const char * getElementAsString ( const Name name) const

If this Element is either a sequence or a choice and contains a valid Element identified by the specified name which can be returned as a null-terminated string then a pointer to a string is returned. The pointer remains valid until this Element is destroyed. Otherwise an exception is thrown. The behavior of this function is undefined if name is uninitialized.

◆ getValueAs() [1/11]

int getValueAs ( bool *  result,
size_t  index = 0 
) const

Set the specified result to the value of the specified indexth entry in this Element and return 0. An error (non-zero) is returned if the DataType of this Element cannot be converted to the type of result or if numValues() <= index.

◆ getValueAs() [2/11]

int getValueAs ( char *  result,
size_t  index = 0 
) const

Set the specified result to the value of the specified indexth entry in this Element and return 0. An error (non-zero) is returned if the DataType of this Element cannot be converted to the type of result or if numValues() <= index.

◆ getValueAs() [3/11]

int getValueAs ( Int32 result,
size_t  index = 0 
) const

Set the specified result to the value of the specified indexth entry in this Element and return 0. An error (non-zero) is returned if the DataType of this Element cannot be converted to the type of result or if numValues() <= index.

◆ getValueAs() [4/11]

int getValueAs ( Int64 result,
size_t  index = 0 
) const

Set the specified result to the value of the specified indexth entry in this Element and return 0. An error (non-zero) is returned if the DataType of this Element cannot be converted to the type of result or if numValues() <= index.

◆ getValueAs() [5/11]

int getValueAs ( Float32 result,
size_t  index = 0 
) const

Set the specified result to the value of the specified indexth entry in this Element and return 0. An error (non-zero) is returned if the DataType of this Element cannot be converted to the type of result or if numValues() <= index.

◆ getValueAs() [6/11]

int getValueAs ( Float64 result,
size_t  index = 0 
) const

Set the specified result to the value of the specified indexth entry in this Element and return 0. An error (non-zero) is returned if the DataType of this Element cannot be converted to the type of result or if numValues() <= index.

◆ getValueAs() [7/11]

int getValueAs ( Datetime result,
size_t  index = 0 
) const

Set the specified result to the value of the specified indexth entry in this Element and return 0. An error (non-zero) is returned if the DataType of this Element cannot be converted to the type of result or if numValues() <= index. Note that this function will not necessarily set all fields of *result – callers should check result->hasParts(...) or result->parts() before accessing the fields of result.

◆ getValueAs() [8/11]

int getValueAs ( std::string *  result,
size_t  index = 0 
) const

Set the specified result to the value of the specified indexth entry in this Element and return 0. An error (non-zero) is returned if the DataType of this Element cannot be converted to the type of result or if numValues() <= index.

◆ getValueAs() [9/11]

int getValueAs ( Bytes result,
size_t  index = 0 
) const

Set the specified result to the value of the specified indexth entry in this Element and return 0. An error (non-zero) is returned if the DataType of this Element is not `DataType.BYTEARRAY or if numValues() <= index.

◆ getValueAs() [10/11]

int getValueAs ( Element result,
size_t  index = 0 
) const

Set the specified result to the value of the specified indexth entry in this Element and return 0. An error (non-zero) is returned if the DataType of this Element cannot be converted to the type of result or if numValues() <= index.

◆ getValueAs() [11/11]

int getValueAs ( Name result,
size_t  index = 0 
) const

Set the specified result to the value of the specified indexth entry in this Element and return 0. An error (non-zero) is returned if the DataType of this Element is not of type enumeration or if numValues() <= index.

◆ getValueAsBool()

bool getValueAsBool ( size_t  index = 0) const

Return the specified indexth entry in the Element as a bool. An exception is thrown if the DataType of this Element cannot be converted to bool or if numValues() <= index.

◆ getValueAsBytes()

Bytes getValueAsBytes ( size_t  index = 0) const

Returns the specified indexth entry in the Element as Bytes. An exception is thrown if the DataType of this Element is not DataType.BYTEARRAY or if numValues() <= index. The pointer returned remains valid until this Element is destroyed.

◆ getValueAsChar()

char getValueAsChar ( size_t  index = 0) const

Return the specified indexth entry in the Element as a char. An exception is thrown if the DataType of this Element cannot be converted to char or if numValues() <= index.

◆ getValueAsDatetime()

Datetime getValueAsDatetime ( size_t  index = 0) const

Returns the specified indexth entry in the Element as a Datetime. An exception is thrown if the DataType of this Element cannot be converted to Datetime or if numValues() <= index. Note that this function will not necessarily set all fields of the returned value – callers should check rv.hasParts(...) or rv.parts() before accessing the fields of the returned value rv.

◆ getValueAsElement()

Element getValueAsElement ( size_t  index = 0) const

Returns the specified indexth entry in the Element as an Element. An exception is thrown if the DataType of this Element cannot be converted to an Element or if numValues() <= index.

◆ getValueAsFloat32()

Float32 getValueAsFloat32 ( size_t  index = 0) const

Returns the specified indexth entry in the Element as a Float32. An exception is thrown if the DataType of this Element cannot be converted to Float32 or if numValues() <= index.

◆ getValueAsFloat64()

Float64 getValueAsFloat64 ( size_t  index = 0) const

Returns the specified indexth entry in the Element as a Float64. An exception is thrown if the DataType of this Element cannot be converted to Float64 or if numValues() <= index.

◆ getValueAsInt32()

Int32 getValueAsInt32 ( size_t  index = 0) const

Return the specified indexth entry in the Element as a Int32. An exception is thrown if the DataType of this Element cannot be converted to Int32 or if numValues() <= index.

◆ getValueAsInt64()

Int64 getValueAsInt64 ( size_t  index = 0) const

Returns the specified indexth entry in the Element as a Int64. An exception is thrown if the DataType of this Element cannot be converted to Int64 or if numValues() <= index.

◆ getValueAsName()

Name getValueAsName ( size_t  index = 0) const

Returns the specified indexth entry in the Element as a Name. An exception is thrown if the DataType of this Element is not of type enumeration or if numValues() <= index.

◆ getValueAsString()

const char * getValueAsString ( size_t  index = 0) const

Returns the specified indexth entry in the Element as a pointer to a null-terminated string. An exception is thrown if the DataType of this Element cannot be converted to a null-terminated string or if numValues() <= index. The pointer returned remains valid until this Element is destroyed.

◆ handle() [1/2]

blpapi_Element_t * handle ( )

◆ handle() [2/2]

const blpapi_Element_t * handle ( ) const

◆ hasElement() [1/2]

bool hasElement ( const char *  name,
bool  excludeNullElements = false 
) const
Deprecated:
Use the form that takes Name instead of const char*.

Return true if this Element is a choice or sequence (isComplexType() == true) and it contains an Element with the specified name.

◆ hasElement() [2/2]

bool hasElement ( const Name name,
bool  excludeNullElements = false 
) const

Return true if this Element is a choice or sequence (isComplexType() == true) and it contains an Element with the specified name.

◆ isArray()

bool isArray ( ) const

Return true if elementDefinition().maxValues() > 1 or elementDefinition().maxValues() == UNBOUNDED, and false otherwise.

◆ isComplexType()

bool isComplexType ( ) const

Return true if the DataType is either SEQUENCE or CHOICE and the element is not an array element. Return false otherwise.

◆ isNull()

bool isNull ( ) const

Return true if this element has a null value, and false otherwise.

◆ isNullValue()

bool isNullValue ( size_t  position = 0) const

Return true if the value of the sub-element at the specified position in a sequence or choice element is a null value. An exception is thrown if position >= numElements().

◆ isReadOnly()

bool isReadOnly ( ) const

Return true if this element cannot be modified, and false otherwise.

◆ isValid()

bool isValid ( ) const

Return true if this Element is valid. An Element created using the default constructor is not valid until it has had a value assigned to it.

◆ name()

Name name ( ) const

If this Element is part of a sequence or choice Element then return the Name of this Element within the sequence or choice Element that owns it. If this Element is not part of a sequence Element (that is it is an entire Request or Message) then return the Name of the Request or Message.

◆ numElements()

size_t numElements ( ) const

Return the number of elements contained by this element. The number of elements is 0 if isComplex() returns false, and no greater than 1 if the Datatype is CHOICE; if the DataType is SEQUENCE this may return any number (including 0).

◆ numValues()

size_t numValues ( ) const

Return the number of values contained by this element. The number of values is 0 if isNull() returns true, and no greater than 1 if isComplexType() returns true. The value returned will always be in the range defined by elementDefinition().minValues() and elementDefinition().maxValues().

◆ print()

std::ostream & print ( std::ostream &  stream,
int  level = 0,
int  spacesPerLevel = 4 
) const

Format this Element 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).

◆ rebind()

void rebind ( blpapi_Element_t element)

◆ setChoice() [1/2]

Element setChoice ( const char *  selectionName)
Deprecated:
Use the form that takes Name instead of const char*.

If datatype() == DataType::CHOICE and the specified selectionName is valid for this Element, then set the active Element to the one specified by selectionName and return it; otherwise an exception is thrown.

◆ setChoice() [2/2]

Element setChoice ( const Name selectionName)

If datatype() == DataType::CHOICE and the specified selectionName is value for this Element, then set the active Element to the one specified by selectionName and return it; otherwise an exception is thrown.

◆ setElement() [1/21]

void setElement ( const char *  name,
bool  value 
)
Deprecated:
Use the form that takes Name instead of const char*.

Set the specified element name within this sequence or choice Element to the specified value. An exception is thrown if the specified name is not valid for this Element, or if the Element identified by the specified name cannot be initialized from the type of the specified value. The behavior of this function is undefined unless name is a valid null-terminated string.

◆ setElement() [2/21]

void setElement ( const char *  name,
char  value 
)
Deprecated:
Use the form that takes Name instead of const char*.

Set the specified element name within this sequence or choice Element to the specified value. An exception is thrown if the specified name is not valid for this Element, or if the Element identified by the specified name cannot be initialized from the type of the specified value. The behavior of this function is undefined unless name is a valid null-terminated string.

◆ setElement() [3/21]

void setElement ( const char *  name,
Int32  value 
)
Deprecated:
Use the form that takes Name instead of const char*.

Set the specified element name within this sequence or choice Element to the specified value. An exception is thrown if the specified name is not valid for this Element, or if the Element identified by the specified name cannot be initialized from the type of the specified value. The behavior of this function is undefined unless name is a valid null-terminated string.

◆ setElement() [4/21]

void setElement ( const char *  name,
Int64  value 
)
Deprecated:
Use the form that takes Name instead of const char*.

Set the specified element name within this sequence or choice Element to the specified value. An exception is thrown if the specified name is not valid for this Element, or if the Element identified by the specified name cannot be initialized from the type of the specified value. The behavior of this function is undefined unless name is a valid null-terminated string.

◆ setElement() [5/21]

void setElement ( const char *  name,
Float32  value 
)
Deprecated:
Use the form that takes Name instead of const char*.

Set the specified element name within this sequence or choice Element to the specified value. An exception is thrown if the specified name is not valid for this Element, or if the Element identified by the specified name cannot be initialized from the type of the specified value. The behavior of this function is undefined unless name is a valid null-terminated string.

◆ setElement() [6/21]

void setElement ( const char *  name,
Float64  value 
)
Deprecated:
Use the form that takes Name instead of const char*.

Set the specified element name within this sequence or choice Element to the specified value. An exception is thrown if the specified name is not valid for this Element, or if the Element identified by the specified name cannot be initialized from the type of the specified value. The behavior of this function is undefined unless name is a valid null-terminated string.

◆ setElement() [7/21]

void setElement ( const char *  name,
const Datetime value 
)
Deprecated:
Use the form that takes Name instead of const char*.

Set the specified element name within this sequence or choice Element to the specified value. An exception is thrown if the specified name is not valid for this Element, or if the Element identified by the specified name cannot be initialized from the type of the specified value. The behavior of this function is undefined unless name is a valid null-terminated string.

◆ setElement() [8/21]

void setElement ( const char *  name,
const char *  value 
)
Deprecated:
Use the form that takes Name instead of const char*.

Set the specified element name within this sequence or choice Element to the specified value. An exception is thrown if the specified name is not valid for this Element, or if the Element identified by the specified name cannot be initialized from the type of the specified value. The behavior of this function is undefined unless name is a valid null-terminated string.

◆ setElement() [9/21]

void setElement ( const char *  name,
const Name value 
)
Deprecated:
Use the form that takes Name instead of const char*.

Set the specified element name within this sequence or choice Element to the specified value. An exception is thrown if the specified name is not valid for this Element. An exception is also thrown if the specified Element's type is not an enumeration type, or if value does not refer to a constant in the enumeration type of the specified Element. The behavior of this function is undefined unless name is a valid null-terminated string.

◆ setElement() [10/21]

void setElement ( const Name name,
bool  value 
)

Set the specified element name within this sequence or choice Element to the specified value. An exception is thrown if the specified name is not valid for this Element, or if the Element identified by the specified name cannot be initialized from the type of the specified value. The behavior of this function is undefined if name is uninitialized.

◆ setElement() [11/21]

void setElement ( const Name name,
char  value 
)

Set the specified element name within this sequence or choice Element to the specified value. An exception is thrown if the specified name is not valid for this Element, or if the Element identified by the specified name cannot be initialized from the type of the specified value. The behavior of this function is undefined if name is uninitialized.

◆ setElement() [12/21]

void setElement ( const Name name,
Int32  value 
)

Set the specified element name within this sequence or choice Element to the specified value. An exception is thrown if the specified name is not valid for this Element, or if the Element identified by the specified name cannot be initialized from the type of the specified value. The behavior of this function is undefined if name is uninitialized.

◆ setElement() [13/21]

void setElement ( const Name name,
Int64  value 
)

Set the specified element name within this sequence or choice Element to the specified value. An exception is thrown if the specified name is not valid for this Element, or if the Element identified by the specified name cannot be initialized from the type of the specified value. The behavior of this function is undefined if name is uninitialized.

◆ setElement() [14/21]

void setElement ( const Name name,
Float32  value 
)

Set the specified element name within this sequence or choice Element to the specified value. An exception is thrown if the specified name is not valid for this Element, or if the Element identified by the specified name cannot be initialized from the type of the specified value. The behavior of this function is undefined if name is uninitialized.

◆ setElement() [15/21]

void setElement ( const Name name,
Float64  value 
)

Set the specified element name within this sequence or choice Element to the specified value. An exception is thrown if the specified name is not valid for this Element, or if the Element identified by the specified name cannot be initialized from the type of the specified value. The behavior of this function is undefined if name is uninitialized.

◆ setElement() [16/21]

void setElement ( const Name name,
const Datetime value 
)

Set the specified element name within this sequence or choice Element to the specified value. An exception is thrown if the specified name is not valid for this Element, or if the Element identified by the specified name cannot be initialized from the type of the specified value. The behavior of this function is undefined if name is uninitialized.

◆ setElement() [17/21]

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

Set the specified element name within this sequence or choice Element to the specified value. An exception is thrown if the specified name is not valid for this Element, or if the Element identified by the specified name cannot be initialized from the type of the specified value. The behavior of this function is undefined if name is uninitialized.

◆ setElement() [18/21]

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

Set the specified element name within this sequence or choice Element to the specified value. An exception is thrown if the specified name is not valid for this Element, or if the Element identified by the specified name cannot be initialized from the type of the specified value. The behavior of this function is undefined if name is uninitialized. The behaviour is undefined if the specified value contains embedded zero-characters.

◆ setElement() [19/21]

void setElement ( const Name name,
const Name value 
)

Set the specified element name within this sequence or choice Element to the specified value. An exception is thrown if the specified name is not valid for this Element. An exception is also thrown if the specified Element's type is not an enumeration type, or if value does not refer to a constant in the enumeration type of the specified Element. The behavior of this function is undefined if name is uninitialized.

◆ setElement() [20/21]

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

Set the specified element name within this sequence or choice Element to the specified value and length in bytes. An exception is thrown if the specified name is not valid for this Element, or if the Element identified by the specified name does not have the data type BYTEARRAY. The behavior of this function is undefined if name is uninitialized.

◆ setElement() [21/21]

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

Set the specified element name within this sequence or choice Element to the specified value. An exception is thrown if the specified name is not valid for this Element, or if the Element identified by the specified name does not have the data type BYTEARRAY. The behavior of this function is undefined if name is uninitialized. 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.

◆ setValue() [1/12]

void setValue ( bool  value,
size_t  index = 0 
)

Set the value of the specified indexth entry in this Element to the specified value. An exception is thrown if this Element's DataType means it cannot be initialized from an instance of the supplied value. An exception is thrown if index >= numValues().

◆ setValue() [2/12]

void setValue ( char  value,
size_t  index = 0 
)

Set the value of the specified indexth entry in this Element to the specified value. An exception is thrown if this Element's DataType means it cannot be initialized from an instance of the supplied value. An exception is thrown if index >= numValues().

◆ setValue() [3/12]

void setValue ( Int32  value,
size_t  index = 0 
)

Set the value of the specified indexth entry in this Element to the specified value. An exception is thrown if this Element's DataType means it cannot be initialized from an instance of the supplied value. An exception is thrown if index >= numValues().

◆ setValue() [4/12]

void setValue ( Int64  value,
size_t  index = 0 
)

Set the value of the specified indexth entry in this Element to the specified value. An exception is thrown if this Element's DataType means it cannot be initialized from an instance of the supplied value. An exception is thrown if index >= numValues().

◆ setValue() [5/12]

void setValue ( Float32  value,
size_t  index = 0 
)

Set the value of the specified indexth entry in this Element to the specified value. An exception is thrown if this Element's DataType means it cannot be initialized from an instance of the supplied value. An exception is thrown if index >= numValues().

◆ setValue() [6/12]

void setValue ( Float64  value,
size_t  index = 0 
)

Set the value of the specified indexth entry in this Element to the specified value. An exception is thrown if this Element's DataType means it cannot be initialized from an instance of the supplied value. An exception is thrown if index >= numValues().

◆ setValue() [7/12]

void setValue ( const Datetime value,
size_t  index = 0 
)

Set the value of the specified indexth entry in this Element to the specified value. An exception is thrown if this Element's DataType means it cannot be initialized from an instance of the supplied value. An exception is thrown if index >= numValues().

◆ setValue() [8/12]

void setValue ( const char *  value,
size_t  index = 0 
)

Set the value of the specified indexth entry in this Element to the specified value. An exception is thrown if this Element's DataType means it cannot be initialized from an instance of the supplied value. An exception is thrown if index >= numValues().

◆ setValue() [9/12]

void setValue ( const std::string &  value,
size_t  index = 0 
)

Set the value of the specified indexth entry in this Element to the specified value. An exception is thrown if this Element's DataType means it cannot be initialized from an instance of the supplied value. An exception is thrown if index >= numValues(). The behaviour is undefined if the specified value contains embedded zero-characters.

◆ setValue() [10/12]

void setValue ( const Name valueName,
size_t  index = 0 
)

Set the value of the specified indexth entry in this Element to the specified valueName. An exception is thrown if this element's datatype is not an enumeration type, or if valueName does not refer to a constant in the enumeration type of this element. An exception is also thrown if index >= numValues().

◆ setValue() [11/12]

void setValue ( const void *  value,
size_t  length,
size_t  index 
)

Set the value of the specified indexth entry in this Element to the specified value and length in bytes. An exception is thrown if this Element's DataType is not BYTEARRAY. An exception is also thrown if index >= numValues().

◆ setValue() [12/12]

void setValue ( const BYTES &  value,
size_t  index = 0 
)

Set the value of the specified indexth entry in this Element to the specified value. An exception is thrown if this Element's DataType is not BYTEARRAY. An exception is also thrown if index >= numValues(). 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.


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