[Rcpp-devel] Persistent C++ objects within R/Rcpp?
On 06/26/2012 02:00 AM, Dirk Eddelbuettel wrote:
Andy, it seems you simply want a creator function in C++ which creates a simulation object, which you then modify and alter in R, possibly give back to C++ etc. Is that correct? In the case, Rcpp can help easily.
Andy, I second Dirk's answer, with the following addition. My "simulation object" (SO) was a bit big, and I was loosing a lot of time to copy operations (not sure if this is Rcpp's fault or my lack of coding skill). My solution was to use classes. I code, in C++, my SO as a class. I use the Rcpp class interface to write R wrappers to the functions which manipulate the state of the SO. To run a simulation, I load the module into R, create an instance of the class, then run the simulation via the R functions which are linked to the SO functions. I am sure there is a more elegant way, but this approach works. +glenn
----------------------------------- It is difficult to find a black cat in a dark room, especially if there is no cat. -- Chinese proverb Dr. Glenn Lawyer +352 661 967 244 Max-Planck-Institut f?r Informatik Computational Biology and Applied Algorithmics Campus E1 4 66123 Saarbr?cken, Germany http://bioinf.mpi-inf.mpg.de/~lawyer -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20120626/338871cc/attachment.html>