[ Reference Manual | Alphabetic Index ]

library(config_opts)

Library for managing configuration options for libraries and applications   [more]

Predicates

get_all_options(?OptionList)
Retrieves the current values of all options
get_option(++Name, ?Value)
Retrieves the current value of an option
register_option(++Name, ?InitialValue, +Options)
Register an option
request_notification(++Name, ++Pred)
Requests that a predicate be called when an option changes
set_option(++Name, ?Value)
Gives a new value to an option

Description

This library provides a centralised mechanism for managing configuration options for other libraries and applications. Such options range from turning logging on and off and specifying what statistics to collect and print, to which redundant constraints and search strategies to use.

A software component registers the fact that it supports an option by calling register_option/3. An option's value can then be set and retrieved through set_option/2 and get_option/2, respectively. And any party wishing to be notified when an option's value changes can achieve this by calling request_notification/2.

The values and associated parameters of configuration options are persistent across backtracking. Values are copied when set and retrieved, which means that any non-ground values will contain fresh copies of variables when retrieved rather than the original ones.

Note that at the moment configuration option settings are global, which makes them unsuitable for some purposes (e.g. any library that might be used by more than one component of a software system if those components may wish to use different settings for that library). We hope to address this issue in a future version of this library, probably by allowing the use of handles to manage multiple sets of options.

This library is still experimental and is expected to evolve. Feedback, suggestions, problem reports, etc. welcome.

About


Generated from config_opts.eci on 2022-09-03 14:26