BDE 4.14.0 Production release
|
Provide a type to represent a user-defined type.
This component provides a single, simply-constrained (in-core value-semantic) attribute class, bdld::DatumUdt
, that is used to extend the set of possible types that can be held by Datum
objects.
Name | Type | Simple Constraints |
---|---|---|
data_p | void * | none |
type | int | [0 .. 65355] |
data_p
: pointer to an external object/memory.type
: user type associated with the pointer.This component provides a way to extend the set of data types that are natively supported by the Datum
mechanism by allowing the client associate an opaque pointer to user data with the data type information. Note that the bdld::DatumUdt
does not access the pointer nor it interpret the type information supplied at construction time. The client code is responsible for interpretation of the type information and casting the pointer back to the pointer to the actual type.
Accessors inside Datum
class that need to return a user-defined object, return an instance of DatumUdt
.
This section illustrates intended use of this component.
Imagine we are using Datum
within an expression evaluation subsystem. Within that subsystem, along with the set of types defined by Datum::DataType
we also need to hold Sequence
and Choice
types within Datum
values (which are not natively represented by Datum
). First, we define the set of types used by our subsystem that are an extension to the types in DatumType
:
Notice that the numeric values will be provided as the type
attribute to DatumUdt
.
Then we create a Sequence
object, and create a DatumUdt
to hold it (note that we've created the object on the stack for clarity):