BDE 4.14.0 Production release
|
Provide a container of user supplied field values.
This component provides a value-semantic container-type, ball::UserFields
, that represents a (randomly accessible) sequence of ball::UserFieldValue
objects. Each user field value contained in the sequence functions as a discriminated union of the types described by ball::UserFieldType::Enum
(integer, double, string, etc). Values can be added to the sequence using the append*
manipulators, and can be manipulated and accessed using operator[]
. Additionally, ball::UserFields
exposes a random-access iterator providing non-modifiable access to the sequence through the begin
and end
methods.
This section illustrates intended use of this component.
In the following example we demonstrate populating a ball::UserFields
object with a sequence of field values.
First, we define the signature for a callback, populateUserFields
. Most often ball::UserFields
objects are populated by a callback, such as the one described by the ball::LoggerManagerConfiguration
UserFieldsPopulatorCallback
.
Next, we assert the precondition that fields
is empty:
Now, we populate the fields
object with the username and current task identifier (for the purpose of illustration, these are simply constants):
Finally, for the purposes of illustration, we verify that fields
has been set correctly: