ObjectStorage: ObjectStorage

Description Usage Methods

Description

R6Class for storing similar R6 objects. These objects all need to implement the method get_id() and get_name(). The id of an object is unique in a storage whereas multiple objects can share the same name.

Usage

1
2
3
4
5
storage = ObjectStorage$new(allowed_classes = NULL)

storage$add_object(object)

storage$get_object(id)

Methods

new(allowed_classes = NULL)

Initialize the storage.

allowed_classes Character vector. class(object) has to return at least one of these classes for being added to the storage.
add_object(object)

Add an object to the storage:

object R6 object with public methods get_id(), and get_name().
get_ids()

Get the ids of the stored objects as a character vector named with the object's names.

get_length()

Get the length of the storage.

get_names()

Get the objects' names, which aren't necessarily unique. See also this$get_ids().

get_nth_object(n)

Get the object with index n going from 1 to this$get_length().

get_object(id)

Get an object from the storage with object$get_id() == id.

id id of an R6 object.
get_objects(ids)

Get a list of objects from the storage with object$get_id() %in% ids. If ids is missing get a list with all objects.

ids Character vector. Each element has to be a id of an object in the storage.
remove_object(id)

Remove an object with id == id.

remove_objects(ids)

Remove objects with id %in% ids.


DavidBarke/shinyExplorer documentation built on Aug. 28, 2020, 8:54 p.m.