BDE 4.14.0 Production release
Loading...
Searching...
No Matches
ball_userfieldvalue

Detailed Description

Outline

Purpose

Provide a type for the value of a user supplied field.

Classes

See also
ball_userfields, ball_userfieldtype

Description

This component provides a value-semantic class, ball::UserFieldValue, that represents the value of a user supplied log field value. A user field value acts as a discriminated union, and may represent a value of any of types described in ball::UserFieldType or an unset value (indicated by the type ball::UserFieldType::e_VOID).

Usage

This section illustrates intended use of this component.

Example 1: Basic Use of ball::UserFieldValue

The following snippets of code illustrate how to create and use a ball::UserFieldValue object. Note that ball::UserFieldValue objects are typically used in a description of a sequence of user fields (see ball_userfields ).

First, we create a default ball::UserFieldValue, valueA, and observe that it is in the unset state, meaning that isUnset is true and its type is ball::UserFieldValue::e_VOID:

assert(true == valueA.isUnset());
assert(ball::UserFieldValue::e_VOID == valueA.type());
Definition ball_userfieldvalue.h:135
bool isUnset() const
Definition ball_userfieldvalue.h:454
ball::UserFieldType::Enum type() const

Next, we create a second ball::UserFieldValue having the value 5, and then confirm its value and observe that it does not compare equal to the valueA:

assert(false == valueB.isUnset());
assert(ball::UserFieldValue::e_INT64 == valueB.type());
assert(5 == valueB.theInt64();
assert(valueA != valueB);

Finally, we call reset of valueB resetting it to the unset state, and observe that valueA now compares equal to valueB:

valueB.reset();
assert(valueA == valueB);