Register a handler for exporting R objects to foreign systems.

Share:

Description

Registers a manager for R objects that are to be used by foreign systems such as Omegahat and Java. The registration provides access to the object from C routines that bridge the two systems - R and the foreign one.

Usage

1
setJavaHandler(handler)

Arguments

handler

An object that manage the references and provide the different functions for accessing and manipulating those references. These functions are described below and implemented in javaHandlerGenerator()

Details

This registers the handler object with the C code so that it is known to the Java methods. The methods that must be provided are

handler()

brokers a method request for a reference under the management of this handler, taking care of passing the arguments, identifying the appropriate method, and catching errors.

createReference()

creates an actual foreignReference object by calling the foreignReference function.

addReference

adds an object to the list being managed by this reference handler. An explicit name can be provided in the call to this method, or otherwise a unique one is generated by the manager itself.

remove

discards the identified object from the list of objects being managed by this reference handler.

getReference

retrieves a particular object being managed by this reference manager using the name of the reference.

references

returns a (named) list of all the objects being managed by this reference manager.

total

returns the number of references that have been managed by this object. This is used in constructing new unique names when an object is registered without an explicit identifier.

The intent of the handler is to allow the management of the objects being exported to the foreign system(s) (Java and Omegahat)

Value

The previous value of the registered handler that has been replaced with this value. This allows one to temporarily replace a handler with a new version and then swap the original back at the end of an operation/transaction.

Author(s)

Duncan Temple Lang

References

http://www.omegahat.org/RSJava/Conversion.html

See Also

getJavaHandler

Examples

1
2
3
4
5
## Not run: 
  old <- setJavaHandler(javaHandlerGenerator())
  setJavaHandler(old)

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.