28#ifndef INCLUDED_BLPAPI_ELEMENT
29#define INCLUDED_BLPAPI_ELEMENT
62#include <blpapi_deprecate.h>
123 const char *nameString,
128 const char *nameString,
133 const char *nameString,
135 int excludeNullElements,
252 const char *nameString,
258 const char *nameString,
264 const char *nameString,
270 const char *nameString,
276 const char *nameString,
282 const char *nameString,
288 const char *nameString,
294 const char *nameString,
300 const char *nameString,
306 const char *nameString,
313 const char *nameString,
319 const char *elementName,
330 const char *nameCstr,
342#include <type_traits>
491 BLPAPI_DEPRECATE_STRING_NAME
void setElement(
const char *
name,
bool value);
504 BLPAPI_DEPRECATE_STRING_NAME
void setElement(
const char *
name,
char value);
588 const char *
name,
const char *value);
602 const char *
name,
const Name& value);
738 template <
typename BYTES,
739 typename std::enable_if<IsByteSequence<BYTES>::value,
bool>::type
757 void setValue(
bool value,
size_t index = 0);
766 void setValue(
char value,
size_t index = 0);
820 void setValue(
const char *value,
size_t index = 0);
829 void setValue(
const std::string& value,
size_t index = 0);
849 void setValue(
const void *value,
size_t length,
size_t index);
858 template <
typename BYTES,
859 typename std::enable_if<IsByteSequence<BYTES>::value,
bool>::type
861 void setValue(
const BYTES& value,
size_t index = 0);
1086 BLPAPI_DEPRECATE_STRING_NAME
bool hasElement(
1087 const char *
name,
bool excludeNullElements =
false)
const;
1105 int getValueAs(
bool *result,
size_t index = 0)
const;
1114 int getValueAs(
char *result,
size_t index = 0)
const;
1171 int getValueAs(std::string *result,
size_t index = 0)
const;
1388 const char *
name)
const;
1409 const char *
name)
const;
1430 const char *
name)
const;
1451 const char *
name)
const;
1472 const char *
name)
const;
1500 const char *
name)
const;
1560 std::ostream&
print(
1561 std::ostream& stream,
int level = 0,
int spacesPerLevel = 4)
const;
1575 std::string
toJson()
const;
1592 void fromJson(
const std::string& json);
1636 : d_handle_p(newHandle)
1642 d_handle_p = element;
1648 d_handle_p, elementName, 0, value ? 1 : 0));
1672 d_handle_p, elementName, 0, value));
1678 d_handle_p, elementName, 0, value));
1693 d_handle_p, elementName, 0, value));
1699 d_handle_p, elementName, 0, value.
impl()));
1705 d_handle_p, 0, elementName.
impl(), value ? 1 : 0));
1711 d_handle_p, 0, elementName.
impl(), value));
1717 d_handle_p, 0, elementName.
impl(), value));
1723 d_handle_p, 0, elementName.
impl(), value));
1729 d_handle_p, 0, elementName.
impl(), value));
1735 d_handle_p, 0, elementName.
impl(), value));
1750 d_handle_p, 0, elementName.
impl(), value));
1754 const Name& elementName,
const std::string& value)
1762 d_handle_p, 0, elementName.
impl(), value.
impl()));
1766 const Name& elementName,
const void *value,
size_t length)
1772 reinterpret_cast<const char *
>(value),
1776template <
typename BYTES,
1777 typename std::enable_if<IsByteSequence<BYTES>::value,
bool>::type>
1780 setElement(elementName, value.data(), value.size());
1840 d_handle_p, valueName.
impl(), index));
1846 d_handle_p,
reinterpret_cast<const char *
>(value), length, index));
1849template <
typename BYTES,
1850 typename std::enable_if<IsByteSequence<BYTES>::value,
bool>::type>
1853 setValue(value.data(), value.size(), index);
1922 return Element(appendedElement);
1929 d_handle_p, &resultElement, selectionName, 0, 0));
1930 return Element(resultElement);
1937 d_handle_p, &resultElement, 0, selectionName.
impl(), 0));
1938 return Element(resultElement);
1967 d_handle_p, &fldt, 0, elementName.
impl());
2033 if (rc != 0 && rc != 1) {
2036 return rc ? true :
false;
2040 const char *nameString,
bool excludeNullElements)
const
2042 if (excludeNullElements) {
2044 d_handle_p, nameString, 0, excludeNullElements, 0)
2052 const Name& elementName,
bool excludeNullElements)
const
2054 if (excludeNullElements) {
2058 excludeNullElements,
2072 d_handle_p, &fldt, 0, elementName.
impl()));
2099 *buffer = tmp ? true :
false;
2131 d_handle_p, buffer, index);
2138 const char *buffer = 0;
2150 const char *buffer = 0;
2153 d_handle_p, &buffer, &length, index);
2155 result->
assign(buffer, length);
2165 d_handle_p, &buffer->d_handle_p, index);
2175 *buffer =
Name(tmpName);
2231 const char *tmpStringBuffer = 0;
2233 d_handle_p, &tmpStringBuffer, index));
2234 return tmpStringBuffer;
2257 return Name(nameValue);
2275 return getElement(elementName).getValueAsBool();
2285 return getElement(elementName).getValueAsChar();
2295 return getElement(elementName).getValueAsInt32();
2305 return getElement(elementName).getValueAsInt64();
2315 return getElement(elementName).getValueAsFloat32();
2325 return getElement(elementName).getValueAsFloat64();
2335 return getElement(elementName).getValueAsDatetime();
2345 return getElement(elementName).getValueAsString();
2350 return getElement(elementName).getValueAsBytes();
2360 return getElement(elementName).getValueAsName();
2366 std::ostream& stream,
int level,
int spacesPerLevel)
const
2378 std::ostringstream stream;
2381 return stream.str();
2396 element.
print(stream, 0, -1);
Provide functions for dispatchtbl.
#define BLPAPI_CALL_ELEMENT_GETVALUEASHIGHPRECISIONDATETIME(a1, a2, a3)
Definition blpapi_call.h:403
#define BLPAPI_CALL_ELEMENT_SETELEMENTHIGHPRECISIONDATETIME(a1, a2, a3, a4)
Definition blpapi_call.h:401
#define BLPAPI_CALL_ELEMENT_SETVALUEHIGHPRECISIONDATETIME(a1, a2, a3)
Definition blpapi_call.h:399
#define BLPAPI_CALL(FUNCNAME)
Definition blpapi_call.h:353
Represents a date and/or time.
Common definitions used by the library.
#define BLPAPI_EXPORT
Definition blpapi_defs.h:172
#define BLPAPI_ELEMENT_INDEX_END
Definition blpapi_defs.h:97
BLPAPI_EXPORT int blpapi_Element_setValueHighPrecisionDatetime(blpapi_Element_t *element, const blpapi_HighPrecisionDatetime_t *value, size_t index)
BLPAPI_EXPORT int blpapi_Element_getValueAsInt32(const blpapi_Element_t *element, blpapi_Int32_t *buffer, size_t index)
BLPAPI_EXPORT int blpapi_Element_setValueFromName(blpapi_Element_t *element, const blpapi_Name_t *value, size_t index)
BLPAPI_EXPORT int blpapi_Element_datatype(const blpapi_Element_t *element)
BLPAPI_EXPORT int blpapi_Element_setElementHighPrecisionDatetime(blpapi_Element_t *element, const char *nameString, const blpapi_Name_t *name, const blpapi_HighPrecisionDatetime_t *value)
BLPAPI_EXPORT blpapi_Name_t * blpapi_Element_name(const blpapi_Element_t *element)
BLPAPI_EXPORT int blpapi_Element_setValueFromElement(blpapi_Element_t *element, blpapi_Element_t *value, size_t index)
BLPAPI_EXPORT int blpapi_Element_setElementFromField(blpapi_Element_t *element, const char *nameString, const blpapi_Name_t *name, blpapi_Element_t *sourcebuffer)
BLPAPI_EXPORT int blpapi_Element_setElementFromName(blpapi_Element_t *element, const char *elementName, const blpapi_Name_t *name, const blpapi_Name_t *buffer)
BLPAPI_EXPORT int blpapi_Element_appendElement(blpapi_Element_t *element, blpapi_Element_t **appendedElement)
BLPAPI_EXPORT size_t blpapi_Element_numValues(const blpapi_Element_t *element)
BLPAPI_EXPORT int blpapi_Element_getValueAsFloat64(const blpapi_Element_t *element, blpapi_Float64_t *buffer, size_t index)
BLPAPI_EXPORT int blpapi_Element_setValueString(blpapi_Element_t *element, const char *value, size_t index)
BLPAPI_EXPORT int blpapi_Element_isReadOnly(const blpapi_Element_t *element)
BLPAPI_EXPORT int blpapi_Element_setElementInt32(blpapi_Element_t *element, const char *nameString, const blpapi_Name_t *name, blpapi_Int32_t value)
BLPAPI_EXPORT size_t blpapi_Element_numElements(const blpapi_Element_t *element)
BLPAPI_EXPORT int blpapi_Element_setValueInt32(blpapi_Element_t *element, blpapi_Int32_t value, size_t index)
BLPAPI_EXPORT const char * blpapi_Element_nameString(const blpapi_Element_t *element)
BLPAPI_EXPORT int blpapi_Element_setElementChar(blpapi_Element_t *element, const char *nameString, const blpapi_Name_t *name, blpapi_Char_t value)
BLPAPI_EXPORT int blpapi_Element_getElement(const blpapi_Element_t *element, blpapi_Element_t **result, const char *nameString, const blpapi_Name_t *name)
BLPAPI_EXPORT int blpapi_Element_setValueFloat32(blpapi_Element_t *element, blpapi_Float32_t value, size_t index)
BLPAPI_EXPORT int blpapi_Element_setValueBytes(blpapi_Element_t *element, const char *value, size_t length, size_t index)
BLPAPI_EXPORT int blpapi_Element_isNull(const blpapi_Element_t *element)
BLPAPI_EXPORT int blpapi_Element_setElementBytes(blpapi_Element_t *element, const char *nameString, const blpapi_Name_t *name, const char *value, size_t length)
BLPAPI_EXPORT int blpapi_Element_isComplexType(const blpapi_Element_t *element)
BLPAPI_EXPORT int blpapi_Element_getValueAsString(const blpapi_Element_t *element, const char **buffer, size_t index)
BLPAPI_EXPORT int blpapi_Element_setValueChar(blpapi_Element_t *element, blpapi_Char_t value, size_t index)
BLPAPI_EXPORT int blpapi_Element_getValueAsDatetime(const blpapi_Element_t *element, blpapi_Datetime_t *buffer, size_t index)
BLPAPI_EXPORT int blpapi_Element_setElementString(blpapi_Element_t *element, const char *nameString, const blpapi_Name_t *name, const char *value)
BLPAPI_EXPORT int blpapi_Element_setValueBool(blpapi_Element_t *element, blpapi_Bool_t value, size_t index)
BLPAPI_EXPORT int blpapi_Element_getValueAsChar(const blpapi_Element_t *element, blpapi_Char_t *buffer, size_t index)
BLPAPI_EXPORT int blpapi_Element_getElementAt(const blpapi_Element_t *element, blpapi_Element_t **result, size_t position)
BLPAPI_EXPORT int blpapi_Element_getValueAsBool(const blpapi_Element_t *element, blpapi_Bool_t *buffer, size_t index)
BLPAPI_EXPORT int blpapi_Element_setElementInt64(blpapi_Element_t *element, const char *nameString, const blpapi_Name_t *name, blpapi_Int64_t value)
BLPAPI_EXPORT int blpapi_Element_getValueAsFloat32(const blpapi_Element_t *element, blpapi_Float32_t *buffer, size_t index)
BLPAPI_EXPORT int blpapi_Element_hasElementEx(const blpapi_Element_t *element, const char *nameString, const blpapi_Name_t *name, int excludeNullElements, int reserved)
BLPAPI_EXPORT int blpapi_Element_setElementBool(blpapi_Element_t *element, const char *nameString, const blpapi_Name_t *name, blpapi_Bool_t value)
BLPAPI_EXPORT int blpapi_Element_setValueInt64(blpapi_Element_t *element, blpapi_Int64_t value, size_t index)
BLPAPI_EXPORT int blpapi_Element_isArray(const blpapi_Element_t *element)
BLPAPI_EXPORT int blpapi_Element_getChoice(const blpapi_Element_t *element, blpapi_Element_t **result)
BLPAPI_EXPORT int blpapi_Element_setElementFloat64(blpapi_Element_t *element, const char *nameString, const blpapi_Name_t *name, blpapi_Float64_t value)
BLPAPI_EXPORT int blpapi_Element_print(const blpapi_Element_t *element, blpapi_StreamWriter_t streamWriter, void *stream, int level, int spacesPerLevel)
BLPAPI_EXPORT int blpapi_Element_setElementDatetime(blpapi_Element_t *element, const char *nameString, const blpapi_Name_t *name, const blpapi_Datetime_t *value)
BLPAPI_EXPORT int blpapi_Element_getValueAsElement(const blpapi_Element_t *element, blpapi_Element_t **buffer, size_t index)
BLPAPI_EXPORT blpapi_SchemaElementDefinition_t * blpapi_Element_definition(const blpapi_Element_t *element)
BLPAPI_EXPORT int blpapi_Element_hasElement(const blpapi_Element_t *element, const char *nameString, const blpapi_Name_t *name)
BLPAPI_EXPORT int blpapi_Element_getValueAsHighPrecisionDatetime(const blpapi_Element_t *element, blpapi_HighPrecisionDatetime_t *buffer, size_t index)
BLPAPI_EXPORT int blpapi_Element_getValueAsName(const blpapi_Element_t *element, blpapi_Name_t **buffer, size_t index)
BLPAPI_EXPORT int blpapi_Element_getValueAsInt64(const blpapi_Element_t *element, blpapi_Int64_t *buffer, size_t index)
BLPAPI_EXPORT int blpapi_Element_setChoice(blpapi_Element_t *element, blpapi_Element_t **resultElement, const char *nameCstr, const blpapi_Name_t *name, size_t index)
BLPAPI_EXPORT int blpapi_Element_setValueFloat64(blpapi_Element_t *element, blpapi_Float64_t value, size_t index)
BLPAPI_EXPORT int blpapi_Element_setElementFloat32(blpapi_Element_t *element, const char *nameString, const blpapi_Name_t *name, blpapi_Float32_t value)
BLPAPI_EXPORT int blpapi_Element_getValueAsBytes(const blpapi_Element_t *element, const char **buffer, size_t *length, size_t index)
BLPAPI_EXPORT int blpapi_Element_fromJson(const blpapi_Element_t *element, char const *json)
BLPAPI_EXPORT int blpapi_Element_isNullValue(const blpapi_Element_t *element, size_t position)
BLPAPI_EXPORT int blpapi_Element_setValueDatetime(blpapi_Element_t *element, const blpapi_Datetime_t *value, size_t index)
BLPAPI_EXPORT int blpapi_Element_toJson(const blpapi_Element_t *element, blpapi_StreamWriter_t streamWriter, void *stream)
Defines Exceptions that can be thrown by the blpapi library.
Provide a representation of strings for use as container keys.
Provide a representation of a schema describing structured messages.
A signature for callback on print and default C++ implementation.
int(* blpapi_StreamWriter_t)(const char *data, int length, void *stream)
Definition blpapi_streamproxy.h:53
int blpapi_Bool_t
Definition blpapi_types.h:62
char blpapi_Char_t
Definition blpapi_types.h:63
float blpapi_Float32_t
Definition blpapi_types.h:71
long long blpapi_Int64_t
Definition blpapi_types.h:69
int blpapi_Int32_t
Definition blpapi_types.h:67
double blpapi_Float64_t
Definition blpapi_types.h:72
Definition blpapi_types.h:312
void assign(pointer ptr, size_type length) noexcept
Definition blpapi_types.h:496
Definition blpapi_datetime.h:245
blpapi_HighPrecisionDatetime_t & rawHighPrecisionValue()
Definition blpapi_datetime.h:1954
Definition blpapi_element.h:473
BLPAPI_DEPRECATE_STRING_NAME Datetime getElementAsDatetime(const char *name) const
Definition blpapi_element.h:2328
Name name() const
Definition blpapi_element.h:1943
void rebind(blpapi_Element_t *element)
Definition blpapi_element.h:1640
int getValueAs(bool *result, size_t index=0) const
Definition blpapi_element.h:2092
BLPAPI_DEPRECATE_STRING_NAME Element setChoice(const char *selectionName)
Definition blpapi_element.h:1925
Bytes getElementAsBytes(const Name &name) const
Definition blpapi_element.h:2348
bool isNullValue(size_t position=0) const
Definition blpapi_element.h:2030
BLPAPI_DEPRECATE_STRING_NAME int getElement(Element *result, const char *name) const
Definition blpapi_element.h:1948
Float64 getValueAsFloat64(size_t index=0) const
Definition blpapi_element.h:2215
Element getValueAsElement(size_t index=0) const
Definition blpapi_element.h:2244
Name getValueAsName(size_t index=0) const
Definition blpapi_element.h:2252
int datatype() const
Definition blpapi_element.h:1988
BLPAPI_DEPRECATE_STRING_NAME Name getElementAsName(const char *name) const
Definition blpapi_element.h:2353
Int64 getValueAsInt64(size_t index=0) const
Definition blpapi_element.h:2201
Bytes getValueAsBytes(size_t index=0) const
Definition blpapi_element.h:2237
blpapi_Element_t * handle()
Definition blpapi_element.h:1941
BLPAPI_DEPRECATE_STRING_NAME Float64 getElementAsFloat64(const char *name) const
Definition blpapi_element.h:2318
size_t numValues() const
Definition blpapi_element.h:2018
bool isReadOnly() const
Definition blpapi_element.h:2008
BLPAPI_DEPRECATE_STRING_NAME bool hasElement(const char *name, bool excludeNullElements=false) const
Definition blpapi_element.h:2039
void appendValue(bool value)
Definition blpapi_element.h:1856
bool isValid() const
Definition blpapi_element.h:2028
BLPAPI_DEPRECATE_STRING_NAME bool getElementAsBool(const char *name) const
Definition blpapi_element.h:2268
bool getValueAsBool(size_t index=0) const
Definition blpapi_element.h:2180
std::ostream & print(std::ostream &stream, int level=0, int spacesPerLevel=4) const
Definition blpapi_element.h:2365
void setValue(bool value, size_t index=0)
Definition blpapi_element.h:1783
BLPAPI_DEPRECATE_STRING_NAME char getElementAsChar(const char *name) const
Definition blpapi_element.h:2278
Element appendElement()
Definition blpapi_element.h:1917
const char * getValueAsString(size_t index=0) const
Definition blpapi_element.h:2229
bool isComplexType() const
Definition blpapi_element.h:1993
char getValueAsChar(size_t index=0) const
Definition blpapi_element.h:2187
BLPAPI_DEPRECATE_STRING_NAME void setElement(const char *name, bool value)
Definition blpapi_element.h:1645
std::string toJson() const
Definition blpapi_element.h:2376
void fromJson(const char *json)
Definition blpapi_element.h:2384
Element()
Definition blpapi_element.h:1630
Datetime getValueAsDatetime(size_t index=0) const
Definition blpapi_element.h:2222
bool isNull() const
Definition blpapi_element.h:2003
SchemaElementDefinition elementDefinition() const
Definition blpapi_element.h:2013
BLPAPI_DEPRECATE_STRING_NAME Int64 getElementAsInt64(const char *name) const
Definition blpapi_element.h:2298
BLPAPI_DEPRECATE_STRING_NAME Int32 getElementAsInt32(const char *name) const
Definition blpapi_element.h:2288
Element getChoice() const
Definition blpapi_element.h:2260
Float32 getValueAsFloat32(size_t index=0) const
Definition blpapi_element.h:2208
bool isArray() const
Definition blpapi_element.h:1998
Int32 getValueAsInt32(size_t index=0) const
Definition blpapi_element.h:2194
BLPAPI_DEPRECATE_STRING_NAME const char * getElementAsString(const char *name) const
Definition blpapi_element.h:2338
BLPAPI_DEPRECATE_STRING_NAME Float32 getElementAsFloat32(const char *name) const
Definition blpapi_element.h:2308
size_t numElements() const
Definition blpapi_element.h:2023
static void throwOnError(int errorCode)
Definition blpapi_exception.h:526
Definition blpapi_name.h:150
blpapi_Name_t * impl() const
Definition blpapi_name.h:403
Definition blpapi_schema.h:327
struct blpapi_Name blpapi_Name_t
Definition blpapi_types.h:154
struct blpapi_SchemaElementDefinition blpapi_SchemaElementDefinition_t
Definition blpapi_types.h:191
struct blpapi_Element blpapi_Element_t
Definition blpapi_types.h:136
blpapi_Float64_t Float64
Definition blpapi_types.h:474
blpapi_Float32_t Float32
Definition blpapi_types.h:473
blpapi_Int64_t Int64
Definition blpapi_types.h:471
std::ostream & operator<<(std::ostream &os, const CorrelationId &correlator)
Definition blpapi_correlationid.h:649
blpapi_Int32_t Int32
Definition blpapi_types.h:469
Definition blpapi_abstractsession.h:195
static int writeToStream(const char *data, int length, void *stream)
Definition blpapi_streamproxy.h:93
Definition blpapi_datetime.h:102
Definition blpapi_datetime.h:115