Logo ROOT   6.12/07
Reference Guide
ExpClass.C
Go to the documentation of this file.
1 
2 #include<TRInterface.h>
3 
4 using namespace Rcpp ;
5 
6 class Foo{
7  public:
8  enum Bla{ FOO, BAR } ;
9 
10  Foo( double x_, double y_) : x(x_), y(y_){}
11 
12  Foo* clone(){
13  return new Foo( x, y) ;
14  }
15 
16  double x, y ;
17 
18  void bla(const Foo& other){
19  Rprintf( "efez\n" ) ;
20  }
21 
22 } ;
23 
24 Foo make_foo(){ return Foo(3, 4) ; }
25 
26 RCPP_EXPOSED_CLASS(Foo)
27 
29 
30  class_<Foo>("Foo" )
31  .constructor<double,double>()
32  .method( "clone", &Foo::clone )
33 
34  .field( "x", &Foo::x )
35  .field( "y", &Foo::y )
36 
37  .method( "bla", &Foo::bla )
38  ;
39  Rcpp::function( "make_foo", &make_foo ) ;
40 
41 }
42 
43 void ExpClass()
44 {
46  r["Mod"]<<LOAD_ROOTR_MODULE(Mod);
47 
48  r<<"Foo <- Mod$make_foo()";
49  r<<"Foo$bla(Foo)";
50  r<<"f <- Foo$clone()";
51  r<<"f$bla(Foo)";
52 }
void ExpClass()
Definition: ExpClass.C:43
RCPP_MODULE(Mod)
Definition: ExpClass.C:28
Double_t x[n]
Definition: legend1.C:17
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
Definition: RExports.h:146
ROOT::R::TRInterface & r
Definition: Object.C:4
Double_t y[n]
Definition: legend1.C:17
static TRInterface & Instance()
static method to get an TRInterface instance reference
This is a class to support deprecated method to pass function to R&#39;s Environment, based in Rcpp::Inte...
Definition: RExports.h:64
Foo make_foo()
Definition: ExpClass.C:24
#define LOAD_ROOTR_MODULE(NAME)
Definition: RExports.h:172