Learn R Programming

RSNNS (version 0.3-1)

SnnsRObjectMethodCaller: Enable calling of C++ functions as methods of SnnsR-class objects.

Description

Enable calling of C++ functions as methods of SnnsR-class objects.

Usage

## S3 method for class 'SnnsR':
$(x, name)

Arguments

x
object of class SnnsR-class
name
function to call

Details

This function makes methods of SnnsR__ and SnnsCLib__ accessible via "$". If no SnnsR__ method is present, then the according SnnsCLib__ method is called. This enables a very flexible method handling. To mask a method from SnnsCLib, e.g. to do some parameter checking or postprocessing, only a method with the same name, but beginning with SnnsR__ has to be present in R. See e.g. SnnsRObject$initializeNet for such an implementation. Error handling is also done within the method caller. If the result of a function is a list with a member err, then SnnsCLib__error is called to use the SNNS kernel function to get the corresponding error message code and an R warning is thrown containing this message.