Public Member Functions

blpapi::SchemaTypeDefinition Class Reference

#include <blpapi_schema.h>

List of all members.

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 syncrhonize 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.


Constructor & Destructor Documentation

blpapi::SchemaTypeDefinition::SchemaTypeDefinition ( blpapi_SchemaTypeDefinition_t handle  ) 
blpapi::SchemaTypeDefinition::~SchemaTypeDefinition (  ) 

Destroy this object.


Member Function Documentation

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

int blpapi::SchemaTypeDefinition::datatype (  )  const

Return the DataType of this SchemaTypeDefinition.

Name blpapi::SchemaTypeDefinition::name (  )  const

Return the name of this SchemaTypeDefinition.

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

int blpapi::SchemaTypeDefinition::status (  )  const

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

size_t blpapi::SchemaTypeDefinition::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.

bool blpapi::SchemaTypeDefinition::isComplexType (  )  const

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

bool blpapi::SchemaTypeDefinition::isSimpleType (  )  const

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

bool blpapi::SchemaTypeDefinition::isEnumerationType (  )  const

Return true if this SchemaTypeDefinition represents an enumeration type.

bool blpapi::SchemaTypeDefinition::hasElementDefinition ( const Name name  )  const

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

bool blpapi::SchemaTypeDefinition::hasElementDefinition ( const char *  name  )  const

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

SchemaElementDefinition blpapi::SchemaTypeDefinition::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.

SchemaElementDefinition blpapi::SchemaTypeDefinition::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.

SchemaElementDefinition blpapi::SchemaTypeDefinition::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.

const ConstantList blpapi::SchemaTypeDefinition::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.

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

std::ostream& blpapi::SchemaTypeDefinition::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).


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