BDE 4.14.0 Production release
|
Provide constrained default attributes for the logger manager.
This component provides a simply-constrained attribute class, ball::LoggerManagerDefaults
, that contains a set of attributes (objects and parameters) of particular use to logger managers. The constraints are actively maintained by the class. In particular, the "set" methods for constrained values will fail if their arguments are not consistent with the constraints. Also, the constructor does not take any constrained arguments, but rather sets those values to valid defaults unconditionally. This behavior avoids "silent failures", since the constructor cannot explicitly return a status value.
The attributes contained by a ball::LoggerManagerDefaults
object and the attribute constraints are given, respectively, in two tables below. The attributes are as follows:
The constraints are as follows:
Although the numerical constraints on the four severity levels are independent of one another, they are treated as logically coupled, and must be set as a group. If any one value cannot be successfully set, then the whole set operation fails with no effect on the object value. This may be viewed as an auxiliary constraint.
This constrained-attribute component is thread-safe but not thread-enabled, and requires explicit synchronization in the user space.
This component provides a BDE constrained-attribute type designed to be useful to ball::LoggerManager
. However, ball::LoggerManagerDefaults
is not ball::LoggerManagerConfiguration
, the actual configuration object used by the logger manager. ball::LoggerManagerConfiguration
is not a value semantic type, because it holds functors. ball::LoggerManagerDefaults
, which is used by ball::LoggerManagerConfiguration
, may be regarded as a factored detail of the actual configuration object.
This section illustrates intended use of this component.
The following snippets of code illustrate how to use a ball::LoggerManagerDefaults
object. First, create a configuration object lmd
. Note that it is necessarily configured to valid but unpublished defaults.
Next, set each attribute. Note that the four severity threshold levels must be set atomically (i.e., with a single four-argument "set" method). Note also that each "set" method will fail if the argument or set of arguments is not valid, and so each method returns a status value.
The configuration object is now validly configured with our choice of parameters. If, however, we attempt to set an invalid configuration, the "set" method will fail (with a non-zero return status), and the configuration will be left unchanged.
Finally, we can print the configuration value to stdout
.
This produces the following (multi-line) output: