BLPAPI C++  3.24.8
SchemaTypeDefinition Class Reference

#include <blpapi_schema.h>

Public Member Functions

 SchemaTypeDefinition (blpapi_SchemaTypeDefinition_t *handle)
 
 ~SchemaTypeDefinition ()
 
void setUserData (void *userData)
 
int datatype () const
 
Name name () const
 
const char * description () const
 
int status () const
 
size_t numElementDefinitions () const
 
bool isComplexType () const
 
bool isSimpleType () const
 
bool isEnumerationType () const
 
bool hasElementDefinition (const Name &name) const
 
bool hasElementDefinition (const char *name) const
 
SchemaElementDefinition getElementDefinition (const Name &name) const
 
SchemaElementDefinition getElementDefinition (const char *nameString) const
 
SchemaElementDefinition getElementDefinition (size_t index) const
 
const ConstantList enumeration () const
 
void * userData () const
 
std::ostream & print (std::ostream &stream, int level=0, int spacesPerLevel=4) const
 

Detailed Description

This class implements a representation of a "type" that can be used within a schema, including both simple atomic types (integers, dates, strings, etc.) as well as "complex" types defined a sequences of or choice among a collection (named) elements, each of which is in turn described by another type. In addition to accessors for the type's structure, this class also offers access to metadata providing a description and deprecation status for the type. Finally, SchemaTypeDefinition provides an interface for associating arbitrary user-defined data (specified as a void*) with a type definition.

Each SchemaElementDefinition object is associated with a single SchemaTypeDefinition; one SchemaTypeDefinition may be used by zero, one, or many SchemaElementDefinition objects.

SchemaTypeDefinition objects are read-only, with the exception of a single void* attribute for storing user data. SchemaTypeDefinition 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 attribute are NOT per-object thread-safe. Clients must synchronize such operations across all copies of an object.

Application clients need never create fresh SchemaTypeDefinition objects directly; applications will typically work with copies of objects returned by other blpapi components.

See Component blpapi_schema

Constructor & Destructor Documentation

◆ SchemaTypeDefinition()

◆ ~SchemaTypeDefinition()

Destroy this object.

Member Function Documentation

◆ datatype()

int datatype ( ) const

Return the DataType of this SchemaTypeDefinition 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 which contains a human readable description of this SchemaTypeDefinition. The returned pointer remains valid until this SchemaTypeDefinition is destroyed.

◆ enumeration()

const ConstantList enumeration ( ) const

Return a ConstantList containing all possible values of the enumeration defined by this type. The behavior of this function is undefined unless isEnumerationType() == true.

◆ getElementDefinition() [1/3]

SchemaElementDefinition getElementDefinition ( const Name name) const

Return the definition of the element identified by the specified name. If hasElementDefinition(name) != true then an exception is thrown.

◆ getElementDefinition() [2/3]

SchemaElementDefinition getElementDefinition ( const char *  nameString) const

Return the definition of the element identified by the specified nameString. If hasElementDefinition(nameString) != true then an exception is thrown.

◆ getElementDefinition() [3/3]

SchemaElementDefinition getElementDefinition ( size_t  index) const

Return the definition of the element a the specified index in the sequence of elements. If index >= numElementDefinitions() an exception is thrown.

◆ hasElementDefinition() [1/2]

bool hasElementDefinition ( const Name name) const

Return true if this SchemaTypeDefinition contains an element with the specified name; otherwise returns false.

◆ hasElementDefinition() [2/2]

bool hasElementDefinition ( const char *  name) const

Return true if this SchemaTypeDefinition contains an element with the specified name; otherwise returns false.

◆ isComplexType()

bool isComplexType ( ) const

Return true if this SchemaTypeDefinition represents a sequence or choice type.

◆ isEnumerationType()

bool isEnumerationType ( ) const

Return true if this SchemaTypeDefinition represents an enumeration type.

◆ isSimpleType()

bool isSimpleType ( ) const

Return true if this SchemaTypeDefinition represents neither a sequence nor a choice type.

◆ name()

Name name ( ) const

Return the name of this SchemaTypeDefinition.

◆ numElementDefinitions()

size_t numElementDefinitions ( ) const

Return the number of SchemaElementDefinition objects contained by this SchemaTypeDefinition. If this SchemaTypeDefinition is neither a choice nor a sequence this will return 0.

◆ print()

std::ostream & print ( std::ostream &  stream,
int  level = 0,
int  spacesPerLevel = 4 
) const

Format this SchemaTypeDefinition to the specified output stream at the (absolute value of) the optionally specified indentation level and return a reference to stream. If level is specified, optionally specify spacesPerLevel, the number of spaces per indentation level for this and all of its nested objects. If level is negative, suppress indentation of the first line. If spacesPerLevel is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by level).

◆ setUserData()

void setUserData ( void *  userData)

Set the user data associated with this SchemaTypeDefinition – and all copies of this SchemaTypeDefinition – to the specified userData. Clients are responsible for synchronizing calls to this function, and to userData(), across all copies of this SchemaTypeDefinition object.

◆ status()

int status ( ) const

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

◆ userData()

void * userData ( ) const

Return the user data associated with this SchemaTypeDefinition. If no user data has been associated with this SchemaTypeDefinition then return 0. Clients are responsible for synchronizing calls to this function with calls to setUserData(void*) made on not only this SchemaTypeDefinition, but also all copies of this SchemaTypeDefinition. Note that SchemaTypeDefinition objects have reference semantics: this function will reflect the last value set on any copy of this SchemaTypeDefinition.


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