validateCopy: Validate an object for copying to a native structure

validateCopyR Documentation

Validate an object for copying to a native structure

Description

This is a run-time helper function that ensures that the specified value val for a .copy argument in a programmatically generated R function has correct entries for all the required parameters. Basically, in the RGCCTranslationUnit package, we generate C routines and R functions that act as wrappers to existing C/C++ routines. Some of those existing routines have a parameter that is a pointer to a structure or array or return such a pointer. When we invoke those routines through our wrapper routines, we want to be able to have the either the pointer or its contents returned as an R object. To this end, our wrapper functions and routines add a a parameter (named .copy in the R function) and this is a logical vector controlling which of these pointer parameters are to be copied to R values. If the value for an element is FALSE, then we return the pointer; if it is TRUE, we copy the pointer value to its R equivalent, e.g. an R vector or an S4 class.

This function ensures that the value of the .copy argument in a call to the R wrapper function is of the correct length and form so that the C routines don't have to check this. So this function is made available at run-time for the programmatically-generated code to access. It is not expected to be used by R programmers directly.

Usage

validateCopy(val, outArgs)

Arguments

val

the value of the .copy argument in the R wrapper function

outArgs

the names of the parameters that are mutable, i.e. which can be returned as a pointer or by value.

Value

A logical vector

Author(s)

Duncan Temple Lang

See Also

The RGCCTranslationUnit package and the code to generate wrapper functions and routines.


omegahat/RAutoGenRunTime documentation built on Jan. 12, 2023, 9:19 p.m.