On 13 May 2011 at 16:11, [email protected] wrote:
| Hello
| 
| This posting continues the discussions from here:
| 
| https://stat.ethz.ch/pipermail/r-help/2011-April/276490.html
| 
| https://stat.ethz.ch/pipermail/r-devel/2011-May/060922.html
| 
| Following all recommendations, we have rewritten our class to use STL. 
However, I have been trying around with various changes, but I can't get it 
working with RCPP_MODULES. Also, the code snippets posted by Romain Francois 
did not help since we cannot use inline, rather we need raw C++ code that can 
be compiled using R CMD BUILD etc. Therefore, I kindly ask the experts here for 
an example adaption to the source below. I guess you experts instantly see what 
needs to be done next to make the code working. Could you please give tips for 
the next step?

Could you detail what you mean by "can't get it working"?  Does it not
compile? If so, can you show how you tried to compile and the error you are
getting?

I'd like to help, but there is not enough information in this post.

Cheers, Dirk

| 
| Thank you
| 
| Regards
| Sören
| 
| 
| /* FOO_mod.cpp */
| #include <Rcpp.h>
| #include <vector>
| #include <valarray>
| using namespace std;
| 
| // from FOO.h
| class FOO
| {
|               double dtau;
|               vector<double> D, ee, ff, S;
| 
|       public:
|               int M;
|               vector<double> C, t, s, par;
|               vector<int> y;
| 
|               FOO();
|               ~FOO();
| 
|               double do_bar(vector<double> z);
| };
| 
| // from FOO.cpp
| double FOO::do_bar(vector<double> z)
| {
|       // whatever it does
| }
| 
| RCPP_MODULE(mod_foo){
|       using namespace Rcpp ;
|       class_<FOO>( "FOO" )
|               .constructor()
|               .field( "M" , &FOO::M )
|               .field( "C" , &FOO::C )
|               .method( "do_bar", &FOO::do_bar )
|       ;
| }
| 

-- 
Gauss once played himself in a zero-sum game and won $50.
                      -- #11 at http://www.gaussfacts.com
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to