Public Member Functions

blpapi::Constant Class Reference

#include <blpapi_constant.h>

List of all members.

Public Member Functions

 Constant (blpapi_Constant_t *handle)
 Constant (const Constant &original)
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 syncrhonize 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.


Constructor & Destructor Documentation

blpapi::Constant::Constant ( blpapi_Constant_t handle  ) 
blpapi::Constant::Constant ( const Constant original  ) 

Create a Constant object having the same value as the specified original. Note that this function does not require cross-object thread synchronization, as it does not directly read or modify the userData field.


Member Function Documentation

void blpapi::Constant::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.

Name blpapi::Constant::name (  )  const

Return the symbolic name of this Constant.

const char* blpapi::Constant::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.

int blpapi::Constant::status (  )  const

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

int blpapi::Constant::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.

int blpapi::Constant::getValueAs ( char *  buffer  )  const

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

int blpapi::Constant::getValueAs ( Int32 buffer  )  const

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

int blpapi::Constant::getValueAs ( Int64 buffer  )  const

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

int blpapi::Constant::getValueAs ( Float32 buffer  )  const

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

int blpapi::Constant::getValueAs ( Float64 buffer  )  const

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

int blpapi::Constant::getValueAs ( Datetime buffer  )  const

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

int blpapi::Constant::getValueAs ( std::string *  buffer  )  const

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

char blpapi::Constant::getValueAsChar (  )  const

Return the value of this object as a char. If the value cannot be converted to a char an exception is thrown.

Int32 blpapi::Constant::getValueAsInt32 (  )  const

Return the value of this object as an Int32. If the value cannot be converted to an Int32 an exception is thrown.

Int64 blpapi::Constant::getValueAsInt64 (  )  const

Return the value of this object as an Int64. If the value cannot be converted to an Int64 an exception is thrown.

Float32 blpapi::Constant::getValueAsFloat32 (  )  const

Return the value of this object as a Float32. If the value cannot be converted to a Float32 an exception is thrown.

Float64 blpapi::Constant::getValueAsFloat64 (  )  const

Return the value of this object as a Float64. If the value cannot be converted to a Float64 an exception is thrown.

Datetime blpapi::Constant::getValueAsDatetime (  )  const

Return the value of this object as a Datetime. If the value cannot be converted to a Datetime an exception is thrown.

std::string blpapi::Constant::getValueAsString (  )  const

Return the value of this object as a std::string. If the value cannot be converted to a std::string an exception is thrown.

void* blpapi::Constant::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.

const blpapi_Constant_t* blpapi::Constant::impl (  )  const

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