registry: Registry creator

Description Usage Arguments Details Author(s) See Also Examples

View source: R/registry.R

Description

Function to create a registry object.

Usage

1
2
registry(entry_class = NULL, registry_class = NULL,
         validity_FUN = NULL, stop_if_missing = FALSE)

Arguments

entry_class

character string indicating a class the returned registry object will additionally inherit from (optional). Used for dispatching user-specified print and summary methods.

registry_class

character string indicating a class the registry entries will additionally inherit from (optional). Used for dispatching user-specified print and summary methods.

validity_FUN

a function accepting a new registry entry as argument for checking its validity and possibly aborting with an error message. The entry will be provided by the calling function as a list with named components (fields).

stop_if_missing

logical indicating whether the registry lookup functions should abort or just return NULL in case of no match.

Details

This is a generating function that will return a registry object whose components are accessor functions for the contained data. These are documented separately (regobj).

Author(s)

David Meyer David.Meyer@R-project.org

See Also

regobj

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
R <- registry()

R$set_field("X", type = TRUE)
R$set_field("Y", type = "character")
R$set_field("index", type = "character", is_key = TRUE,
            index_FUN = match_partial_ignorecase)
R$set_field("index2", type = "integer", is_key = TRUE)

R$set_entry(X = TRUE, Y = "bla", index = "test", index2 = 1L)
R$set_entry(X = FALSE, Y = "foo", index = c("test", "bar"), index2 = 2L)

R$get_entries("test")
R[["test", 1]]
R["test"]
R[["test"]]

registry documentation built on May 1, 2019, 8:23 p.m.