[Rcpp-devel] Reading-list when creating a mapping for a semi-complex C++ library

Steffen Neumann sneumann at ipb-halle.de
Sat Jul 23 23:24:25 CEST 2011


I am asking for a reading list (rather than the actual answers,
certainly it is somewhere in the great and vast Documentation!)
or best practices creating R bindings to a moderately complex 
C++ library.

We have created https://github.com/sneumann/mzR
which is an R package to read mass spectrometry data, 
using the http://proteowizard.sourceforge.net/ (short: pwiz) library.

The first thing we did was to create a C++ wrapper class, 
which encapsulated the "complexity" of pwiz, and would have 
a number ov Rcpp::List::create(...) to prepare the return 
values and a single Rcpp-module to call into the wrapper class.
That works fine, and now we want to go one step further ;-)

The class hierarchy in pwiz has a class "MSData",
which contains a class "Run" which contains a class "SpectrumListPtr"
which is a "boost::shared_ptr<SpectrumList>"  etc. You get the idea.
An example of what one can do in C++ is line 60..100
and it would be great to be able to do something similar in R.


1) Is it feasible to create Rcpp-modules for each of these classes, 
   so that accessing them can be programmed in R ? 

2) Or does it make more sense to create C++ wrappers which are simpler 
   to add as Rcpp-module(s), and to keep the R side simpler ?

3) Which of the existing packages using Rcpp comes closest 
   (in terms of architecture) to what I want, so I can go 
   and read their code for inspiration ?


IPB Halle                    AG Massenspektrometrie & Bioinformatik
Dr. Steffen Neumann          http://www.IPB-Halle.DE
Weinberg 3                   http://msbi.bic-gh.de
06120 Halle                  Tel. +49 (0) 345 5582 - 1470
                                  +49 (0) 345 5582 - 0
sneumann(at)IPB-Halle.DE     Fax. +49 (0) 345 5582 - 1409

More information about the Rcpp-devel mailing list