BLPAPI C++
3.24.9
|
#include <blpapi_schema.h>
Public Types | |
enum | { UNBOUNDED = -1 } |
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_t * | impl () const |
This class implements the definition of an individual field within a schema type. An element is defined by an identifier/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 contain 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 synchronize 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.
|
explicit |
Destroy this object.
const char * description | ( | ) | const |
Return a null-terminated string containing a human-readable description of this element. This pointer is valid until this SchemaElementDefinition
is destroyed.
Name getAlternateName | ( | size_t | index | ) | const |
Return the specified index
th alternate name for this element. If index >=numAlternateNames()
an exception is thrown.
blpapi_SchemaElementDefinition_t * impl | ( | ) | const |
size_t maxValues | ( | ) | const |
Return the maximum number of occurrences of this element. This value is always greater than or equal to one.
size_t minValues | ( | ) | const |
Return the minimum number of occurrences of this element. This value is always greater than or equal to zero.
Name name | ( | ) | const |
Return the name identifying this element within its containing structure/type.
size_t numAlternateNames | ( | ) | const |
Return the number of alternate names for this element.
std::ostream & 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
).
void 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.
int status | ( | ) | const |
Return the deprecation status, as a SchemaStatus::Value
, of this element.
const SchemaTypeDefinition typeDefinition | ( | ) | const |
Return the type of values contained in this element.
void * 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
.