BDE 4.39.x Production Release
Loading...
Searching...
No Matches
ball_thresholddefaults

Detailed Description

Provide default threshold values.

Outline

Purpose

Provide default threshold values.

Classes

See also
ball_loggermanagerdefaults, ball_categorymanager

Description

This component provides a namespace for the 4 default threshold level constants.

Usage

This section illustrates intended use of this component.

Example 1: Accessing Default Threshold Values

The following example demonstrates how to access the default threshold values provided by 'ball::ThresholdDefaults'.

Suppose we are implementing a function that initializes threshold levels for a logging system. We can use the constants provided by 'ball::ThresholdDefaults' to supply reasonable default values:

void initializeThresholds(int *recordLevel,
int *passLevel,
int *triggerLevel,
int *triggerAllLevel)
// Initialize the specified threshold levels to their default values.
{
}
static const int k_TRIGGER_ALL_LEVEL
Definition ball_thresholddefaults.h:126
static const int k_RECORD_LEVEL
Definition ball_thresholddefaults.h:123
static const int k_PASS_LEVEL
Definition ball_thresholddefaults.h:124
static const int k_TRIGGER_LEVEL
Definition ball_thresholddefaults.h:125

Then, we can call this function and verify it sets the values correctly:

int recordLevel, passLevel, triggerLevel, triggerAllLevel;
initializeThresholds(&recordLevel,
&passLevel,
&triggerLevel,
&triggerAllLevel);

Finally, the default values provide a reasonable starting configuration where 'k_RECORD_LEVEL' (e_OFF, 0) disables recording of messages to memory, 'k_PASS_LEVEL' (e_ERROR, 64) passes only ERROR level messages and above, 'k_TRIGGER_LEVEL' (e_OFF, 0) disables trigger of publication on single message, and 'k_TRIGGER_ALL_LEVEL' (e_OFF, 0) disables trigger of publication on all messages:

assert(ball::Severity::e_OFF == recordLevel );
assert(ball::Severity::e_ERROR == passLevel );
assert(ball::Severity::e_OFF == triggerLevel );
assert(ball::Severity::e_OFF == triggerAllLevel);
@ e_ERROR
Definition ball_severity.h:175
@ e_OFF
Definition ball_severity.h:173