Description Usage Arguments Value Author(s) References See Also
This function is a high-level function that operates on
the description of a single C level structure definition
and generates the R and C code to interface to instances of
that structure. It generates a parallel R class that
has the same slot names as fields in the C structure
with the equivalent types in R.
Additionally, it creates a class that can be used to hold
a pointer to a C-level instance of the C structure
via an externalptr
in R.
Also, it generates R functions and corresponding C routines
to create new instances of this C-level data type
and to access the fields individually and also to copy an entire
C-level instance to its R equivalent.
In other words, it allows the R user to work with the
structure either in R or in C and to access all parts of it.
1 2 3 |
type |
an object representing the |
typeMap |
an optional type mapping specifying the correspondence between the R and C-level data types and how they can be converted from one to another. This is used to define the types of the R slots corresponding to the fields in the C structure and how to convert between them. This is optional and the default mappings will work in pretty much all cases. This allows one to customize the mappings with contextual information/knowledge. |
classDefs |
the |
def |
the description of the class/struct definition. |
className |
the name of the struct/C++ class |
isClass |
a logical value indicating wehther this is a C++ class
or a regular C |
defaultBaseClass |
the name of the R class which is used as the base class for the class that is a reference to this struct/C++ class. This allows the caller to use a different base class with a different representation or methods. |
A list of class CStructInterface
which can be
passed to writeCode
.
The list has the following components:
generic |
|
rFunctions |
|
cRoutines |
|
clasDefs |
|
coerce |
|
newInst |
|
freeInst |
Duncan Temple Lang
The GCC Translation Unit
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.