BLPAPI C++
3.21.0
|
#include <blpapi_constant.h>
Public Member Functions | |
Constant (blpapi_Constant_t *handle) | |
void | setUserData (void *userData) |
Name | name () const |
const char * | description () const |
int | status () const |
int | datatype () const |
int | getValueAs (char *buffer) const |
int | getValueAs (Int32 *buffer) const |
int | getValueAs (Int64 *buffer) const |
int | getValueAs (Float32 *buffer) const |
int | getValueAs (Float64 *buffer) const |
int | getValueAs (Datetime *buffer) const |
int | getValueAs (std::string *buffer) const |
char | getValueAsChar () const |
Int32 | getValueAsInt32 () const |
Int64 | getValueAsInt64 () const |
Float32 | getValueAsFloat32 () const |
Float64 | getValueAsFloat64 () const |
Datetime | getValueAsDatetime () const |
std::string | getValueAsString () const |
void * | userData () const |
const blpapi_Constant_t * | impl () const |
Represents the value of a schema enumeration constant.
Constants can be any of the following DataTypes: BOOL, CHAR, BYTE, INT32, INT64, FLOAT32, FLOAT64, STRING, DATE, TIME, DATETIME. This class provides access to not only the constant value, but also the symbolic name, the description, and the status of the constant. It also provides an interface for associating arbitrary user-defined data (specified as a void*
) with a Constant
.
Constant
objects are read-only, with the exception of a single void*
attribute for storing user data. Constant
objects have reference semantics with respect to this user data field: calling c.setUserData(void*)
modifies the user data associated with c
, as well as that associated with all copies of c
. As a result, functions which set or read this field are NOT per-object thread-safe. Clients must synchronize such operations across all copies of an object.
Application clients need never create fresh Constant
objects directly; applications will typically work with copies of objects returned by other blpapi
components.
Constant | ( | blpapi_Constant_t * | handle | ) |
int datatype | ( | ) | const |
Return the data type used to represent the value of this constant as an integer specified by the blpapi_DataType_t
enumeration defined in blpapi_types.h
.
const char * description | ( | ) | const |
int getValueAs | ( | char * | buffer | ) | const |
int getValueAs | ( | Int32 * | buffer | ) | const |
int getValueAs | ( | Int64 * | buffer | ) | const |
int getValueAs | ( | Float32 * | buffer | ) | const |
int getValueAs | ( | Float64 * | buffer | ) | const |
int getValueAs | ( | Datetime * | buffer | ) | const |
int getValueAs | ( | std::string * | buffer | ) | const |
char getValueAsChar | ( | ) | const |
Return the value of this object as a char
. If the value is not a char
an exception is thrown.
Datetime getValueAsDatetime | ( | ) | const |
float getValueAsFloat32 | ( | ) | const |
Return the value of this object as a Float32
. If the value is not a Float32
an exception is thrown.
double getValueAsFloat64 | ( | ) | const |
Return the value of this object as a Float64
. If the value is not a Float64
an exception is thrown.
Int32 getValueAsInt32 | ( | ) | const |
Return the value of this object as an Int32
. If the value is not an Int32
an exception is thrown.
Int64 getValueAsInt64 | ( | ) | const |
Return the value of this object as an Int64
. If the value is not an Int64
an exception is thrown.
std::string getValueAsString | ( | ) | const |
Return the value of this object as a std::string
. If the value is not a std::string
an exception is thrown.
const blpapi_Constant_t * impl | ( | ) | const |
void setUserData | ( | void * | userData | ) |
Set the user data associated with this Constant
– and all copies of this Constant
– to the specified userData
. Clients are responsible for synchronizing calls to this function, and to userData()
, across all copies of this Constant
object.
int status | ( | ) | const |
Return the status, as a SchemaStatus::Value
, of this Constant
.
void * userData | ( | ) | const |
Return the user data associated with this Constant
. If no user data has been associated with this Constant
then return 0. Clients are responsible for synchronizing calls to this function with calls to setUserData(void*)
made on not only this Constant
, but also all copies of this Constant
. Note that Constant
objects have reference semantics: this function will reflect the last value set on any copy of this Constant
.