getInterface: Get or start an evaluator for an interface

Description Usage Arguments Details Value Functions Examples

View source: R/Interface.R

Description

Utility functions to manage a table of evaluators, indexed by the evaluator class, typically one class per server language. All are typically hidden by functions or methods for the particular class. rmInterface and evaluatorNumber are used by methods and exported so that subclasses of interface evaluators will have access to them.

Usage

1
2
3
4
5
getInterface(Class, ..., .makeNew = NA, .select = NULL)

rmInterface(evaluator)

evaluatorNumber(evaluator, add = length(id) > 0)

Arguments

Class

the name of the interface class for this evaluator; by default, the class of the current evaluator. Can also be the class definition object.

...

arguments, if any, are passed to the generator for the evaluator

.makeNew

can be used to force or prevent starting a new evaluator, if passed as a logical value. Can also be passed as a function that tests the suitability of a current evaluator, returning TRUE if this one won't do, and a new one should be generated instead (consistent with the ... arguments, presumably).

The default is NA, meaning that an existing evaluator is OK, but one should be generated if none exists. In contrast, FALSE means to return NULL if no matching evaluator exists.

.select

Can be supplied as a function of one argument, which will be called for each evaluator of this class and which should return TRUE/FALSE according to whether the evaluator should be accepted. Allows applications to select, for example, a particular evaluator corresponding to a known connection.

evaluator

any evaluator object.

add

if this evaluator is not in the table, add it. Default TRUE.

Details

Specific language interface packages usually supply a convenience function equivalent to calling getInterface() for their class; e.g., RPython() in 'XRPython'

If no Class is given, the current (i.e., last active) evaluator is returned

Value

getInterface() returns an interface evaluator for this class, starting one if none exists.

Functions

Examples

1
2
3
4
## the current evaluator, or NULL if none exists
getInterface()
## this will always be NULL, because no evaluator has this class
getInterface("Interface", .makeNew = FALSE)

XR documentation built on May 2, 2019, 6:01 a.m.

Related to getInterface in XR...