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


_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to