Description Usage Arguments Note Author(s) References See Also
This function is used to generate code that provides an R-language interface to a C++ class. Currently, it generates code to access the instances of the class as references. This makes sense for C++ classes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | createClassBindings(def, nodes, className = rdef@name, # rdef computed in function from def.
types = DefinitionContainer(nodes),
polymorphicNames = unique(names(mm)[duplicated(names(mm))]),
abstract = isAbstractClass(mm, nodes),
resolvedMethods = resolveType(getClassMethods(def), nodes, types),
typeMap = list(),
generateOverloaded = TRUE, ifdef = character(),
helperInfo = NULL, access = "public",
dynamicCast = list(),
otherClassMethods = NULL, useClassNameMethod = FALSE,
signatures = list(),
useSignatureParameters = TRUE,
dispatchInfo = data.frame(),
defaultBaseClass = if(useClassNameMethod)
"RC++ReferenceUseName"
else
"RC++Reference",
classDefs = NULL, ...)
|
def |
the node giving the class definition. In the future, we will allow this object to be a fully resolved description of the class, i.e. with the methods and types resolved. |
nodes |
the TU parser returned from |
className |
the name of the C++ class being processed |
types |
the collection of resolved data types, routines, etc.
typically a |
polymorphicNames |
a character vector giving the names of the methods that are overloaded, typically just within this class. |
abstract |
a logical value indicating if this class is an abstract class for which there can be no C++-level instances. |
resolvedMethods |
a list of the fully resolved methods, typically
obtained from a call to |
typeMap |
a user-specifiable list of "hints" for mapping particular data types in the generated code, i.e. for converting between R and C/C++ and coercing in R functions to the appropriate type for the C/C++ method. |
... |
additional arguments that are passed on to
|
generateOverloaded |
a logical value XXX |
ifdef |
a character string which, if non-empty, is used to enclose
the entire generated code within and |
helperInfo |
passed on to each call to |
access |
a character vector containing one or more of
public, protected, private to indicate which methods should be
processed. For each method, we compare its accessability value
to this vector and only process it if there is a corresponding
entry in this vector. Thus, a value of |
dynamicCast |
a logical value or a list that controls how dynamic casting code is generated. |
otherClassMethods |
methods from other classes |
useClassNameMethod |
prefix methods, etc. with the name of hte class rather than using translation unit-wide overloading |
signatures |
a list of the signatures of all functions/methods in the translation unit. |
dispatchInfo |
a data frame. This is passed to and from the different helper functions and builds up information about the number of possible arguments for different methods. |
useSignatureParameters |
a logical controlling whether to use the parameters from the local definition or the centralized overloaded method. |
defaultBaseClass |
the name of the base C++ class to use for defining a new class. |
classDefs |
a collection of the resolved type descriptions of the classes in the translation unit. |
For regular C/C++ structures, we can access the fields and work with instances rather than references to instances, passing such objects between R and C/C++ representations by explicitly copying the fields.
Duncan Temple Lang <duncan@wald.ucdavis.edu>
http://www.omegahat.org/RGCCTranslationUnit
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.