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;
1103 int getValueAs(
bool *result,
size_t index = 0)
const;
1112 int getValueAs(
char *result,
size_t index = 0)
const;
1169 int getValueAs(std::string *result,
size_t index = 0)
const;
1386 const char *
name)
const;
1407 const char *
name)
const;
1428 const char *
name)
const;
1449 const char *
name)
const;
1470 const char *
name)
const;
1498 const char *
name)
const;
1558 std::ostream&
print(
1559 std::ostream& stream,
int level = 0,
int spacesPerLevel = 4)
const;
1573 std::string
toJson()
const;
1590 void fromJson(
const std::string& json);
1634 : d_handle_p(newHandle)
1640 d_handle_p = element;
1646 d_handle_p, elementName, 0, value ? 1 : 0));
1670 d_handle_p, elementName, 0, value));
1676 d_handle_p, elementName, 0, value));
1691 d_handle_p, elementName, 0, value));
1697 d_handle_p, elementName, 0, value.
impl()));
1703 d_handle_p, 0, elementName.
impl(), value ? 1 : 0));
1709 d_handle_p, 0, elementName.
impl(), value));
1715 d_handle_p, 0, elementName.
impl(), value));
1721 d_handle_p, 0, elementName.
impl(), value));
1727 d_handle_p, 0, elementName.
impl(), value));
1733 d_handle_p, 0, elementName.
impl(), value));
1748 d_handle_p, 0, elementName.
impl(), value));
1752 const Name& elementName,
const std::string& value)
1760 d_handle_p, 0, elementName.
impl(), value.
impl()));
1764 const Name& elementName,
const void *value,
size_t length)
1770 reinterpret_cast<const char *
>(value),
1774template <
typename BYTES,
1775 typename std::enable_if<IsByteSequence<BYTES>::value,
bool>::type>
1778 setElement(elementName, value.data(), value.size());
1838 d_handle_p, valueName.
impl(), index));
1844 d_handle_p,
reinterpret_cast<const char *
>(value), length, index));
1847template <
typename BYTES,
1848 typename std::enable_if<IsByteSequence<BYTES>::value,
bool>::type>
1851 setValue(value.data(), value.size(), index);
1920 return Element(appendedElement);
1927 d_handle_p, &resultElement, selectionName, 0, 0));
1928 return Element(resultElement);
1935 d_handle_p, &resultElement, 0, selectionName.
impl(), 0));
1936 return Element(resultElement);
1965 d_handle_p, &fldt, 0, elementName.
impl());
2031 if (rc != 0 && rc != 1) {
2034 return rc ? true :
false;
2038 const char *nameString,
bool excludeNullElements)
const
2040 if (excludeNullElements) {
2042 d_handle_p, nameString, 0, excludeNullElements, 0)
2050 const Name& elementName,
bool excludeNullElements)
const
2052 if (excludeNullElements) {
2056 excludeNullElements,
2070 d_handle_p, &fldt, 0, elementName.
impl()));
2097 *buffer = tmp ? true :
false;
2129 d_handle_p, buffer, index);
2136 const char *buffer = 0;
2148 const char *buffer = 0;
2151 d_handle_p, &buffer, &length, index);
2153 result->
assign(buffer, length);
2163 d_handle_p, &buffer->d_handle_p, index);
2173 *buffer =
Name(tmpName);
2229 const char *tmpStringBuffer = 0;
2231 d_handle_p, &tmpStringBuffer, index));
2232 return tmpStringBuffer;
2255 return Name(nameValue);
2273 return getElement(elementName).getValueAsBool();
2283 return getElement(elementName).getValueAsChar();
2293 return getElement(elementName).getValueAsInt32();
2303 return getElement(elementName).getValueAsInt64();
2313 return getElement(elementName).getValueAsFloat32();
2323 return getElement(elementName).getValueAsFloat64();
2333 return getElement(elementName).getValueAsDatetime();
2343 return getElement(elementName).getValueAsString();
2348 return getElement(elementName).getValueAsBytes();
2358 return getElement(elementName).getValueAsName();
2364 std::ostream& stream,
int level,
int spacesPerLevel)
const
2376 std::ostringstream stream;
2379 return stream.str();
2394 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:2326
Name name() const
Definition blpapi_element.h:1941
void rebind(blpapi_Element_t *element)
Definition blpapi_element.h:1638
int getValueAs(bool *result, size_t index=0) const
Definition blpapi_element.h:2090
BLPAPI_DEPRECATE_STRING_NAME Element setChoice(const char *selectionName)
Definition blpapi_element.h:1923
Bytes getElementAsBytes(const Name &name) const
Definition blpapi_element.h:2346
bool isNullValue(size_t position=0) const
Definition blpapi_element.h:2028
BLPAPI_DEPRECATE_STRING_NAME int getElement(Element *result, const char *name) const
Definition blpapi_element.h:1946
Float64 getValueAsFloat64(size_t index=0) const
Definition blpapi_element.h:2213
Element getValueAsElement(size_t index=0) const
Definition blpapi_element.h:2242
Name getValueAsName(size_t index=0) const
Definition blpapi_element.h:2250
int datatype() const
Definition blpapi_element.h:1986
BLPAPI_DEPRECATE_STRING_NAME Name getElementAsName(const char *name) const
Definition blpapi_element.h:2351
Int64 getValueAsInt64(size_t index=0) const
Definition blpapi_element.h:2199
Bytes getValueAsBytes(size_t index=0) const
Definition blpapi_element.h:2235
blpapi_Element_t * handle()
Definition blpapi_element.h:1939
BLPAPI_DEPRECATE_STRING_NAME Float64 getElementAsFloat64(const char *name) const
Definition blpapi_element.h:2316
size_t numValues() const
Definition blpapi_element.h:2016
bool isReadOnly() const
Definition blpapi_element.h:2006
BLPAPI_DEPRECATE_STRING_NAME bool hasElement(const char *name, bool excludeNullElements=false) const
Definition blpapi_element.h:2037
void appendValue(bool value)
Definition blpapi_element.h:1854
bool isValid() const
Definition blpapi_element.h:2026
BLPAPI_DEPRECATE_STRING_NAME bool getElementAsBool(const char *name) const
Definition blpapi_element.h:2266
bool getValueAsBool(size_t index=0) const
Definition blpapi_element.h:2178
std::ostream & print(std::ostream &stream, int level=0, int spacesPerLevel=4) const
Definition blpapi_element.h:2363
void setValue(bool value, size_t index=0)
Definition blpapi_element.h:1781
BLPAPI_DEPRECATE_STRING_NAME char getElementAsChar(const char *name) const
Definition blpapi_element.h:2276
Element appendElement()
Definition blpapi_element.h:1915
const char * getValueAsString(size_t index=0) const
Definition blpapi_element.h:2227
bool isComplexType() const
Definition blpapi_element.h:1991
char getValueAsChar(size_t index=0) const
Definition blpapi_element.h:2185
BLPAPI_DEPRECATE_STRING_NAME void setElement(const char *name, bool value)
Definition blpapi_element.h:1643
std::string toJson() const
Definition blpapi_element.h:2374
void fromJson(const char *json)
Definition blpapi_element.h:2382
Element()
Definition blpapi_element.h:1628
Datetime getValueAsDatetime(size_t index=0) const
Definition blpapi_element.h:2220
bool isNull() const
Definition blpapi_element.h:2001
SchemaElementDefinition elementDefinition() const
Definition blpapi_element.h:2011
BLPAPI_DEPRECATE_STRING_NAME Int64 getElementAsInt64(const char *name) const
Definition blpapi_element.h:2296
BLPAPI_DEPRECATE_STRING_NAME Int32 getElementAsInt32(const char *name) const
Definition blpapi_element.h:2286
Element getChoice() const
Definition blpapi_element.h:2258
Float32 getValueAsFloat32(size_t index=0) const
Definition blpapi_element.h:2206
bool isArray() const
Definition blpapi_element.h:1996
Int32 getValueAsInt32(size_t index=0) const
Definition blpapi_element.h:2192
BLPAPI_DEPRECATE_STRING_NAME const char * getElementAsString(const char *name) const
Definition blpapi_element.h:2336
BLPAPI_DEPRECATE_STRING_NAME Float32 getElementAsFloat32(const char *name) const
Definition blpapi_element.h:2306
size_t numElements() const
Definition blpapi_element.h:2021
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:647
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