getRClassDefinitions: Compute R classes corresponding to a C++ class

Description Usage Arguments Value Author(s) References See Also

Description

This function takes a translation unit node defining a class and then computes information about it to define an R class corresponding to that C++ class. It provides the R code to define this class as well as providing information about the ancestor classes. When working in recursive mode, the function can generate the R code to define classes for the entire hierarchy of ancestor classes.

Usage

1
2
getRClassDefinitions(node, recursive = FALSE, className = getNodeName(node),
                      defaultBaseClass = "RC++Reference")

Arguments

node

a translation parser node which defines a C++ class. This has class GCC::Node::type_decl and is a reference to a Perl object.

recursive

a logical value indicating whether to process the node and its ancestor classes recursively or just this leaf node by itself. If this is TRUE, the function returns a list with information about each of the classes in the ancestor chain.

className

the name to use for the R base of the class name. Note that "Ptr" is appended to this.

defaultBaseClass

the name of the base R class to use in the R class definition if the specified C++ class does not have any ancestors.

Value

If recursive is FALSE (the default) this returns an object of S3 class ClassDefinition which has fields named:

definition
baseClasses

a named character vector giving the names of the classes from which this C++ class is derived. The names for this vector are the node identifiers in the translation unit of the corresponding class nodes for these parent classes.

ancestors

a named character vector giving the name of the C++ class and the name of that element is the corresponding R class name

className

the name of the class being defined

If recursive is TRUE, the function returns a list with elements of class ClassDefinition as described in the previous paragraph.

Author(s)

Duncan Temple Lang

References

The GCC compiler suite

See Also

getClassNodes setClass


omegahat/RGCCTranslationUnit documentation built on May 24, 2019, 1:53 p.m.