#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 Name &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 Name &valueName, 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 Name &value) |
Element | appendElement () |
Element | setChoice (const char *selectionName) |
Element | setChoice (const Name &selectionName) |
blpapi_Element_t * | handle () |
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 (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 |
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 |
Name | getElementAsName (const char *name) const |
Name | getElementAsName (const Name &name) const |
Element | getChoice () const |
const blpapi_Element_t * | handle () const |
std::ostream & | print (std::ostream &stream, int level=0, int spacesPerLevel=4) const |
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
:
const char* city = address.getElementAsString("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.
Element address; ... address.setElement("city", "New York");
Methods which specify a Element name come in two forms. One which takes a Name as a parameter and one which takes a const char*. The form which takes Name is more efficient. However, it requires the Name to have been created in the global name table.
The form which takes a const char* is less efficient but will not cause a new Name to be created in the global Name table. Because all valid Element names will have already been placed in the global name table by the API if the supplied string cannot be found in the global name table the appropriate error or exception can be returned.
The API will convert data types as long as there is no loss of precision involved. So:
blpapi::Element::Element | ( | ) |
blpapi::Element::Element | ( | blpapi_Element_t * | element | ) |
void blpapi::Element::rebind | ( | blpapi_Element_t * | element | ) |
void blpapi::Element::setElement | ( | const char * | 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 unless name
is a valid null-terminated string.
void blpapi::Element::setElement | ( | const char * | 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 unless name
is a valid null-terminated string.
void blpapi::Element::setElement | ( | const char * | 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 unless name
is a valid null-terminated string.
void blpapi::Element::setElement | ( | const char * | 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 unless name
is a valid null-terminated string.
void blpapi::Element::setElement | ( | const char * | 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 unless name
is a valid null-terminated string.
void blpapi::Element::setElement | ( | const char * | 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 unless name
is a valid null-terminated string.
void blpapi::Element::setElement | ( | const char * | 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 unless name
is a valid null-terminated string.
void blpapi::Element::setElement | ( | const char * | 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 unless name
is a valid null-terminated string.
void blpapi::Element::setElement | ( | const char * | 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, 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.
void blpapi::Element::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.
void blpapi::Element::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.
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.
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.
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.
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.
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.
void blpapi::Element::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.
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.
void blpapi::Element::setValue | ( | bool | value, | |
size_t | index = 0 | |||
) |
Set the value of the specified index
th 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()
.
void blpapi::Element::setValue | ( | char | value, | |
size_t | index = 0 | |||
) |
Set the value of the specified index
th 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()
.
void blpapi::Element::setValue | ( | Int32 | value, | |
size_t | index = 0 | |||
) |
Set the value of the specified index
th 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()
.
void blpapi::Element::setValue | ( | Int64 | value, | |
size_t | index = 0 | |||
) |
Set the value of the specified index
th 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()
.
void blpapi::Element::setValue | ( | Float32 | value, | |
size_t | index = 0 | |||
) |
Set the value of the specified index
th 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()
.
void blpapi::Element::setValue | ( | Float64 | value, | |
size_t | index = 0 | |||
) |
Set the value of the specified index
th 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()
.
void blpapi::Element::setValue | ( | const Datetime & | value, | |
size_t | index = 0 | |||
) |
Set the value of the specified index
th 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()
.
void blpapi::Element::setValue | ( | const char * | value, | |
size_t | index = 0 | |||
) |
Set the value of the specified index
th 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()
.
void blpapi::Element::setValue | ( | const Name & | valueName, | |
size_t | index = 0 | |||
) |
Set the value of the specified index
th 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()
.
void blpapi::Element::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()
.
void blpapi::Element::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()
.
void blpapi::Element::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()
.
void blpapi::Element::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()
.
void blpapi::Element::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()
.
void blpapi::Element::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()
.
void blpapi::Element::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()
.
void blpapi::Element::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()
.
void blpapi::Element::appendValue | ( | const Name & | 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()
.
Element blpapi::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.
Element blpapi::Element::setChoice | ( | const char * | selectionName | ) |
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.
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.
blpapi_Element_t* blpapi::Element::handle | ( | ) |
Name blpapi::Element::name | ( | ) | const |
int blpapi::Element::datatype | ( | ) | const |
Return the basic data type used to represent a value in this element. The possible return values are enumerated in blpapi_datatype
.
bool blpapi::Element::isComplexType | ( | ) | const |
Return true if datatype() == DataType::SEQUENCE
or datatype() == DataType::CHOICE
and false otherwise.
bool blpapi::Element::isArray | ( | ) | const |
Return true if elementDefinition().maxValues() > 1
or elementDefinition().maxValues() == UNBOUNDED
, and false otherwise.
bool blpapi::Element::isNull | ( | ) | const |
Return true if this element has a null value, and false otherwise.
bool blpapi::Element::isReadOnly | ( | ) | const |
Return true if this element cannot be modified, and false otherwise.
SchemaElementDefinition blpapi::Element::elementDefinition | ( | ) | const |
Return a reference to the read-only element definition object that defines the properties of this elements value.
size_t blpapi::Element::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()
.
size_t blpapi::Element::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).
bool blpapi::Element::isValid | ( | ) | const |
bool blpapi::Element::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()
.
bool blpapi::Element::hasElement | ( | const char * | name, | |
bool | excludeNullElements = false | |||
) | const |
bool blpapi::Element::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
.
int blpapi::Element::getValueAs | ( | bool * | result, | |
size_t | index = 0 | |||
) | const |
Set the specified result
to the value of the specified index
th 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
.
int blpapi::Element::getValueAs | ( | char * | result, | |
size_t | index = 0 | |||
) | const |
Set the specified result
to the value of the specified index
th 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
.
int blpapi::Element::getValueAs | ( | Int32 * | result, | |
size_t | index = 0 | |||
) | const |
Set the specified result
to the value of the specified index
th 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
.
int blpapi::Element::getValueAs | ( | Int64 * | result, | |
size_t | index = 0 | |||
) | const |
Set the specified result
to the value of the specified index
th 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
.
int blpapi::Element::getValueAs | ( | Float32 * | result, | |
size_t | index = 0 | |||
) | const |
Set the specified result
to the value of the specified index
th 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
.
int blpapi::Element::getValueAs | ( | Float64 * | result, | |
size_t | index = 0 | |||
) | const |
Set the specified result
to the value of the specified index
th 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
.
int blpapi::Element::getValueAs | ( | Datetime * | result, | |
size_t | index = 0 | |||
) | const |
Set the specified result
to the value of the specified index
th 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
.
int blpapi::Element::getValueAs | ( | std::string * | result, | |
size_t | index = 0 | |||
) | const |
Set the specified result
to the value of the specified index
th 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
.
int blpapi::Element::getValueAs | ( | Element * | result, | |
size_t | index = 0 | |||
) | const |
Set the specified result
to the value of the specified index
th 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
.
int blpapi::Element::getValueAs | ( | Name * | result, | |
size_t | index = 0 | |||
) | const |
Set the specified result
to the value of the specified index
th 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
.
bool blpapi::Element::getValueAsBool | ( | size_t | index = 0 |
) | const |
Return the specified index
th 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
.
char blpapi::Element::getValueAsChar | ( | size_t | index = 0 |
) | const |
Return the specified index
th 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
.
Int32 blpapi::Element::getValueAsInt32 | ( | size_t | index = 0 |
) | const |
Return the specified index
th 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
.
Int64 blpapi::Element::getValueAsInt64 | ( | size_t | index = 0 |
) | const |
Returns the specified index
th 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
.
Float32 blpapi::Element::getValueAsFloat32 | ( | size_t | index = 0 |
) | const |
Returns the specified index
th 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
.
Float64 blpapi::Element::getValueAsFloat64 | ( | size_t | index = 0 |
) | const |
Returns the specified index
th 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
.
Datetime blpapi::Element::getValueAsDatetime | ( | size_t | index = 0 |
) | const |
Returns the specified index
th 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
.
const char* blpapi::Element::getValueAsString | ( | size_t | index = 0 |
) | const |
Returns the specified index
th 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.
Element blpapi::Element::getValueAsElement | ( | size_t | index = 0 |
) | const |
Name blpapi::Element::getValueAsName | ( | size_t | index = 0 |
) | const |
int blpapi::Element::getElement | ( | Element * | result, | |
const char * | 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 unless name
is a valid null-terminated string.
int blpapi::Element::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).
Element blpapi::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 position
th element. Otherwise, an exception is thrown.
Element blpapi::Element::getElement | ( | const char * | name | ) | const |
bool blpapi::Element::getElementAsBool | ( | const char * | name | ) | const |
bool blpapi::Element::getElementAsBool | ( | const Name & | name | ) | const |
char blpapi::Element::getElementAsChar | ( | const char * | name | ) | const |
char blpapi::Element::getElementAsChar | ( | const Name & | name | ) | const |
Int32 blpapi::Element::getElementAsInt32 | ( | const char * | name | ) | const |
Int64 blpapi::Element::getElementAsInt64 | ( | const char * | name | ) | const |
Float32 blpapi::Element::getElementAsFloat32 | ( | const char * | name | ) | const |
Float64 blpapi::Element::getElementAsFloat64 | ( | const char * | name | ) | const |
Datetime blpapi::Element::getElementAsDatetime | ( | const char * | 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 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
.
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
.
const char* blpapi::Element::getElementAsString | ( | const char * | 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 unless name
is a valid null-terminated string.
const char* blpapi::Element::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.
Name blpapi::Element::getElementAsName | ( | const char * | name | ) | const |
Element blpapi::Element::getChoice | ( | ) | const |
Return the selection name of this element if this element is a "choice" element. Otherwise, an exception is thrown.
const blpapi_Element_t* blpapi::Element::handle | ( | ) | const |
std::ostream& blpapi::Element::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
).