Skip to content
Prev 40454 / 63424 Next

Interfacing a C++ class

On 06.06.2011, at 13:42, Romain Francois wrote:

            
Thanks Simon and Romain for your great help! That C++ classes exposed via Rcpp-modules are already reference classes helps a lot and saves time for unnecessary mirroring. According to Romain saving class objects across sessions remains to be implemented in Rcpp. I have not browsed the rJava package extensively, but I found serialize() (base) and this function seems to provide a workaround. Yet, I do not know how to use it in practice with my package. Some thoughts: consider the small FOO example below. Then, on accidental crash or quit(save="yes"), or whatever users may do, R "should" know that it has to serialise all existing FOO objects. Note, that in my package these objects are "sort of lists" that can become quite large (say, a vector of 15,000 numeric values plus a character string). After restoring a previously saved image, R "should know" to load my package, and that in turn should deserialise every FOO object present in the image. Sounds like a not too complicated task, something like .dofirst()/.dolast() -- but that again exceeds my R and C++ programming skills, and I hope that you experts may share an idea. Thanks, S?ren