Description Usage Arguments Details Value
Functions for low-level operations on C pointers as well as
helper functions and objects to handle C float
arrays and strings.
1 2 3 4 5 6 7 8 9 10 | is.nullptr(x)
as.extptr(x)
is.externalptr(x)
floatraw(n)
as.floatraw(x)
floatraw2numeric(x)
ptr2str(x)
strarrayptr(x)
strptr(x)
offsetPtr(x, offset)
|
x |
an R object. |
n |
number of elements to allocate. |
offset |
a offset given in bytes. |
is.nullptr
tests if the external pointer given by x
represents a C NULL
pointer.
as.extptr
returns an external pointer to the data area of atomic
vector given by x
. The external pointer holds an additional reference
to the x
R object to prevent it from garbage collection.
is.externalptr
tests if the object given by x
is an external pointer.
floatraw
creates an array with a capacity to store n
single-precision C float
values.
The array is implemented via a raw
vector.
as.floatraw
coerces a numeric vector into a single-precision C float
vector.
Values given by x
are converted to C float
values and stored in the R raw vector via .pack
.
This function is useful when calling foreign functions that expeect a C float
pointer via .dyncall
.
floatraw2numeric
coerces a C float
(raw) vector to a numeric vector.
ptr2str
, strarrayptr
, strptr
are currently experimental.
offsetPtr
creates a new external pointer pointing to x
plus the byte offset
.
If x
is given as an external pointer, the address is increased by the offset
,
or, if x
is given as a atomic vector, the address of the data (pointing to offset zero) is taken as basis
and increased by the offset
.
The returned external pointer is protected (as offered by the C function R_MakeExternalPtr
) by the external pointer x
.
A logical value is returned by is.nullptr
and is.externalptr
.
as.extptr
returns an external pointer value.
floatraw
and as.floatraw
return an atomic vector of type raw
tagged with class 'floatraw'
.
floatraw2numeric
returns a numeric
atomic vector.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.