packageRegistry
provides ways to create query package specific
registries.
packageRegistry( regname = NULL, quiet = FALSE, entry = FALSE, update = !entry, package = topenv(parent.frame()) ) packageRegistries(regname = NULL, package = NULL, primary = FALSE) hasPackageRegistry(regname = NULL, package) setPackageRegistry( regname, regobj, description = "", entrydesc = NA, ..., package = topenv(parent.frame()), overwrite = FALSE ) setPackageRegistryEntry( regname, key, ..., overwrite = FALSE, verbose = FALSE, where = topenv(parent.frame()), msg = NULL )
regname | Name of a sub-registry, used as its identifier. |
---|---|
quiet | a logical that indicates that one should return the (meta-)registry if it exists,
or |
entry | logical that indicates if the corresponding meta registry entry should be directly returned, without any other processing. |
update | logical that indicates if the package registry should be updated, by adding/removing entries from other loaded/unloaded packages. |
package | package where to store or look for the registry. |
primary | logical that indicates if only primary registries should be listed. |
regobj | a |
description | short description line about the registry. It is recommended to provide such description as it makes clearer the purpose of the registry. This description is shown when the registry object is printed/formated/listed. |
entrydesc | human readable description that is used in log messages when registering/removing entries. |
... | named values used to set extra information about the new registry, that
are stored in the corresponding fields of the meta-registry.
Currently not used, as no extra field other than |
overwrite | a logical that indicate if an existing registry with the same should be overwritten if it exists. |
key | entry identifier. |
verbose | a logical that indicates if verbosity should be toggle on. |
where | package name or namespace that owns the registry. |
msg | addon message to print at the end of the output log line,
when |
a registry
object or NULL
(see argument
quiet
).
Package registries are organised in a meta-registry (a registry of registries) within a package's namespace. Each registry can be used to store sets of built-in or user-defined objects in an organised way, e.g. algorithms or datasets.
A package meta-registry is a registry
object,
whose entries are registry
objects themselves.
A sub-registry entry is defined by the following fields:
The sub-registry's accession key/identifier (a character string).
The sub-registry itself (a registry
object)
Human readable description of the purpose of the registry (a character string)
Short human readable description of the type of entries (a character string)
owner package, which is forced to be the package in which the meta registry is defined.
The name of the package that holds the parent registry, which we call the primary package. This field is non empty for cross-package registries, i.e. registries that derive from primary package's own registry. Their entries are defined when (lazy-)loading the dependent package's namespace.
Note that this function cannot be called from the global environment, but from
a package namespace, e.g., when a package is lazy-loaded on installation or loaded
via the function load_all
from the devtools package.
packageRegistries
: lists registries from loaded packages.
hasPackageRegistry
: tells if a given package has a meta-registry or
a given registry.
setPackageRegistry
: creates a package-specific registry within a package.
Each package sub-registry has its own set of fields.
Sub-registries defined by passing a character string in argument regobj
of
setPackageRegistry
have the following fields: 'key'
and 'object'
setPackageRegistryEntry
: adds an entry in a package registry.