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).
Synopsis
Declared in <bdld_datum.h>
class Datum;
Description
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 |
|
|
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 |
Apply the specified |
|
Return a datum holding a "deep‐copy" of this object, using the specified |
|
Return |
|
Return |
|
Return |
|
Return |
|
Return |
|
Return |
|
Return |
|
Return |
|
Return |
|
Return |
|
Return |
|
Return |
|
Return |
|
Return |
|
Return |
|
Return |
|
Return |
|
Return |
|
Write the value of this object to the specified output |
|
Return the array value represented by this object as a |
|
Return the binary reference represented by this object as a |
|
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 date+time value represented by this object as a |
|
Return the date+time interval value represented by this object as a |
|
Return the decimal floating point value represented by this object as a |
|
Return the double value represented by this object. The behavior is undefined unless this object actually represents a double value. If the returned value is NaN this method guarantees only that a NaN value will be returned. The sign and NaN payload bits of NaN values returned are unspecified (see also {Special Floating Point Values}. |
|
Return the error value represented by this object as a |
|
Return the int‐map value represented by this object as a |
|
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 represented by this object as a |
|
Return the map value represented by this object as a |
|
Return the string value represented by this object as a |
|
Return the time value represented by this object as a |
|
Return the user‐defined object represented by this object as a |
|
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, by value, a datum that refers to the specified |
|
Return, by value, a datum that refers to the specified |
|
|
|
DEPRECATED: Use |
|
Return, by value, a datum referring to the copy of the specified |
|
|
|
|
|
Return, by value, a datum having the specified |
|
Return, by value, a datum having the specified |
|
Return, by value, a datum having the specified |
|
Return, by value, a datum holding the specified |
|
Return, by value, a datum having the specified |
|
Return, by value, a datum having the specified |
|
|
|
Return, by value, a datum having the specified |
|
Return, by value, a datum having the specified |
|
Return, by value, a datum having no value. |
|
|
|
Return, by value, a datum having the specified |
|
Return, by value, a datum having the |
|
Load the specified |
|
Load the specified |
|
Load the specified |
|
|
|
DEPRECATED: Use |
|
Load the specified |
|
Return the non‐modifiable string representation corresponding to the specified |
|
Deallocate any memory that was previously allocated within the specified |
|
Deallocate the memory used by the specified |
|
Deallocate the memory used by the specified |
|
|
|
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 |
|
Return |
Created with MrDocs