[Rcpp-devel] Exposing a large number of C++ classes in R
Hi Holger, The yaml should be easy enough to generate (if you can create a list then yaml::as.yaml will dump out suitable yaml probably). While yaml is used for the configuration now, it's not essential to how the package works. I did look into generating the interface from something like roxygen comments - https://github.com/richfitz/RcppR6/issues/1 I think with the same reading list as Whit suggested. There are some starts there that I haven't looked at in a long time, mostly in this repo: https://github.com/richfitz/cppinfo In the end it was not too unpleasant just to write the yaml out so I gave up on it. If you have a lot of classes though, there is a lot of yaml - this was from the project that motivated the package. https://github.com/traitecoevo/plant/blob/master/inst/RcppR6_classes.yml With a decent access to something that can parse C++ you could get at a lot of the type information, but it's a lot of work and corner cases, especially once you deal with templated classes ?\_(?)_/? Cheers, Rich On Fri, Feb 5, 2016 at 1:44 PM Whit Armstrong <armstrong.whit at gmail.com> wrote:
I've been thinking for a while about using clang to do source-to-source translation to generate the R bindings for a given c++ class. There are lots of examples online, but I haven't yet tackled this for R. http://eli.thegreenplace.net/2012/06/08/basic-source-to-source-transformation-with-clang http://stackoverflow.com/questions/28711580/how-to-write-a-source-to-source-compiler-api http://szelei.me/code-generator/ etc. good luck! -Whit On Fri, Feb 5, 2016 at 7:58 AM, Holger Hoefling <hhoeflin at gmail.com> wrote:
Hi, I am trying to write a package that exposes a large number of C++ classes from an external project to R and was looking into how to lighten the workload. Dirk already pointed my to the RcppR6 package, which looks really useful. However, even this would require to write quite a bit of yaml to achieve this. So, is there a converter (e.g. based on doxygen xml) that can help with the yaml writing? Does anyone have more experience and can give pointers on how to best approach this problem? Also, how best to handle multiple inheritance in this context? Thanks a lot for anyone's help! Holger
_______________________________________________ Rcpp-devel mailing list Rcpp-devel at lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
_______________________________________________ Rcpp-devel mailing list Rcpp-devel at lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20160205/acab0929/attachment.html>