Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ExpClass.C
Go to the documentation of this file.
1
2#include<TRInterface.h>
3
4using namespace Rcpp ;
5
6class Foo{
7 public:
8 enum Bla{ FOO, BAR } ;
9
10 Foo( double x_, double y_) : x(x_), y(y_){}
11
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
24Foo make_foo(){ return Foo(3, 4) ; }
25
26RCPP_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
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}
double
void ExpClass()
Definition ExpClass.C:43
Foo make_foo()
Definition ExpClass.C:24
RCPP_MODULE(Mod)
Definition ExpClass.C:28
ROOT::R::TRInterface & r
Definition Object.C:4
#define LOAD_ROOTR_MODULE(NAME)
Definition RExports.h:176
Definition ExpClass.C:6
double x
Definition ExpClass.C:16
Foo(double x_, double y_)
Definition ExpClass.C:10
double y
Definition ExpClass.C:16
Bla
Definition ExpClass.C:8
@ FOO
Definition ExpClass.C:8
@ BAR
Definition ExpClass.C:8
Foo * clone()
Definition ExpClass.C:12
void bla(const Foo &other)
Definition ExpClass.C:18
ROOT R was implemented using the R Project library and the modules Rcpp and RInside
static TRInterface & Instance()
static method to get an TRInterface instance reference
This is a class to support deprecated method to pass function to R's Environment, based in Rcpp::Inte...
Definition RExports.h:61