Space‐efficient discriminated union holding a scalar or aggregate of Datum values.
Synopsis
Declared in <bdld_datum.h>
class Datum;
Description
This class implements a mechanism that provides a space‐efficient discriminated union that holds the value of ether scalar type or an aggregate of Datum objects. The size of Datum is 8 bytes (same as a double) on 32‐bit platforms and 16 bytes on 64‐bit platforms. Separate representation are needed on 32 and 64 bit platforms because of the differing size of a pointer (a 64‐bit pointer cannot reasonably be held in a 32‐bit footprint).
Representation on a 32‐bit Platforms: Values are stored inside an 8‐byte unsigned char array (d_data). Any double value (including NaN and infinity values) can be stored inside Datum. When storing a value of a type other than double, the bits in d_data that correspond to the exponent part of a double value are set to 1, with the 4 bits in the fraction part used to indicate the type of value stored.
Representation on 64‐bit platforms: Values are stored inside a 16 byte unsigned char array (d_data) to store values. The type information is stored in the upper 2 bytes of the character array. Remaining 14 bytes are used to store the actual value or the pointer to the external memory that holds the value.
For details on the internal representations that are used for various types on 32 and 64 bit platforms, please see the implementation notes in bdld_datum.cpp.
Datum objects are bitwise copyable and have trivial initialization, assignment and destruction. Only one of the copies of the same Datum object can be passed to destroy. The rest of those copies then become invalid and it is undefined behavior to deep‐copy or destroy them. Although, these copies can be used on the left hand side of assignment.
Type Aliases
Name |
Description |
This |
|
Unsigned integral type for capacities, key sizes, and string lengths. |
Enums
Name |
Description |
Number of distinct externally exposed datum types. |
|
Enumeration used to discriminate among the different externally‐ exposed types of values that can be stored inside |
Member Functions
Name |
Description |
Invoke |
|
Return a deep copy of this datum using the specified |
|
Return |
|
Return |
|
Return |
|
Return |
|
Return |
|
Return |
|
Return |
|
Return |
|
Return |
|
Return whether this object refers to externally managed data. |
|
Return |
|
Return |
|
Return |
|
Return |
|
Return |
|
Return |
|
Return |
|
Return |
|
Format this object to the specified output stream. |
|
Return the array value held by this object. |
|
Return the binary reference held by this object. |
|
Return the boolean value represented by this object. The behavior is undefined unless this object actually represents a |
|
Return the date value represented by this object as a |
|
Return the datetime value held by this object. |
|
Return the datetime‐interval value held by this object. |
|
Return the Decimal64 value held by this object. |
|
Return the double value held by this object. |
|
Return the error value represented by this object as a |
|
Return the int‐map value held by this object. |
|
Return the integer value represented by this object. The behavior is undefined unless this object actually represents an integer value. |
|
Return the 64‐bit integer value held by this object. |
|
Return the map value represented by this object as a |
|
Return the string value held by this object. |
|
Return the time value represented by this object as a |
|
Return the user‐defined type reference held by this object. |
|
Return the type of value represented by this object as one of the enumeration values defined in |
|
|
Declare nested type traits for this type. |
Static Member Functions
Name |
Description |
Return a datum that takes ownership of the specified |
|
Return a datum that takes ownership of the specified |
|
|
|
DEPRECATED: Use |
|
Return a datum owning a copy of the specified binary |
|
|
|
|
|
Return a datum holding the specified boolean |
|
Return a datum holding the specified date |
|
Return a datum holding the specified datetime |
|
Return a datum holding the specified datetime‐interval |
|
Return a datum holding the specified Decimal64 |
|
Return a datum holding the specified double |
|
|
|
Return a datum holding the specified integer |
|
Return a datum holding the specified 64‐bit integer |
|
Return, by value, a datum having no value. |
|
|
|
Return a datum holding the specified time |
|
Return a datum holding a user‐defined type reference. |
|
Create an uninitialized datum array and load a reference into |
|
Create an uninitialized binary buffer and load a datum referring to it. |
|
Create an uninitialized datum int‐map and load a reference into |
|
|
|
DEPRECATED: Use |
|
Create an uninitialized string buffer and load a datum referring to it. |
|
Return the ASCII name corresponding to the specified |
|
Destroy |
|
Deallocate the storage of an uninitialized array without destroying elements. |
|
Deallocate the storage of an uninitialized int‐map without destroying entries. |
|
|
|
DEPRECATED: Use |
Data Members
Name |
Description |
|
Typed access to the datum representation. |
|
Raw storage for the datum representation. |
Friends
Name |
Description |
Write the specified |
|
Return whether |
|
Return whether |
Created with MrDocs