ContextFactory {parabar}R Documentation

BackendFactory

Description

This class is a factory that provides instances of the Context class.

Methods

Public methods


Method get()

Obtain instances of the Context class.

Usage
ContextFactory$get(type)
Arguments
type

A character string specifying the type of the Context to instantiate. Possible values are "regular" and "progress". See the Details section for more information.

Details

When type = "regular" a Context instance is created and returned. When type = "progress" a ProgressTrackingContext instance is provided instead.

Returns

An object of type Context. It throws an error if the requested context type is not supported.


Method clone()

The objects of this class are cloneable with this method.

Usage
ContextFactory$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

Context, ProgressTrackingContext, Service, and Backend

Examples

# Create a context factory.
context_factory <- ContextFactory$new()

# Get a regular context instance.
context <- context_factory$get("regular")

# Check the class of the context instance.
class(context)

# Get a progress context instance.
context <- context_factory$get("progress")
class(context)


[Package parabar version 1.1.1 Index]