Public Types | Public Member Functions

blpapi::SchemaElementDefinition Class Reference

#include <blpapi_schema.h>

List of all members.

Public Types

enum  { UNBOUNDED = BLPAPI_ELEMENTDEFINITION_UNBOUNDED }

Public Member Functions

 SchemaElementDefinition (blpapi_SchemaElementDefinition_t *handle)
 ~SchemaElementDefinition ()
void setUserData (void *userData)
Name name () const
const char * description () const
int status () const
const SchemaTypeDefinition typeDefinition () const
size_t minValues () const
size_t maxValues () const
size_t numAlternateNames () const
Name getAlternateName (size_t index) const
void * userData () const
std::ostream & print (std::ostream &stream, int level=0, int spacesPerLevel=4) const
blpapi_SchemaElementDefinition_timpl () const

Detailed Description

This class implements the definition of an individual field within a schema type. An element is defined by an identifer/name, a type, and the number of values of that type that may be associated with the identifier/name. In addition, this class offers access to metadata providing a description and deprecation status for the field. Finally, SchemaElementDefinition provides an interface for associating arbitrary user-defined data (specified as a void*) with an element definition.

SchemaElementDefinition objects are returned by Service and Operation objects to define the content of requests, replies and events. The SchemaTypeDefinition returned by SchemaElementDefinition::typeDefinition() may itself provide access to SchemaElementDefinition objects when the schema contains nested elements. (See the SchemaTypeDefinition documentation for more information on complex types.)

An optional element has minValues() == 0.

A mandatory element has minValues() >= 1.

An element that must constain a single value has minValues() == maxValues() == 1.

An element containing an array has maxValues() > 1.

An element with no upper limit on the number of values has maxValues() == UNBOUNDED.

SchemaElementDefinition objects are read-only, with the exception of a single void* attribute for storing user data. SchemaElementDefinition 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 SchemaElementDefinition objects directly; applications will typically work with copies of objects returned by other blpapi components.


Member Enumeration Documentation

anonymous enum
Enumerator:
UNBOUNDED 

Indicates an array has an unbounded number of values.


Constructor & Destructor Documentation

blpapi::SchemaElementDefinition::SchemaElementDefinition ( blpapi_SchemaElementDefinition_t handle  ) 
blpapi::SchemaElementDefinition::~SchemaElementDefinition (  ) 

Destroy this object.


Member Function Documentation

void blpapi::SchemaElementDefinition::setUserData ( void *  userData  ) 

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

Name blpapi::SchemaElementDefinition::name (  )  const

Return the name identifying this element within its containing structure/type.

const char* blpapi::SchemaElementDefinition::description (  )  const

Return a null-terminated string containing a human-readable description of this element. This pointer is valid until this SchemaElementDefinition is destroyed.

int blpapi::SchemaElementDefinition::status (  )  const

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

const SchemaTypeDefinition blpapi::SchemaElementDefinition::typeDefinition (  )  const

Return the type of values contained in this element.

size_t blpapi::SchemaElementDefinition::minValues (  )  const

Return the minimum number of occurrences of this element. This value is always greater than or equal to zero.

size_t blpapi::SchemaElementDefinition::maxValues (  )  const

Return the maximum number of occurrences of this element. This value is always greater than or equal to one.

size_t blpapi::SchemaElementDefinition::numAlternateNames (  )  const

Return the number of alternate names for this element.

Name blpapi::SchemaElementDefinition::getAlternateName ( size_t  index  )  const

Return the specified indexth alternate name for this element. If index >=numAlternateNames() an exception is thrown.

void* blpapi::SchemaElementDefinition::userData (  )  const

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

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

Format this SchemaElementDefinition 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).

blpapi_SchemaElementDefinition_t* blpapi::SchemaElementDefinition::impl (  )  const

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