BLPAPI C++  3.24.10
Constant Class Reference

#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_timpl () const
 

Detailed Description

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.

See Component blpapi_constant

Constructor & Destructor Documentation

◆ Constant()

Constant ( blpapi_Constant_t handle)
explicit

Member Function Documentation

◆ datatype()

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.

◆ description()

const char * description ( ) const

Return a null-terminated string containing a human-readable description of this Constant. The returned pointer remains valid until this Constant is destroyed.

◆ getValueAs() [1/7]

int getValueAs ( char *  buffer) const

Load the char value of this Constant into the specified buffer and return 0; if this Constant is not a char then return a nonzero value and leave buffer unchanged.

◆ getValueAs() [2/7]

int getValueAs ( Int32 buffer) const

Load the Int32 value of this Constant into the specified buffer and return 0; if this Constant is not an Int32 then return a nonzero value and leave buffer unchanged.

◆ getValueAs() [3/7]

int getValueAs ( Int64 buffer) const

Load the Int64 value of this Constant into the specified buffer and return 0; if this Constant is not an Int64 then return a nonzero value and leave buffer unchanged.

◆ getValueAs() [4/7]

int getValueAs ( Float32 buffer) const

Load the Float32 value of this Constant into the specified buffer and return 0; if this Constant is not a Float32 then return a nonzero value and leave buffer unchanged.

◆ getValueAs() [5/7]

int getValueAs ( Float64 buffer) const

Load the Float64 value of this Constant into the specified buffer and return 0; if this Constant is not a Float64 then return a nonzero value and leave buffer unchanged.

◆ getValueAs() [6/7]

int getValueAs ( Datetime buffer) const

Load the Datetime value of this Constant into the specified buffer and return 0; if this Constant is not a Datetime then return a nonzero value and leave buffer unchanged.

◆ getValueAs() [7/7]

int getValueAs ( std::string *  buffer) const

Load the std::string value of this Constant into the specified buffer and return 0; if this Constant is not a std::string then return a nonzero value and leave buffer unchanged.

◆ getValueAsChar()

char getValueAsChar ( ) const

Return the value of this object as a char. If the value is not a char an exception is thrown.

◆ getValueAsDatetime()

Datetime getValueAsDatetime ( ) const

Return the value of this object as a Datetime. If the value is not a Datetime an exception is thrown.

◆ getValueAsFloat32()

float getValueAsFloat32 ( ) const

Return the value of this object as a Float32. If the value is not a Float32 an exception is thrown.

◆ getValueAsFloat64()

double getValueAsFloat64 ( ) const

Return the value of this object as a Float64. If the value is not a Float64 an exception is thrown.

◆ getValueAsInt32()

Int32 getValueAsInt32 ( ) const

Return the value of this object as an Int32. If the value is not an Int32 an exception is thrown.

◆ getValueAsInt64()

Int64 getValueAsInt64 ( ) const

Return the value of this object as an Int64. If the value is not an Int64 an exception is thrown.

◆ getValueAsString()

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.

◆ impl()

const blpapi_Constant_t * impl ( ) const

◆ name()

Name name ( ) const

Return the symbolic name of this Constant.

◆ setUserData()

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.

◆ status()

int status ( ) const

Return the status, as a SchemaStatus::Value, of this Constant.

◆ userData()

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.


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