ProtectedRObject

Enables reference counting of objects allocated by R. It takes care of protecting and unprotecting objects from the R garbage collector.

R objects allocated inside R and passed to D are automatically protected. Attempting to protect/unprotect them will result in an error. R objects allocated by D have to be protected from the garbage collector while they are active, and unprotected when you are done with them.

This is an implementation of the reference counting scheme in Adam Ruppe's D Cookbook.

This does not do anything to protect an R object. ProtectedRObject holds an object that has already been protected and unprotects it when there are no more references to it.

Constructors

this
this(Robj x, bool u = false)

Destructor

~this
~this()

Unprotects the Robj if the reference count hits zero and unprotect is true.

Postblit

this(this)
this(this)

Needed to change the reference count.

Alias This

data

Members

Functions

robj
Robj robj()

For convenience, returns the underlying Robj when you want to pass the data back to R.

Variables

data
RObjectStorage* data;

Wrapper around the data that holds the reference count

Meta