diff --git a/bindings/r/CMakeLists.txt b/bindings/r/CMakeLists.txt index ec2144dda34cf..0afa09d81dbae 100644 --- a/bindings/r/CMakeLists.txt +++ b/bindings/r/CMakeLists.txt @@ -10,16 +10,12 @@ set(libname RInterface) include_directories(${R_INCLUDE_DIRS}) set(R_HEADERS ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRInterface.h - ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRObjectProxy.h - ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRFunction.h + ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRObject.h + ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRFunctionExport.h + ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRFunctionImport.h ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRInternalFunction.h ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRDataFrame.h ${CMAKE_SOURCE_DIR}/bindings/r/inc/RExports.h) -set(RHIST_HEADERS ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRF1.h - ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRGraph.h) -set(ROI_HEADERS ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRFile.h) -set(RGPAD_HEADERS ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRCanvas.h) -set(RRINT_HEADERS ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRRint.h) SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) ROOT_GENERATE_DICTIONARY(G__RInterface ${R_HEADERS} MODULE ${libname} LINKDEF LinkDef.h) diff --git a/bindings/r/Module.mk b/bindings/r/Module.mk index 4bf3f9c00cd14..0dc62b8d816fd 100644 --- a/bindings/r/Module.mk +++ b/bindings/r/Module.mk @@ -25,20 +25,19 @@ RDO := $(RDS:.cxx=.o) RDH := $(MODDIRI)/RExports.h \ $(MODDIRI)/TRInterface.h \ - $(MODDIRI)/TRObjectProxy.h \ - $(MODDIRI)/TRFunction.h \ + $(MODDIRI)/TRInterface_Binding.h \ + $(MODDIRI)/TRObject.h \ + $(MODDIRI)/TRDataFrame.h \ + $(MODDIRI)/TRDataFrame__ctors.h \ + $(MODDIRI)/TRFunctionImport.h \ + $(MODDIRI)/TRFunctionImport__oprtr.h \ + $(MODDIRI)/TRFunctionExport.h \ $(MODDIRI)/TRInternalFunction.h \ - $(MODDIRI)/TRInternalFunction__ctors.h + $(MODDIRI)/TRInternalFunction__ctors.h -RDHMOD := $(MODDIRI)/TRCanvas.h \ - $(MODDIRI)/TRF1.h \ - $(MODDIRI)/TRRint.h \ - $(MODDIRI)/TRFile.h \ - $(MODDIRI)/TRGraph.h \ - $(MODDIRI)/TRSystem.h -RH := $(RDH) $(RDHMOD) +RH := $(RDH) RS := $(filter-out $(MODDIRS)/G__%,$(wildcard $(MODDIRS)/*.cxx)) RO := $(call stripsrc,$(RS:.cxx=.o)) diff --git a/bindings/r/doc/users-guide/ROOTR Users Guide.md b/bindings/r/doc/users-guide/ROOTR Users Guide.md index fda75d9d86793..5bde4993afa60 100644 --- a/bindings/r/doc/users-guide/ROOTR Users Guide.md +++ b/bindings/r/doc/users-guide/ROOTR Users Guide.md @@ -1,4 +1,4 @@ -
![](img/logo.jpeg)
+![](img/logo.jpeg) # ROOTR Users Guide @@ -36,36 +36,36 @@ To install ROOTR please read first. To compile with cmake added into ~/.profile -``` {.sh} +~~~{.sh} export PATH=$PATH:/Applications/CMake.app/Contents/bin/ -``` +~~~ and -``` {.sh} +~~~{.sh} source ~/.profile -``` +~~~ Install needed R packages, open R and in the prompt type -``` {.sh} +~~~{.sh} install.packages(c('Rcpp','RInside')) -``` +~~~ select a mirror and install. Download code from git repo -``` {.sh} +~~~{.sh} git clone -b master-root-R https://github.com/lmoneta/root.git -``` +~~~ To compile ROOTR lets to create a compilation directory and to activate it use cmake -Dr=ON .. -``` {.sh} +~~~{.sh} mkdir compile cd compile cmake -Dr=ON .. make -j n -``` +~~~ This is a basic video using ROOTR on ![ROOTR Mac](http://img.youtube.com/vi/tvhuEen8t7c/0.jpg)](http://www.youtube.com/watch?v=tvhuEen8t7c) @@ -77,29 +77,29 @@ This is a basic video using ROOTR on install (For debian-based distros) -``` {.sh} +~~~{.sh} apt-get install r-base r-base-dev -``` +~~~ Install needed R packages, open R and in the prompt type -``` {.sh} +~~~{.sh} install.packages(c('Rcpp','RInside')) -``` +~~~ select a mirror and install. Download code from git repo -``` {.sh} +~~~{.sh} git clone -b master-root-R https://github.com/lmoneta/root.git -``` +~~~ To compile ROOTR lets to create a compilation directory and to activate it use cmake -Dr=ON .. -``` {.sh} +~~~{.sh} mkdir compile cd compile cmake -Dr=ON .. make -j n -``` +~~~ This is a basic video using ROOTR on ![ROOTR Gnu/Linux](http://img.youtube.com/vi/FkrmM2xCPoM/0.jpg)](http://www.youtube.com/watch?v=FkrmM2xCPoM) @@ -111,16 +111,16 @@ of making calls to R to give and obtein data. This class has a series of overcha and code from R to C++ and vice versa. To create an object of this class the user must use the static methods `ROOT::R::TRInterface::Instance` and `ROOT::R::TRInterface::InstancePtr` which return a reference object and a pointer object respectively. -``` {.cpp} +~~~{.cxx} #include ROOT::R::TRInterface &r=ROOT::R::TRInterface::Instance(); -``` +~~~ ## Running R code and passing/getting variables. We have different ways to run R code and pass/obtain data to/from R environment: using the methods Execute(code) and Eval(code). -``` {.cpp} +~~~{.cxx} #include //creating an instance @@ -143,12 +143,12 @@ std::vector vd(3); r["seq(0,1,0.5)"]>>vd; std::cout< v(3); -v[0]=0; -v[1]=1; -v[2]=2; +std::vector v1(3); +v1[0]=0; +v1[1]=1; +v1[2]=2; -r["v1"]<>m; m.Print(); -``` +~~~ So, working with ROOTR is like working with flows of data to pass, obtain and process data. ## Passing functions from ROOT to R @@ -166,7 +166,7 @@ So instead of using `*Double_t` you must use `std::vector` and instead of `*Char For this example we need to create a macro, so save it as fun.C -``` {.cpp} +~~~{.cxx} #include #include @@ -183,14 +183,14 @@ Double_t myfun2(std::vector x) //use std::vector instead Dou void fun() { ROOT::R::TRInterface &r=ROOT::R::TRInterface::Instance(); -r["dilog"]< Double_t myfun(Double_t x) @@ -220,7 +220,7 @@ r["myfuni"]<<(Int_t (*)(Int_t))myfun; r<<"print(myfund(0.0))"; r<<"print(myfuni(1))"; } -``` +~~~ ## Wrapping a class You can wrap a class and expose it in R environment using only a pair of macrodefinitions and the template class @@ -240,7 +240,7 @@ Example: Lets to create need data to play with dataframe features -``` {.cpp} +~~~{.cxx} //////////////////////// //creating variables// //////////////////////// @@ -265,11 +265,11 @@ names.push_back("v2"); names.push_back("v3"); ROOT::R::TRInterface &r=ROOT::R::TRInterface::Instance(); -``` +~~~ In R the dataframe have associate to every column a label, in ROOTR you can have the same label using the class ROOT::R::Label to create a TRDataFrame where you data have a label associate. -``` {.cpp} +~~~{.cxx} ///////////////////////////////////////////////// //creating dataframe object with its labels// ///////////////////////////////////////////////// @@ -282,18 +282,18 @@ ROOT::R::TRDataFrame df1(ROOT::R::Label["var1"]=v1,ROOT::R::Label["var2"]=v2,RO r["df1"]<>v; v.Print(); -``` +~~~ Output -``` {.sh} +~~~{.sh} Vector (3) is as follows | 1 | @@ -354,9 +354,9 @@ Vector (3) is as follows 0 |3 1 |2 2 |1 -``` +~~~ -``` {.cpp} +~~~{.cxx} /////////////////////////////////////////// //Working with colunms between dataframes// /////////////////////////////////////////// @@ -366,17 +366,17 @@ df2["v3"]<>df1["var1"]; //updating df1 in R's environment r["df1"]< root [1] ROOT::R::TRInterface &r=ROOT::R::TRInterface::Instance(); @@ -434,7 +434,7 @@ Vector (9) is as follows 8 |5 root [4] -``` +~~~ ## EXAMPLES The examples can also be found in `$ROOTSYS/tutorials/r` @@ -445,7 +445,7 @@ associated to that function are needed. In this example I show how to give support to a custom class to be used in R's environment, which at the same time is a functor. -``` {.cpp} +~~~{.cxx} #include #include @@ -521,7 +521,7 @@ void Functor() r<<"print(sprintf('value in R = %f',functor$doEval( 1 )))"; std::cout<<"value in ROOT = "< #include @@ -603,25 +603,25 @@ TCanvas *SimpleFitting(){ c1->Update(); return c1; } -``` +~~~ In the first image you can see the blue dots wichi are the function `x^3` with gaussian noise, the red dots correspond to the original function and the green ones correspond to the fitted function. -
![](img/simplefit.gif)
+![](img/simplefit.gif) ## Global Minimization in R using the package DEoptim DEoptim is a R package for Differential Evolution Minimization that lets you do global Minimization. To install this package you just need to run: -``` {.cpp} +~~~{.cxx} #include ROOT::R::TRInterface &r=ROOT::R::TRInterface::Instance(); r<<"install.packages('DEoptim',repos='http://cran.rstudio.com/')"; -``` +~~~ Then create a macro named GlobalMinimization.C with the next code. -``` {.cpp} +~~~{.cxx} #include #include #include @@ -717,10 +717,10 @@ void GlobalMinimization() r<<"dev.new(title='Rastrigin Convergence')"; r<<"plot(result2,type='o',pch='.')"; } -``` +~~~ In the image you can see the convergence plots of the functions and their minimum. For RosenBrock is (1,1,1) and for Rastrigin is (0,0,0). -
![](img/minimization.jpeg)
+![](img/minimization.jpeg) ## Interpolation (Plotting in R) This example shows an interpolation using the function aproxfun and how to make a plot with R's @@ -729,7 +729,7 @@ graphical functions. More Information on R interpolation at [http://stat.ethz.ch/R-manual/R-patched/library/stats/html/approxfun.html](http://stat.ethz.ch/R-manual/R-patched/library/stats/html/approxfun.html) -``` {.cpp} +~~~{.cxx} #include #include #include @@ -778,14 +778,14 @@ r<<"curve(fc(x), 0, 10, col = 'darkblue', add = TRUE)"; // different interpolation on left and right side : r<<"plot(approxfun(x, y, rule = 2:1), 0, 11,col = 'tomato', add = TRUE, lty = 3, lwd = 2)"; } -``` +~~~ The image shows the interpolated function plotted within R -
![](img/interpolation.png)
+![](img/interpolation.png) ## Integration (Passing vectorized function to R) Numerical integration using R passing the function from ROOT -``` {.cpp} +~~~{.cxx} #include #include #include @@ -838,7 +838,10 @@ void Integration() std::cout<<"Integral of BreitWigner Function in the interval [-Inf, Inf] R = "< #endif -#ifndef ROOT_TMatrix -#include +#ifndef ROOT_TMatrixT +#include #endif #ifndef ROOT_TArrayD @@ -61,12 +61,17 @@ #endif +//Some useful typedefs +typedef std::vector TVectorString; + + #include namespace ROOT { namespace R { - class TRFunction; + class TRFunctionExport; + class TRFunctionImport; class TRDataFrame; - class TRObjectProxy; + class TRObject; } } @@ -99,8 +104,13 @@ namespace Rcpp { template<> SEXP wrap(const ROOT::R::TRDataFrame &o); template<> ROOT::R::TRDataFrame as(SEXP) ; - template<> SEXP wrap(const ROOT::R::TRObjectProxy &o); - template<> ROOT::R::TRObjectProxy as(SEXP) ; +//TRObject + template<> SEXP wrap(const ROOT::R::TRObject &o); + template<> ROOT::R::TRObject as(SEXP) ; + +//TRFunctionImport + template<> SEXP wrap(const ROOT::R::TRFunctionImport &o); + template<> ROOT::R::TRFunctionImport as(SEXP) ; template std::array as(SEXP &obj) { @@ -130,6 +140,7 @@ namespace Rcpp { #define R_Version(v,p,s) ((v * 65536) + (p * 256) + (s)) #endif #include//this headers should be called after templates definitions +#include #undef HAVE_UINTPTR_T #include @@ -148,9 +159,12 @@ namespace ROOT { //template function required to create modules using the macro ROOTR_MODULE Rcpp::function(name_, fun, docstring); } + + extern Rcpp::internal::NamedPlaceHolder Label; } } + //macros redifined to be accord with the namespace #define ROOTR_MODULE RCPP_MODULE #define ROOTR_EXPOSED_CLASS RCPP_EXPOSED_CLASS diff --git a/bindings/r/inc/TRCanvas.h b/bindings/r/inc/TRCanvas.h deleted file mode 100644 index d97868f08afb3..0000000000000 --- a/bindings/r/inc/TRCanvas.h +++ /dev/null @@ -1,68 +0,0 @@ -// @(#)root/r:$Id$ -// Author: Omar Zapata 26/05/2014 - - -/************************************************************************* - * Copyright (C) 2014, Omar Andres Zapata Mesa * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ -#ifndef ROOT_R_TCanvas -#define ROOT_R_TCanvas - -#ifndef ROOT_R_RExports -#include -#endif - -#ifndef ROOT_TCanvas -#include -#endif - -//________________________________________________________________________________________________________ -/** - This is TCanvas class for R - - - @ingroup R -*/ - -namespace ROOT { - namespace R { - - class TRCanvas: public TCanvas { - public: - TRCanvas(); - TRCanvas(TString name):TCanvas(name.Data(), "", 1){} - TRCanvas(TString name,TString tittle):TCanvas(name.Data(), tittle.Data(), 1){} - TRCanvas(TString name,TString tittle,Int_t form):TCanvas(name.Data(), tittle.Data(), form){} - ~TRCanvas() {}; - - void Draw(){TCanvas::Draw();} - void Draw(TString opt){TCanvas::Draw(opt.Data());} - void Write(TString a, Int_t b, Int_t c){TCanvas::Write(a.Data(),b,c);} - }; - } - - -} -ROOTR_EXPOSED_CLASS_INTERNAL(TRCanvas) - - -ROOTR_MODULE(ROOTR_TRCanvas) -{ - - ROOT::R::class_("TRCanvas", "A Canvas is an area mapped to a window directly under the control of the display manager. ") - .constructor() - .constructor() - .constructor() - .method("Draw", (void (ROOT::R::TRCanvas::*)())(&ROOT::R::TRCanvas::Draw)) - .method("Draw", (void (ROOT::R::TRCanvas::*)(TString))(&ROOT::R::TRCanvas::Draw)) - .method("Divide", (void (ROOT::R::TRCanvas::*)(Int_t, Int_t, Float_t, Float_t, Int_t))(&ROOT::R::TRCanvas::Divide)) - .method("Write", (Int_t(ROOT::R::TRCanvas::*)(TString , Int_t, Int_t))(&ROOT::R::TRCanvas::Write)) - .method("Update", (void(ROOT::R::TRCanvas::*)())(&ROOT::R::TRCanvas::Update)) - ; -} - -#endif diff --git a/bindings/r/inc/TRDataFrame.h b/bindings/r/inc/TRDataFrame.h index 2382519168588..aebba992d3c9d 100644 --- a/bindings/r/inc/TRDataFrame.h +++ b/bindings/r/inc/TRDataFrame.h @@ -16,174 +16,436 @@ #include #endif -#ifndef ROOT_R_TRObjectProxy -#include +#ifndef ROOT_R_TRObject +#include #endif -//________________________________________________________________________________________________________ -/** - This is a base class to create DataFrames from ROOT to R - +#ifndef ROOT_R_TRFunctionImport +#include +#endif - @ingroup R -*/ namespace ROOT { -namespace R { - -static Rcpp::internal::NamedPlaceHolder Label; - -class TRDataFrame: public TObject { - friend class TRInterface; - friend SEXP Rcpp::wrap(const TRDataFrame &f); -protected: - Rcpp::DataFrame df; -public: - //Proxy class to use operators for assignation Ex: df["name"]>>object - class Binding { - friend class TRDataFrame; - public: - Binding(Rcpp::DataFrame &_df,TString name):fName(name),fDf(_df) {} - Binding(const Binding &obj):fName(obj.fName),fDf(obj.fDf){} - template Binding operator=(T var) { - int size = fDf.size(),i=0 ; - Rcpp::CharacterVector names=fDf.attr("names"); - bool found=false; - while(i

TRDataFrame class

+ + DataFrame is a very important datatype in R and in ROOTR we have a class to manipulate
+ dataframes called TRDataFrame, with a lot of very useful operators overloaded to work with TRDataFrame's objects
+ in a similar way that in the R environment but from c++ in ROOT.
+ Example:
+
+ Lets to create need data to play with dataframe features
+ +

Creating variables


+ \code{.cpp} + TVectorD v1(3); + std::vector v2(3); + std::array v3{ {1,2,3} }; + std::list names; + \endcode + +

Assigning values


+ \code{.cpp} + v1[0]=1; + v1[1]=2; + v1[2]=3; + + v2[0]=0.101; + v2[1]=0.202; + v2[2]=0.303; + + names.push_back("v1"); + names.push_back("v2"); + names.push_back("v3"); + + ROOT::R::TRInterface &r=ROOT::R::TRInterface::Instance(); + \endcode + + In R the dataframe have associate to every column a label, + in ROOTR you can have the same label using the class ROOT::R::Label to create a TRDataFrame where you data + have a label associate. +

Creating dataframe object with its labels


+ \code{.cpp} + using namespace ROOT::R; + TRDataFrame df1(Label["var1"]=v1,Label["var2"]=v2,Label["var3"]=v3,Label["strings"]=names); + \endcode + +

Passing dataframe to R's environment


+ \code{.cpp} + r["df1"]<Adding colunms to dataframe
+ \code{.cpp} + TVectorD v4(3); + //filling the vector fro R's environment + r["c(-1,-2,-3)"]>>v4; + //adding new colunm to df1 with name var4 + df1["var4"]=v4; + //updating df1 in R's environment + r["df1"]<Getting dataframe from R's environment
+ \code{.cpp} + ROOT::R::TRDataFrame df2; + + r<<"df2<-data.frame(v1=c(0.1,0.2,0.3),v2=c(3,2,1))"; + r["df2"]>>df2; + + TVectorD v(3); + df2["v1"]>>v; + v.Print(); + + df2["v2"]>>v; + v.Print(); + \endcode + + Output + \code + Vector (3) is as follows + + | 1 | + ------------------ + 0 |0.1 + 1 |0.2 + 2 |0.3 + + Vector (3) is as follows + + | 1 | + ------------------ + 0 |3 + 1 |2 + 2 |1 + \endcode + + Working with colunms between dataframes
+ \code{.cpp} + df2["v3"]<Working with colunms between dataframes
+ \code{.cpp} + //passing values from colunm v3 of df2 to var1 of df1 + df2["v3"]>>df1["var1"]; + //updating df1 in R's environment + r["df1"]<Users Guide + http://oproject.org/tiki-index.php?page=ROOT+R+Users+Guide
+ https://root.cern.ch/drupal/content/how-use-r-root-root-r-interface + @ingroup R + */ + + + class TRDataFrame: public TObject { + friend class TRInterface; + friend SEXP Rcpp::wrap(const TRDataFrame &f); + protected: + Rcpp::DataFrame df; //internal Rcpp::DataFrame + public: + //Proxy class to use operators for assignation Ex: df["name"]>>object + class Binding { + friend class TRDataFrame; + public: + /** + Construct a Binding nestead class for facilities with operators + \param _df Rcpp::DataFrame (internal from TDataFrame) + \param name string to use in assignations + */ + Binding(Rcpp::DataFrame &_df, TString name): fName(name), fDf(_df) {} + /** + Copy constructor for Binding nestead class + \param obj object with Rcpp::DataFame objecta and string with name + */ + Binding(const Binding &obj): fName(obj.fName), fDf(obj.fDf) {} + /** + template method for operator assignation + \param var any R wrappable datatype + */ + template Binding operator=(T var) + { + int size = fDf.size(), i = 0 ; + Rcpp::CharacterVector names = fDf.attr("names"); + bool found = false; + while (i < size) { + if (names[i] == fName.Data()) { + found = true; + break; + } + i++; + } + if (found) fDf[fName.Data()] = var; + else { + if (size == 0) { + fDf = Rcpp::DataFrame::create(ROOT::R::Label[fName.Data()] = var); + } else { + Rcpp::List nDf(size + 1); + Rcpp::CharacterVector nnames(size + 1); + for (i = 0; i < size; i++) { + nDf[i] = fDf[i] ; + nnames[i] = names[i]; + } + nDf[size] = var; + nnames[size] = fName.Data(); + nDf.attr("class") = fDf.attr("class") ; + nDf.attr("row.names") = fDf.attr("row.names") ; + nDf.attr("names") = nnames ; + fDf = nDf; + } + } + return *this; + } + /** + method for operator assignation of Binding class + \param obj other Binding object + */ + Binding operator=(Binding obj) { - if(names[i]==fName.Data()) - { - found=true; - break; - } - i++; + int size = fDf.size(), i = 0 ; + Rcpp::CharacterVector names = fDf.attr("names"); + bool found = false; + while (i < size) { + if (names[i] == fName.Data()) { + found = true; + break; + } + i++; + } + if (found) fDf[fName.Data()] = obj.fDf[obj.fName.Data()]; + else { + Rcpp::List nDf(size + 1); + Rcpp::CharacterVector nnames(size + 1); + for (i = 0; i < size; i++) { + nDf[i] = obj.fDf[i] ; + nnames[i] = names[i]; + } + nDf[size] = obj.fDf[obj.fName.Data()]; + nnames[size] = fName.Data(); + + nDf.attr("class") = obj.fDf.attr("class") ; + nDf.attr("row.names") = obj.fDf.attr("row.names") ; + nDf.attr("names") = nnames ; + fDf = nDf; + } + + return *this; } - if(found) fDf[fName.Data()]=var; - else + + /** + Template method for operator >> that lets to use dataframes like streams + example: df["v"]>>vector; + \param var any datatype that can be assigned from dataframe label + */ + template Binding &operator >>(T &var) { - Rcpp::List nDf(size+1); - Rcpp::CharacterVector nnames(size+1); - for(i=0; i(fDf[fName.Data()]); + return *this; } - return *this; - } - Binding operator=(Binding obj) - { - int size = fDf.size(),i=0 ; - Rcpp::CharacterVector names=fDf.attr("names"); - bool found=false; - while(i>(Binding var) { - if(names[i]==fName.Data()) - { - found=true; - break; - } - i++; + var.fDf[var.fName.Data()] = fDf[fName.Data()]; + return var; } - if(found) fDf[fName.Data()]=obj.fDf[obj.fName.Data()]; - else + + /** + Template method for operator << that lets to use dataframes like streams + example: df["v"]< Binding &operator <<(T var) { - Rcpp::List nDf(size+1); - Rcpp::CharacterVector nnames(size+1); - for(i=0; i Binding &operator >>(T &var) { - var = Rcpp::as(fDf[fName.Data()]); - return *this; - } - Binding operator >>(Binding var) { - var.fDf[var.fName.Data()] = fDf[fName.Data()]; - return var; - } - - template Binding &operator <<(T var) { - int size = fDf.size(),i=0 ; - Rcpp::CharacterVector names=fDf.attr("names"); - bool found=false; - while(i operator T() { - if(names[i]==fName.Data()) - { - found=true; - break; - } - i++; + return Rcpp::as(fDf[fName.Data()]); } - if(found) fDf[fName.Data()]=var; - else + template operator T() const { - Rcpp::List nDf(size+1); - Rcpp::CharacterVector nnames(size+1); - for(i=0; i(fDf[fName.Data()]); } - return *this; - } - template operator T() { - return Rcpp::as(fDf[fName.Data()]); - } - template operator T() const{ - return Rcpp::as(fDf[fName.Data()]); - } - - private: - TString fName; - Rcpp::DataFrame &fDf; - }; - - TRDataFrame(); - TRDataFrame(const TRDataFrame &_df); - TRDataFrame(const Rcpp::DataFrame &_df):df(_df){}; + + private: + TString fName; //name of label + Rcpp::DataFrame &fDf;//internal dataframe + }; + + /** + Default TDataFrame constructor + */ + TRDataFrame(); + /** + TDataFrame constructor + \param obj raw R object that can be casted to DataFrame + */ + TRDataFrame(SEXP obj) + { + df = Rcpp::as(obj); + } + /** + TDataFrame copy constructor + \param _df other TRDataFrame + */ + TRDataFrame(const TRDataFrame &_df); + /** + TDataFrame constructor for Rcpp::DataFrame + \param _df raw dataframe from Rcpp + */ + TRDataFrame(const Rcpp::DataFrame &_df): df(_df) {}; + #include - Binding operator[](const TString &name); - - TRDataFrame& operator=(TRDataFrame &obj) { - df=obj.df; + + Binding operator[](const TString &name); + + TRDataFrame &operator=(TRDataFrame &obj) + { + df = obj.df; return *this; } - TRDataFrame& operator=(TRDataFrame obj) { - df=obj.df; + + TRDataFrame &operator=(TRDataFrame obj) + { + df = obj.df; return *this; } - int GetNcols(){return df.size();} - int GetNrows(){return df.nrows();} - ClassDef(TRDataFrame, 0) // -}; -} + + TRDataFrame &operator=(SEXP obj) + { + df = Rcpp::as(obj); + return *this; + } + + operator SEXP() + { + return df; + } + + operator SEXP() const + { + return df; + } + + /** + Method to get the number of colunms + \return number of cols + */ + int GetNcols() + { + return df.size(); + } + /** + Method to get the number of rows + \return number of rows + */ + int GetNrows() + { + return df.nrows(); + } + /** + Method to get labels of dataframe + \return colunms names + */ + TVectorString GetColNames() + { + Rcpp::CharacterVector names = df.attr("names"); + TVectorString rnames(GetNcols()); + for (int i = 0; i < GetNcols(); i++)rnames[i] = names[i]; + return rnames; + } + + /** + Method to get dataframe as matrix + \note only work on numerical dataframes if some column if string or other it will fail + \return TMatrixT with a given tamplate data type + */ + template TMatrixT AsMatrix() + { + TRFunctionImport asMatrix("as.matrix"); + return Rcpp::as >(asMatrix(df)); + } + + /** + Method to print the dataframe in stdout or a column given the label + \param label nomber of the column to print + */ + void Print(TString label = "") + { + TRFunctionImport print("print"); + if (label == "") print(df); + else print(df[label.Data()]); + } + ClassDef(TRDataFrame, 0) // + }; + } } diff --git a/bindings/r/inc/TRF1.h b/bindings/r/inc/TRF1.h deleted file mode 100644 index 4d8710f9a5e60..0000000000000 --- a/bindings/r/inc/TRF1.h +++ /dev/null @@ -1,88 +0,0 @@ -// @(#)root/r:$Id$ -// Author: Omar Zapata 26/05/2014 - - -/************************************************************************* - * Copyright (C) 2014, Omar Andres Zapata Mesa * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ -#ifndef ROOT_R_TRF1 -#define ROOT_R_TRF1 - -#ifndef ROOT_TF1 -#include -#endif - -#ifndef ROOT_R_RExports -#include -#endif - -//________________________________________________________________________________________________________ -/** - This is TF1's wrapper class for R - - - @ingroup R -*/ - -namespace ROOT { - namespace R { - class TRF1: public TF1 { - public: - TRF1():TF1(){} - TRF1(const TF1 &f1): TF1(f1) {} - TRF1(TString name, TString formula, Double_t xmin = 0, Double_t xmax = 1):TF1(name.Data(), formula.Data(), xmin, xmax){} - std::vector Eval(std::vector x); - void Draw(){TF1::Draw();} - void Draw(TString opt){TF1::Draw(opt.Data());} - inline Int_t Write(const TString name) { - return TF1::Write(name.Data()); - } - inline Int_t Write(const TString name, Int_t option,Int_t bufsize) { - return TF1::Write(name.Data(),option,bufsize); - } - }; - } -} - -namespace Rcpp { - template<> SEXP wrap(const TF1 &f) - { - return Rcpp::wrap(ROOT::R::TRF1(f)); - } - template<> TF1 as(SEXP f) - { - return Rcpp::as(f); - } -} - -ROOTR_EXPOSED_CLASS_INTERNAL(TRF1) - -//______________________________________________________________________________ -std::vector ROOT::R::TRF1::Eval(std::vector x) -{ - std::vector result(x.size()); - for (unsigned int i = 0; i < x.size(); i++) result[i] = TF1::Eval(x[i]); - return result; -} - - -ROOTR_MODULE(ROOTR_TRF1) -{ - - ROOT::R::class_("TRF1", "1-Dim ROOT's function class") - .constructor() - .method("Eval", (std::vector (ROOT::R::TRF1::*)(std::vector))&ROOT::R::TRF1::Eval) - .method("Eval", (Double_t (ROOT::R::TRF1::*)(Double_t))&ROOT::R::TRF1::Eval) - .method("Draw", (void (ROOT::R::TRF1::*)())(&ROOT::R::TRF1::Draw)) - .method("Draw", (void (ROOT::R::TRF1::*)(TString))(&ROOT::R::TRF1::Draw)) - .method("SetRange", (void (ROOT::R::TRF1::*)(Double_t, Double_t))(&ROOT::R::TRF1::SetRange)) - .method("SetParameter", (void (ROOT::R::TRF1::*)(Int_t, Double_t))(&ROOT::R::TRF1::SetParameter)) - .method("Write", (Int_t(ROOT::R::TRF1::*)(TString, Int_t, Int_t))(&ROOT::R::TRF1::Write)) - .method("Write", (Int_t(ROOT::R::TRF1::*)(TString))(&ROOT::R::TRF1::Write)) - ; -} -#endif diff --git a/bindings/r/inc/TRFile.h b/bindings/r/inc/TRFile.h deleted file mode 100644 index 9f55c22f74b5c..0000000000000 --- a/bindings/r/inc/TRFile.h +++ /dev/null @@ -1,92 +0,0 @@ -// @(#)root/r:$Id$ -// Author: Omar Zapata 5/06/2014 - - -/************************************************************************* - * Copyright (C) 2014, Omar Andres Zapata Mesa * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ -#ifndef ROOT_R_TRFILE -#define ROOT_R_TRFILE - -#ifndef ROOT_R_RExports -#include -#endif - -#ifndef ROOT_TFile -#include -#endif - -#ifndef ROOT_R_TRF1 -#include -#endif - -#ifndef ROOT_R_TRGraph -#include -#endif - -#ifndef ROOT_R_TRCanvas -#include -#endif - -//________________________________________________________________________________________________________ -/** - This is TFile class for R - - - @ingroup R -*/ -namespace ROOT { - namespace R { - - class TRFile: public TFile { - public: - TRFile():TFile(){} - TRFile(TString fname):TFile(fname.Data()){} - TRFile(TString fname, TString option):TFile(fname.Data(),option.Data()){} - TRFile(TString fname, TString option, TString ftitle):TFile(fname.Data(),option.Data()){} - TRFile(TString fname, TString option, TString ftitle, Int_t compress ); - - template T Get(TString object) { - return *(T *)TFile::Get(object); - } - inline void Close() { - TFile::Close(0); - } - inline void Close(TString opt) { - TFile::Close(opt.Data()); - } - }; - } -} - -//______________________________________________________________________________ -ROOT::R::TRFile::TRFile(TString fname, TString option , TString ftitle, Int_t compress): TFile(fname.Data(), option.Data(), ftitle.Data(), compress) -{ - -} - -ROOTR_MODULE(ROOTR_TRFile) -{ - - ROOT::R::class_("TRFile", "TFile class to manipulate ROOT's files.") - .constructor() - .constructor() - .constructor() - .constructor() - .method("Map", (void (ROOT::R::TRFile::*)())&ROOT::R::TRFile::Map) - .method("ls", (void (ROOT::R::TRFile::*)(TString))&ROOT::R::TRFile::ls) - .method("Flush", (void (ROOT::R::TRFile::*)())&ROOT::R::TRFile::Flush) - .method("Close", (void (ROOT::R::TRFile::*)(TString))&ROOT::R::TRFile::Close) - .method("Close", (void (ROOT::R::TRFile::*)())&ROOT::R::TRFile::Close) - .method("Get", &ROOT::R::TRFile::Get) - .method("Get", &ROOT::R::TRFile::Get) -// .method("Get", &ROOT::R::TRFile::Get)//TRCanvas no supported at the moment - ; -} - - -#endif diff --git a/bindings/r/inc/TRFunction.h b/bindings/r/inc/TRFunction.h deleted file mode 100644 index f35696f8c9002..0000000000000 --- a/bindings/r/inc/TRFunction.h +++ /dev/null @@ -1,61 +0,0 @@ -// @(#)root/r:$Id$ -// Author: Omar Zapata 16/06/2013 - - -/************************************************************************* - * Copyright (C) 2013-2014, Omar Andres Zapata Mesa * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ -#ifndef ROOT_R_TRFunction -#define ROOT_R_TRFunction - -#ifndef ROOT_R_TRInternalFunction -#include -#endif - -//________________________________________________________________________________________________________ -/** - This is a base class to pass functions from ROOT to R - - - @ingroup R -*/ - -namespace ROOT { - namespace R { - - class TRInterface; - class TRFunction: public TObject { - friend class TRInterface; - friend SEXP Rcpp::wrap(const TRFunction &f); - protected: - TRInternalFunction *f; - public: - TRFunction(); - - TRFunction(const TRFunction &fun); - //________________________________________________________________________________________________________ - template TRFunction(T fun) { - //template constructor that supports a lot - // of function's prototypes - f = new TRInternalFunction(fun); - } - - //________________________________________________________________________________________________________ - template void SetFunction(T fun) { - //template method that supports a lot - // of function's prototypes - f = new TRInternalFunction(fun); - } - - ClassDef(TRFunction, 0) // - }; - } -} - - - -#endif diff --git a/bindings/r/inc/TRFunctionExport.h b/bindings/r/inc/TRFunctionExport.h new file mode 100644 index 0000000000000..93e0fc28f252d --- /dev/null +++ b/bindings/r/inc/TRFunctionExport.h @@ -0,0 +1,185 @@ +// @(#)root/r:$Id$ +// Author: Omar Zapata 16/06/2013 + + +/************************************************************************* + * Copyright (C) 2013-2015, Omar Andres Zapata Mesa * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ +#ifndef ROOT_R_TRFunctionExport +#define ROOT_R_TRFunctionExport + +#ifndef ROOT_R_TRInternalFunction +#include +#endif + + +namespace ROOT { + namespace R { + + /** + \class TRFunctionExport + + This is a class to pass functions from ROOT to R +

TRFunctionExport class

+

+ The TRFunctionExport class lets you pass ROOT's functions to R's environment
+

+

+ The next example was based in
+ + http://root.cern.ch/root/html/tutorials/fit/NumericalMinimization.C.html +
+ + http://stat.ethz.ch/R-manual/R-devel/library/stats/html/optim.html
+ +

+ + Let \f$ f(x,y)=(x-1)^{2} + 100(y-x^{2})^{2} \f$ , which is called the Rosenbrock + function. + + It's known that this function has a minimum when \f$ y = x^{2}\f$ , and \f$ x = 1.\f$ + Let's get the minimum using R's optim package through ROOTR's interface. + In the code this function was called "Double_t RosenBrock(const TVectorD xx )", because for + optim, the input in your function definition must be a single vector. + + The Gradient is formed by + + \f$ \frac{\partial f}{\partial x} = -400x(y - x^{2}) - 2(1 - x) \f$ + + \f$ \frac{\partial f}{\partial y} = 200(y - x^{2}); \f$ + + The "TVectorD RosenBrockGrad(const TVectorD xx )" function + must have a single vector as the argument a it will return a single vetor. + + \code{.cpp} + #include + + //in the next function the pointer *double must be changed by TVectorD, because the pointer has no + //sense in R's environment. + Double_t RosenBrock(const TVectorD xx ) + { + const Double_t x = xx[0]; + const Double_t y = xx[1]; + const Double_t tmp1 = y-x*x; + const Double_t tmp2 = 1-x; + return 100*tmp1*tmp1+tmp2*tmp2; + } + + TVectorD RosenBrockGrad(const TVectorD xx ) + { + const Double_t x = xx[0]; + const Double_t y = xx[1]; + TVectorD grad(2); + grad[0]=-400 * x * (y - x * x) - 2 * (1 - x); + grad[1]=200 * (y - x * x); + return grad; + } + + + void Minimization() + { + ROOT::R::TRInterface &r=ROOT::R::TRInterface::Instance(); + //passing RosenBrock function to R + r["RosenBrock"]< http://oproject.org/tiki-index.php?page=ROOT+R+Users+Guide
+ https://root.cern.ch/drupal/content/how-use-r-root-root-r-interface + + @ingroup R + */ + + + class TRInterface; + class TRFunctionExport: public TObject { + friend class TRInterface; + friend SEXP Rcpp::wrap(const TRFunctionExport &f); + protected: + TRInternalFunction *f; //Internar Function to export + public: + /** + Default TRFunctionExport constructor + */ + TRFunctionExport(); + /** + TRFunctionExport copy constructor + \param fun other TRFunctionExport + */ + TRFunctionExport(const TRFunctionExport &fun); + + /** + TRFunctionExport template constructor that supports a lot of function's prototypes + \param fun supported function to be wrapped by Rcpp + */ + template TRFunctionExport(T fun) + { + f = new TRInternalFunction(fun); + } + + /** + function to assign function to export, + template method that supports a lot of function's prototypes + \param fun supported function to be wrapped by Rcpp + */ + template void SetFunction(T fun) + { + f = new TRInternalFunction(fun); + } + + ClassDef(TRFunctionExport, 0) // + }; + } +} + + + +#endif diff --git a/bindings/r/inc/TRFunctionImport.h b/bindings/r/inc/TRFunctionImport.h new file mode 100644 index 0000000000000..863e0d181c84d --- /dev/null +++ b/bindings/r/inc/TRFunctionImport.h @@ -0,0 +1,190 @@ +// @(#)root/r:$Id$ +// Author: Omar Zapata 28/06/2015 + + +/************************************************************************* + * Copyright (C) 2015, Omar Andres Zapata Mesa * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ +#ifndef ROOT_R_TRFunctionImport +#define ROOT_R_TRFunctionImport + + +#ifndef ROOT_R_RExports +#include +#endif + +#ifndef ROOT_R_TRObject +#include +#endif + +#ifndef Rcpp_hpp +#include +#endif + + +namespace ROOT { + namespace R { + + /** + \class TRFunctionImport + This is a class to pass functions from ROOT to R + +

TRFunctionImport class

+

+ The TRFunctionImport class lets you call R's functions to ROOT's environment
+ The object associated to this class have a set of overloaded operators to use the object like function
+

+ \code{.cpp} + #include + + using namespace ROOT::R; + void Function() + { + TRInterface &r = TRInterface::Instance(); + r.SetVerbose(1); + //////////////////////////////////////// + //defining functions to be used from R// + //////////////////////////////////////// + TRFunctionImport c("c"); + TRFunctionImport list("list"); + TRFunctionImport asformula("as.formula"); + TRFunctionImport nls("nls"); + TRFunctionImport confint("confint"); + TRFunctionImport summary("summary"); + TRFunctionImport print("print"); + TRFunctionImport plot("plot"); + TRFunctionImport lines("lines"); + TRFunctionImport devnew("dev.new"); + TRFunctionImport devoff("dev.off"); + TRFunctionImport min("min"); + TRFunctionImport max("max"); + TRFunctionImport seq("seq"); + TRFunctionImport predict("predict"); + + r<<"options(device='png')";//enable plot in png file + + //////////////////////// + //doing the procedure // + //////////////////////// + TRObject xdata = c(-2,-1.64,-1.33,-0.7,0,0.45,1.2,1.64,2.32,2.9); + TRObject ydata = c(0.699369,0.700462,0.695354,1.03905,1.97389,2.41143,1.91091,0.919576,-0.730975,-1.42001); + + TRDataFrame data; + data["xdata"]=xdata; + data["ydata"]=ydata; + + //fit = nls(ydata ~ p1*cos(p2*xdata) + p2*sin(p1*xdata), start=list(p1=1,p2=0.2)) <- R code + TRObject fit = nls(asformula("ydata ~ p1*cos(p2*xdata) + p2*sin(p1*xdata)"),Label["data"]=data, Label["start"]=list(Label["p1"]=1,Label["p2"]=0.2)); + print(summary(fit)); + + print(confint(fit)); + + devnew("Fitting Regression"); + plot(xdata,ydata); + + TRObject xgrid=seq(min(xdata),max(xdata),Label["len"]=10); + lines(xgrid,predict(fit,xgrid),Label["col"] = "green"); + devoff(); + } + \endcode + + Output + \code + Formula: ydata ~ p1 * cos(p2 * xdata) + p2 * sin(p1 * xdata) + + Parameters: + Estimate Std. Error t value Pr(>|t|) + p1 1.881851 0.027430 68.61 2.27e-12 *** + p2 0.700230 0.009153 76.51 9.50e-13 *** + --- + Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 + + Residual standard error: 0.08202 on 8 degrees of freedom + + Number of iterations to convergence: 7 + Achieved convergence tolerance: 2.189e-06 + + Waiting for profiling to be done... + 2.5% 97.5% + p1 1.8206081 1.9442365 + p2 0.6794193 0.7209843 + \endcode +

Users Guide

+ http://oproject.org/tiki-index.php?page=ROOT+R+Users+Guide
+ https://root.cern.ch/drupal/content/how-use-r-root-root-r-interface + + @ingroup R + */ + + class TRInterface; + class TRFunctionImport: public TObject { + friend class TRInterface; + friend SEXP Rcpp::wrap(const TRFunctionImport &f); + friend TRFunctionImport Rcpp::as<>(SEXP); + + protected: + Rcpp::Function *f;//Internal Rcpp function to import + /** + TRFunctionImport constructor for Rcpp::DataFrame + \param fun raw function object from Rcpp + */ + + TRFunctionImport(const Rcpp::Function &fun) + { + *f = fun; + } + + public: + /** + TRFunctionImport constructor + \param name name of function from R + */ + TRFunctionImport(const TString &name); + /** + TRFunctionImport constructor + \param name name of function from R + \param ns namespace of function from R + */ + TRFunctionImport(const TString &name, const TString &ns); + /** + TRFunctionImport copy constructor + \param fun other TRFunctionImport + */ + TRFunctionImport(const TRFunctionImport &fun); + /** + TRFunctionImport constructor + \param obj raw R object + */ + TRFunctionImport(SEXP obj); + /** + TRFunctionImport constructor + \param obj TRObject object + */ + TRFunctionImport(TRObject &obj); + + ~TRFunctionImport() + { + if (f) delete f; + } + SEXP operator()() + { + return (*f)(); + } +#include + ClassDef(TRFunctionImport, 0) // + }; + + template<> inline TRObject::operator TRFunctionImport() + { + return (SEXP)fObj; + } + } +} + + + +#endif diff --git a/bindings/r/inc/TRFunctionImport__oprtr.h b/bindings/r/inc/TRFunctionImport__oprtr.h new file mode 100644 index 0000000000000..a661f9e4c6d78 --- /dev/null +++ b/bindings/r/inc/TRFunctionImport__oprtr.h @@ -0,0 +1,113 @@ +// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- +// +// TRFunctionImport__oprt.h: based in Rcpp R/C++ interface class library -- generated helper code for Function.h +// +// Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois +// Modified by Omar Zapata for ROOTR +// +// This file is based in Rcpp. + +#ifndef ROOT_R_TRFunctionImport_oprtr +#define ROOT_R_TRFunctionImport_oprtr + + template + TRObject operator()(const T1& t1) const { + return (*f)(t1) ; + } + + template + TRObject operator()(const T1& t1, const T2& t2) const { + return (*f)(t1, t2) ; + } + + template + TRObject operator()(const T1& t1, const T2& t2, const T3& t3) const { + return (*f)(t1, t2, t3) ; + } + + template + TRObject operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4) const { + return (*f)(t1, t2, t3, t4) ; + } + + template + TRObject operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5) const { + return (*f)(t1, t2, t3, t4, t5) ; + } + + template + TRObject operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6) const { + return (*f)(t1, t2, t3, t4, t5, t6) ; + } + + template + TRObject operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7) const { + return (*f)(t1, t2, t3, t4, t5, t6, t7) ; + } + + template + TRObject operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8) const { + return (*f)(t1, t2, t3, t4, t5, t6, t7, t8) ; + } + + template + TRObject operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9) const { + return (*f)(t1, t2, t3, t4, t5, t6, t7, t8, t9) ; + } + + template + TRObject operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10) const { + return (*f)(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10) ; + } + + template + TRObject operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11) const { + return (*f)(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11) ; + } + + template + TRObject operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12) const { + return (*f)(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12) ; + } + + template + TRObject operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13) const { + return (*f)(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13) ; + } + + template + TRObject operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14) const { + return (*f)(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14) ; + } + + template + TRObject operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15) const { + return (*f)(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15) ; + } + + template + TRObject operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16) const { + return (*f)(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16) ; + } + + template + TRObject operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17) const { + return (*f)(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17) ; + } + + template + TRObject operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18) const { + return (*f)(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18) ; + } + + template + TRObject operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19) const { + return (*f)(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19) ; + } + + template + TRObject operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20) const { + return (*f)(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20) ; + } + +#endif diff --git a/bindings/r/inc/TRGraph.h b/bindings/r/inc/TRGraph.h deleted file mode 100644 index 6b61a697180f8..0000000000000 --- a/bindings/r/inc/TRGraph.h +++ /dev/null @@ -1,66 +0,0 @@ -// @(#)root/r:$Id$ -// Author: Omar Zapata 26/05/2014 - - -/************************************************************************* - * Copyright (C) 2014, Omar Andres Zapata Mesa * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ -#ifndef ROOT_R_TRGraph -#define ROOT_R_TRGraph - -#ifndef ROOT_TGraph -#include -#endif - -#ifndef ROOT_R_RExports -#include -#endif - -//________________________________________________________________________________________________________ -/** - This is TGraph class for R - - - @ingroup R -*/ - -namespace ROOT { - namespace R { - - class TRGraph: public TGraph { - public: - TRGraph(): TGraph() {}; - TRGraph(const TGraph &g): TGraph(g) {}; - TRGraph(Int_t n, std::vector x, std::vector y): TGraph(n, x.data(), y.data()){} - void Draw(){TGraph::Draw();} - void Draw(TString opt){TGraph::Draw(opt.Data());} - }; - } -} - -namespace Rcpp { - template<> SEXP wrap(const TGraph &f) - { - return Rcpp::wrap(ROOT::R::TRGraph(f)); - } - template<> TGraph as(SEXP f) - { - return Rcpp::as(f); - } -} - -ROOTR_EXPOSED_CLASS_INTERNAL(TRGraph) - -ROOTR_MODULE(ROOTR_TRGraph) -{ - ROOT::R::class_("TRGraph") - .constructor, std::vector >() - .method("Draw", (void (ROOT::R::TRGraph::*)())(&ROOT::R::TRGraph::Draw)) - .method("Draw", (void (ROOT::R::TRGraph::*)(TString))(&ROOT::R::TRGraph::Draw)) - ; -} -#endif diff --git a/bindings/r/inc/TRInterface.h b/bindings/r/inc/TRInterface.h index 7334521ba6419..cf50f295ef2d3 100644 --- a/bindings/r/inc/TRInterface.h +++ b/bindings/r/inc/TRInterface.h @@ -12,16 +12,20 @@ #ifndef ROOT_R_TRInterface #define ROOT_R_TRInterface -#ifndef ROOT_R_TRObjectProxy -#include +#ifndef ROOT_R_TRObject +#include #endif #ifndef ROOT_R_TRDataFrame #include #endif -#ifndef ROOT_R_TFunction -#include +#ifndef ROOT_R_TFunctionExport +#include +#endif + +#ifndef ROOT_R_TFunctionImport +#include #endif #ifndef ROOT_TThread @@ -29,29 +33,117 @@ #endif /** - @defgroup R R Interface for Statistical Computing - \ref ROOTR was implemented using the + @namespace ROOT::R + namespace associated R package for ROOT. + @defgroup R R Interface for Statistical Computing + */ +namespace ROOT { + namespace R { +/** +\class TRInterface + ROOT R was implemented using the R Project library and the modules Rcpp and RInside - @ingroup R +

Users Guide

+ http://oproject.org/tiki-index.php?page=ROOT+R+Users+Guide
+ https://root.cern.ch/drupal/content/how-use-r-root-root-r-interface + + \ingroup R */ + /** - @defgroup R R Interface for Statistical Computing - @ingroup R - */ +

TRInterface class

-////////////////////////////////////////////////////////////////////////// -// // -// TRInterface // -// // -// R Interface class for Statistical Computing. // -// // -////////////////////////////////////////////////////////////////////////// +

+The TRInterface class lets you procces R code from ROOT.
+You can call R libraries and their functions, plot results in R or ROOT,
+and use the power of ROOT and R at the same time.
+It also lets you pass scalars, vectors and matrices from ROOT to R
+and from R to ROOT using TRObject; but you can to use overloaded opetarors [],<< and >>
+to work with ROOTR like work with streams of data.
-namespace ROOT { - namespace R { +TRInterface class can not be instantiated directly, but you can create objects using the static methods +TRInterface& Instance() and TRInterface* InstancePtr() to create your own objects.
+
+

+Show an example below: +Create an exponential fit, the idea is to create a set of numbers x,y with noise from ROOT, +pass them to R and fit the data to \f$ x^3 \f$, get the fitted coefficient(power) and plot the data, +the known function and the fitted function. +\code{.cpp} + + TCanvas *c1 = new TCanvas("c1","Curve Fit",700,500); + c1->SetGrid(); + + // draw a frame for multiples graphs + TMultiGraph *mg = new TMultiGraph(); + + // create the first graph (points with gaussian noise) + const Int_t n = 24; + Double_t x[n] ; + Double_t y[n] ; + //Generate points along a X^3 with noise + TRandom rg; + rg.SetSeed(520); + for (Int_t i = 0; i < n; i++) { + x[i] = rg.Uniform(0, 1); + y[i] = TMath::Power(x[i], 3) + rg.Gaus() * 0.06; + } + + TGraph *gr1 = new TGraph(n,x,y); + gr1->SetMarkerColor(kBlue); + gr1->SetMarkerStyle(8); + gr1->SetMarkerSize(1); + mg->Add(gr1); + + // create second graph + TF1 *f_known=new TF1("f_known","pow(x,3)",0,1); + TGraph *gr2 = new TGraph(f_known); + gr2->SetMarkerColor(kRed); + gr2->SetMarkerStyle(8); + gr2->SetMarkerSize(1); + mg->Add(gr2); + + //passing x and y values to R for fitting + ROOT::R::TRInterface &r=ROOT::R::TRInterface::Instance(); + r["x"]<>power; + + TF1 *f_fitted=new TF1("f_fitted","pow(x,[0])",0,1); + f_fitted->SetParameter(0,power); + //plotting the fitted function + TGraph *gr3 = new TGraph(f_fitted); + gr3->SetMarkerColor(kGreen); + gr3->SetMarkerStyle(8); + gr3->SetMarkerSize(1); + + mg->Add(gr3); + mg->Draw("ap"); + + //displaying basic results + TPaveText *pt = new TPaveText(0.1,0.6,0.5,0.9,"brNDC"); + pt->SetFillColor(18); + pt->SetTextAlign(12); + pt->AddText("Fitting x^power "); + pt->AddText(" \"Blue\" Points with gaussian noise to be fitted"); + pt->AddText(" \"Red\" Known function x^3"); + TString fmsg; + fmsg.Form(" \"Green\" Fitted function with power=%.4lf",power); + pt->AddText(fmsg); + pt->Draw(); + c1->Update(); +\endcode +@ingroup R + */ class TRInterface: public TObject { protected: RInside *fR; @@ -70,17 +162,27 @@ namespace ROOT { fInterface->Assign(data, fName); return *this; } - Binding &operator=(const TRFunction &fun) { + Binding &operator=(const TRFunctionExport &fun) { //The method assign is not a template for a function fInterface->Assign(fun, fName); return *this; } - Binding &operator<<(const TRFunction &fun) { + Binding &operator<<(const TRFunctionExport &fun) { //The method assign is not a template for a function fInterface->Assign(fun, fName); return *this; } + + Binding &operator=(const TRDataFrame &df) { + fInterface->Assign(df, fName); + return *this; + } + + Binding &operator<<(const TRDataFrame &df) { + fInterface->Assign(df, fName); + return *this; + } template Binding &operator >>(T &var) { var = fInterface->Eval(fName).As(); @@ -101,35 +203,110 @@ namespace ROOT { TString fName; }; private: + /** + The command line arguments are by deafult argc=0 and argv=NULL, + The verbose mode is by default disabled but you can enable it to show procedures information in stdout/stderr \note some time can produce so much noise in the output + \param argc default 0 + \param args default null + \param loadRcpp default true + \param verbose default false + \param interactive default true + */ TRInterface(const int argc = 0, const char *argv[] = NULL, const bool loadRcpp = true, const bool verbose = false, const bool interactive = true); public: ~TRInterface(); + /** + Method to set verbose mode, that produce extra output + \note some time can produce so much noise in the output + \param status boolean to enable of disable + */ void SetVerbose(Bool_t status); - Int_t Eval(const TString &code, TRObjectProxy &ans); // parse line, returns in ans; error code rc - + /** + Method to eval R code and you get the result in a reference to TRObject + \param code R code + \param ands reference to TRObject + \return an true or false if the execution was sucessful or not. + */ + Int_t Eval(const TString &code, TRObject &ans); // parse line, returns in ans; error code rc + /** + Method to eval R code + \param code R code + */ void Execute(const TString &code); - TRObjectProxy Eval(const TString &code); + /** + Method to eval R code and you get the result in a TRObject + \param code R code + \return a TRObject with result + */ + TRObject Eval(const TString &code); - static void LoadModule(TString name); - //______________________________________________________________________________ + /** + Template method to assign C++ variables into R enviroment + \param var any R wrappable datatype + \param name name of the variable in R's enviroment + */ templatevoid Assign(const T &var, const TString &name) { // This method lets you pass variables from ROOT to R. // The template T should be a supported ROOT datatype and // the TString's name is the name of the variable in the R enviroment. fR->assign(var, name.Data()); } - void Assign(const TRFunction &fun, const TString &name); + /** + Method to assign TRFunctionExport in R's enviroment + \param fun TRFunctionExport + \param name name of the variable in R's enviroment + */ + void Assign(const TRFunctionExport &fun, const TString &name); + /** + Method to assign TRDataFrame in R's enviroment + \param df TRDataFrame + \param name name of the variable in R's enviroment + */ + void Assign(const TRDataFrame &df, const TString &name); + /** + Method to get a R prompt to work interactively with tab completation support + */ void Interactive(); + + /** + Init event loop in a thread to support actions in windows from R graphics system + */ void ProcessEventsLoop(); + + /** + Method to verify if a package is installed + \param pkg R's pkg name + \return true or false if the package is installed or not + */ Bool_t IsInstalled(TString pkg); + /** + Method to load an R's package + \param pkg R's pkg name + \return true or false if the package was loaded or not + */ Bool_t Require(TString pkg); + /** + Method to install an R's package + \param pkg R's pkg name + \param repos url for R's package repository + \return true or false if the package was installed or not + */ Bool_t Install(TString pkg,TString repos="http://cran.r-project.org"); Binding operator[](const TString &name); + + /** + static method to get an TRInterface instance reference + \return TRInterface instance reference + */ static TRInterface &Instance(); + /** + static method to get an TRInterface instance pointer + \return TRInterface instance pointer + */ static TRInterface *InstancePtr(); ClassDef(TRInterface, 0) diff --git a/bindings/r/inc/TRInterface_Binding.h b/bindings/r/inc/TRInterface_Binding.h index 4f2d7b77f6df9..efd9deac69e17 100644 --- a/bindings/r/inc/TRInterface_Binding.h +++ b/bindings/r/inc/TRInterface_Binding.h @@ -9,397 +9,397 @@ template Binding &operator=(OUT(*fun)(void)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52, U53 u53)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52, U53 u53, U54 u54)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52, U53 u53, U54 u54, U55 u55)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52, U53 u53, U54 u54, U55 u55, U56 u56)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52, U53 u53, U54 u54, U55 u55, U56 u56, U57 u57)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52, U53 u53, U54 u54, U55 u55, U56 u56, U57 u57, U58 u58)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52, U53 u53, U54 u54, U55 u55, U56 u56, U57 u57, U58 u58, U59 u59)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52, U53 u53, U54 u54, U55 u55, U56 u56, U57 u57, U58 u58, U59 u59, U60 u60)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52, U53 u53, U54 u54, U55 u55, U56 u56, U57 u57, U58 u58, U59 u59, U60 u60, U61 u61)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52, U53 u53, U54 u54, U55 u55, U56 u56, U57 u57, U58 u58, U59 u59, U60 u60, U61 u61, U62 u62)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52, U53 u53, U54 u54, U55 u55, U56 u56, U57 u57, U58 u58, U59 u59, U60 u60, U61 u61, U62 u62, U63 u63)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52, U53 u53, U54 u54, U55 u55, U56 u56, U57 u57, U58 u58, U59 u59, U60 u60, U61 u61, U62 u62, U63 u63, U64 u64)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } //////////////////////////// @@ -408,397 +408,397 @@ Binding &operator=(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 template Binding &operator<<(OUT(*fun)(void)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52, U53 u53)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52, U53 u53, U54 u54)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52, U53 u53, U54 u54, U55 u55)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52, U53 u53, U54 u54, U55 u55, U56 u56)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52, U53 u53, U54 u54, U55 u55, U56 u56, U57 u57)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52, U53 u53, U54 u54, U55 u55, U56 u56, U57 u57, U58 u58)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52, U53 u53, U54 u54, U55 u55, U56 u56, U57 u57, U58 u58, U59 u59)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52, U53 u53, U54 u54, U55 u55, U56 u56, U57 u57, U58 u58, U59 u59, U60 u60)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52, U53 u53, U54 u54, U55 u55, U56 u56, U57 u57, U58 u58, U59 u59, U60 u60, U61 u61)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52, U53 u53, U54 u54, U55 u55, U56 u56, U57 u57, U58 u58, U59 u59, U60 u60, U61 u61, U62 u62)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52, U53 u53, U54 u54, U55 u55, U56 u56, U57 u57, U58 u58, U59 u59, U60 u60, U61 u61, U62 u62, U63 u63)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } template Binding &operator<<(OUT(*fun)(U0 u0, U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7, U8 u8, U9 u9, U10 u10, U11 u11, U12 u12, U13 u13, U14 u14, U15 u15, U16 u16, U17 u17, U18 u18, U19 u19, U20 u20, U21 u21, U22 u22, U23 u23, U24 u24, U25 u25, U26 u26, U27 u27, U28 u28, U29 u29, U30 u30, U31 u31, U32 u32, U33 u33, U34 u34, U35 u35, U36 u36, U37 u37, U38 u38, U39 u39, U40 u40, U41 u41, U42 u42, U43 u43, U44 u44, U45 u45, U46 u46, U47 u47, U48 u48, U49 u49, U50 u50, U51 u51, U52 u52, U53 u53, U54 u54, U55 u55, U56 u56, U57 u57, U58 u58, U59 u59, U60 u60, U61 u61, U62 u62, U63 u63, U64 u64)) { - fInterface->Assign(TRFunction(fun), fName); + fInterface->Assign(TRFunctionExport(fun), fName); return *this; } #endif diff --git a/bindings/r/inc/TRObject.h b/bindings/r/inc/TRObject.h new file mode 100644 index 0000000000000..aa806be0a36e3 --- /dev/null +++ b/bindings/r/inc/TRObject.h @@ -0,0 +1,204 @@ +// @(#)root/r:$Id$ +// Author: Omar Zapata 29/05/2013 + +/************************************************************************* + * Copyright (C) 2013-2014, Omar Andres Zapata Mesa * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ +#ifndef ROOT_R_TRObject +#define ROOT_R_TRObject + +#ifndef ROOT_R_RExports +#include +#endif + + +namespace ROOT { + namespace R { + + /** + + This is a class to get ROOT's objects from R's objects +

TRObject class

+ +

+ The TRObject class lets you obtain ROOT's objects from R's objects.
+ It has some basic template opetarors to convert R's objects into ROOT's datatypes
+

+ A simple example
+

+ +

+ + \code{.cpp} + #include + void Proxy() + { + ROOT::R::TRInterface &r=ROOT::R::TRInterface::Instance(); + ROOT::R::TRObject obj; + obj=r.Eval("seq(1,10)"); + TVectorD v=obj; + v.Print(); + } + \endcode + Output + \code + + Vector (10) is as follows + + | 1 | + ------------------ + 0 |1 + 1 |2 + 2 |3 + 3 |4 + 4 |5 + 5 |6 + 6 |7 + 7 |8 + 8 |9 + 9 |10 + + \endcode + +

Users Guide

+ http://oproject.org/tiki-index.php?page=ROOT+R+Users+Guide
+ https://root.cern.ch/drupal/content/how-use-r-root-root-r-interface + + @ingroup R + */ + class TRObject: public TObject { + friend SEXP Rcpp::wrap(const TRObject &f); + private: + Rcpp::RObject fObj; //insternal Rcpp::RObject + Bool_t fStatus;//status tell if is a valid object + public: + /** + Default constructor + */ + TRObject(): TObject() {}; + /** + Construct a TRObject given a R base object + \param robj raw R object + */ + TRObject(SEXP robj); + /** + Construct a TRObject given a R base object + \param robj raw R object + \param status if the raw object is valid obj + */ + TRObject(SEXP robj, Bool_t status); + + /** + TRObject is a current valid object? + \param status if the current object is valid obj + */ + void SetStatus(Bool_t status) + { + fStatus = status; + } + + /** + TRObject is a current valid object? + \return status if the current object + */ + Bool_t GetStatus() + { + return fStatus; + } + + /** + The R objects can to have associate attributes + with this method you can added attribute to TRObject given an object in the template argument. + \param name attribute name + \param obj object associated to the attribute name in the current TRObject + */ + template void SetAttribute(const TString name, T obj) + { + fObj.attr(name.Data()) = obj; + } + + /** + The R objects can to have associate attributes + with this method you can added attribute to TRObject given an object in the template argument. + \param name attribute name + \return object associated to the attribute name in the current TRObject + */ + TRObject GetAttribute(const TString name) + { + return fObj.attr(name.Data()); + } + + void operator=(SEXP xx); + + /** + Some datatypes of ROOT or c++ can be wrapped in to a TRObject, + this method lets you wrap those datatypes + \param obj template object to be wrapped + \return TRObject reference of wrapped object + */ + template TRObject &Wrap(T obj) + { + fObj =::Rcpp::wrap(obj); + return *this; + } + + /** + Some datatypes of ROOT or c++ can be wrapped in to a TRObject, + this method lets you unwrap those datatypes encapsulate into this TRObject. + \note If the current TRObject is not a valid object it will return and empty object and it will print an error message + \return template return with the require datatype + */ + template T As() + { + if (fStatus) { + T data =::Rcpp::as(fObj); + return data; + } else { + Error("Cast Operator", "Can not make the requested data, returning an unknow value"); + return T(); + } + } + + template T operator=(TRObject &obj) + { + return ::Rcpp::as(obj); + } + + operator SEXP() + { + return fObj; + } + + operator SEXP() const + { + return fObj; + } + + operator Rcpp::RObject() + { + return fObj; + } + + template operator T() + { + + if (fStatus) { + T data =::Rcpp::as(fObj); + return data; + } else { + Error("Cast Operator", "Can not make the requested data, returning an unknow value"); + return T(); + } + } + ClassDef(TRObject, 0) // + }; + + } +} + + +#endif diff --git a/bindings/r/inc/TRObjectProxy.h b/bindings/r/inc/TRObjectProxy.h deleted file mode 100644 index bbaf252128914..0000000000000 --- a/bindings/r/inc/TRObjectProxy.h +++ /dev/null @@ -1,84 +0,0 @@ -// @(#)root/r:$Id$ -// Author: Omar Zapata 29/05/2013 - -/************************************************************************* - * Copyright (C) 2013-2014, Omar Andres Zapata Mesa * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ -#ifndef ROOT_R_TRObjectProxy -#define ROOT_R_TRObjectProxy - -#ifndef ROOT_R_RExports -#include -#endif - -//________________________________________________________________________________________________________ -/** - This is a class to get ROOT's objects from R's objects - - - @ingroup R -*/ - -namespace ROOT { - namespace R { - class TRObjectProxy: public TObject { - friend SEXP Rcpp::wrap(const TRObjectProxy &f); - private: - Rcpp::RObject x; - Bool_t fStatus;//status tell if is a valid object - public: - TRObjectProxy(): TObject() {}; - TRObjectProxy(SEXP xx); - TRObjectProxy(SEXP xx, Bool_t status); - - void SetStatus(Bool_t status){ fStatus = status;} - - Bool_t GetStatus() { return fStatus;} - - void operator=(SEXP xx); - - template TRObjectProxy& Wrap(T obj) { - x=::Rcpp::wrap(obj); - return *this; - } - - template T As() { - if(fStatus) - { - T data=::Rcpp::as(x); - return data; - }else - { - Error("Cast Operator", "Can not make the requested data, returning an unknow value"); - return T(); - } - } - - template T operator=(TRObjectProxy &obj) { - return ::Rcpp::as(obj); - } - - template operator T() { - - if(fStatus) - { - T data=::Rcpp::as(x); - return data; - }else - { - Error("Cast Operator", "Can not make the requested data, returning an unknow value"); - return T(); - } - } - ClassDef(TRObjectProxy, 0) // - }; - - } -} - - -#endif diff --git a/bindings/r/inc/TRRint.h b/bindings/r/inc/TRRint.h deleted file mode 100644 index 63bcae6e769b3..0000000000000 --- a/bindings/r/inc/TRRint.h +++ /dev/null @@ -1,59 +0,0 @@ -// @(#)root/r:$Id$ -// Author: Omar Zapata 30/05/2014 - - -/************************************************************************* - * Copyright (C) 2014, Omar Andres Zapata Mesa * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ -#ifndef ROOT_R_TRRINT -#define ROOT_R_TRRINT - -#ifndef ROOT_R_RExports -#include -#endif - -#ifndef ROOT_TRint -#include -#endif - -//________________________________________________________________________________________________________ -/** - This is TRint class for R - - - @ingroup R -*/ -//NOTE:the arguments for TRint like Int_t*argc and char** is not supported for Rcpp, -//then the class was rewritten -namespace ROOT { - namespace R { - - class TRRint: public TRint { - public: - TRRint(): TRint("ROOTR", 0, 0, 0, 0, kTRUE){} - TRRint(TString name): TRint(name.Data(), 0, 0, 0, 0, kTRUE){} - Long_t ProcessLine(TString line){return TRint::ProcessLine(line.Data());} - TString WorkingDirectory(){return TRint::WorkingDirectory();} - }; - } -} - - -ROOTR_MODULE(ROOTR_TRRint) -{ - - ROOT::R::class_("TRRint", "TRint class to create a ROOT application.") - .constructor() - .constructor() - .method("ProcessLine", (Long_t (ROOT::R::TRRint::*)(TString))&ROOT::R::TRRint::ProcessLine) - .method("Run", (void (ROOT::R::TRRint::*)(Bool_t))&ROOT::R::TRRint::Run) - .method("Terminate", (void (ROOT::R::TRRint::*)(Int_t))&ROOT::R::TRRint::Terminate) - .method("WorkingDirectory", (TString (ROOT::R::TRRint::*)())(&ROOT::R::TRRint::WorkingDirectory)) - ; -} - -#endif diff --git a/bindings/r/inc/TRSystem.h b/bindings/r/inc/TRSystem.h deleted file mode 100644 index ceb18a49a56e6..0000000000000 --- a/bindings/r/inc/TRSystem.h +++ /dev/null @@ -1,96 +0,0 @@ -// @(#)root/r:$Id$ -// Author: Omar Zapata 11/06/2014 - - -/************************************************************************* - * Copyright (C) 2014, Omar Andres Zapata Mesa * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ -#ifndef ROOT_R_TRSYSTEM -#define ROOT_R_TRSYSTEM - -#ifndef ROOT_R_RExports -#include -#endif - -#ifndef ROOT_TSystem -#include -#endif - -#ifndef ROOT_TThread -#include -#endif - -#ifndef ROOT_TApplication -#include -#endif - -//________________________________________________________________________________________________________ -/** - This is a gSystem wrap for R - - - @ingroup R -*/ -namespace ROOT { - namespace R { - - class TRSystem: public TObject { - private: - TThread *th; - public: - TRSystem(); - ~TRSystem() { - if (th) delete th; - } - void ProcessEventsLoop(); - Int_t Load(TString module); - }; - } -} - -ROOTR_EXPOSED_CLASS_INTERNAL(TRSystem) - - -//______________________________________________________________________________ -ROOT::R::TRSystem::TRSystem(): TObject() -{ - th = nullptr; -} - -//______________________________________________________________________________ -void ROOT::R::TRSystem::ProcessEventsLoop() -{ - if (!gApplication) { - Error("TRSystem", "Running ProcessEventsLoop without global object gApplication."); - return; - } - th = new TThread([](void * args) { - while (kTRUE) { - gSystem->ProcessEvents(); - gSystem->Sleep(100); - } - }, (void *)this); - th->Run(); -} - -//______________________________________________________________________________ -Int_t ROOT::R::TRSystem::Load(TString module) -{ - return gSystem->Load(module.Data()); -} - -ROOTR_MODULE(ROOTR_TRSystem) -{ - - ROOT::R::class_("TRSystem", "TSystem class to manipulate ROOT's Process.") - .constructor() - .method("ProcessEventsLoop", &ROOT::R::TRSystem::ProcessEventsLoop) - .method("Load", (Int_t(ROOT::R::TRSystem::*)(TString))&ROOT::R::TRSystem::Load) - ; -} - -#endif diff --git a/bindings/r/src/RExports.cxx b/bindings/r/src/RExports.cxx index 7c470854c3dae..fc1ee4a607387 100644 --- a/bindings/r/src/RExports.cxx +++ b/bindings/r/src/RExports.cxx @@ -6,10 +6,13 @@ * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #include -#include -#include +#include +#include #include #include + +Rcpp::internal::NamedPlaceHolder ROOT::R::Label; + namespace Rcpp { //TVectorT template<> SEXP wrap(const TVectorT &v) @@ -70,15 +73,15 @@ namespace Rcpp { return TMatrixT(mat.rows(), mat.cols(), &dat[0], "F"); } -//TRObjectProxy - template<> SEXP wrap(const ROOT::R::TRObjectProxy &obj) +//TRObject + template<> SEXP wrap(const ROOT::R::TRObject &obj) { - return obj.x; + return obj.fObj; } - template<> ROOT::R::TRObjectProxy as(SEXP obj) + template<> ROOT::R::TRObject as(SEXP obj) { - return ROOT::R::TRObjectProxy(obj); + return ROOT::R::TRObject(obj); } //TRDataFrame template<> SEXP wrap(const ROOT::R::TRDataFrame &obj) @@ -90,6 +93,17 @@ namespace Rcpp { { return ROOT::R::TRDataFrame(Rcpp::as(obj)); } + +//TRFunctionImport + template<> SEXP wrap(const ROOT::R::TRFunctionImport &obj) + { + return *obj.f; + } + + template<> ROOT::R::TRFunctionImport as(SEXP obj) + { + return ROOT::R::TRFunctionImport(Rcpp::as(obj)); + } } namespace ROOT { diff --git a/bindings/r/src/TRDataFrame.cxx b/bindings/r/src/TRDataFrame.cxx index 02486ab048bcf..8d2638e64f9c2 100644 --- a/bindings/r/src/TRDataFrame.cxx +++ b/bindings/r/src/TRDataFrame.cxx @@ -6,227 +6,25 @@ * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #include -//////////////////////////////////////////////////////////////////////////////// - -/* Begin_Html -

TRDataFrame class

- -DataFrame? is a very important datatype in R and in ROOTR we have a class to manipulate
-dataframes called TRDataFrame, with a lot of very useful operators overloaded to work with TRDataFrame's objects
-in a similar way that in the R environment but from c++ in ROOT.
-Example:
-
-Lets to create need data to play with dataframe features
-End_Html - -Begin_Html -
-///////////////////////////////////
-//creating variables///
-//////////////////////////////////
-End_Html -TVectorD v1(3); -std::vector v2(3); -std::array v3{ {1,2,3} }; -std::list names; - -Begin_Html -//////////////////////////////////
-//assigning values//
-//////////////////////////////////
-End_Html -v1[0]=1; -v1[1]=2; -v1[2]=3; - -v2[0]=0.101; -v2[1]=0.202; -v2[2]=0.303; - -names.push_back("v1"); -names.push_back("v2"); -names.push_back("v3"); - -ROOT::R::TRInterface &r=ROOT::R::TRInterface::Instance(); -Begin_Html -
-End_Html - -Begin_Html -In R the dataframe have associate to every column a label, -in ROOTR you can have the same label using the class ROOT::R::Label to create a TRDataFrame where you data -have a label associate. -End_Html - -Begin_Html -
-///////////////////////////////////////////////////////////////////
-//creating dataframe object with its labels//
-///////////////////////////////////////////////////////////////////
-End_Html -using namespace ROOT::R; -TRDataFrame df1(Label["var1"]=v1,Label["var2"]=v2,Label["var3"]=v3,Label["strings"]=names); -Begin_Html -//////////////////////////////////////////////////////////////////
-//Passing dataframe to R's environment//
-/////////////////////////////////////////////////////////////////
-End_Html -r["df1"]< -End_Html - - -Output -var1 var2 var3 strings -1 1 0.101 1 v1 -2 2 0.202 2 v2 -3 3 0.303 3 v3 - - -Begin_Html -Manipulating data between dataframes -End_Html - -Begin_Html -
-/////////////////////////////////////////////////////
-//Adding colunms to dataframe //
-/////////////////////////////////////////////////////
-End_Html - -TVectorD v4(3); -//filling the vector fro R's environment -r["c(-1,-2,-3)"]>>v4; -//adding new colunm to df1 with name var4 -df1["var4"]=v4; -//updating df1 in R's environment -r["df1"]< -End_Html - - -Output -var1 var2 var3 strings var4 -1 1 0.101 1 v1 -1 -2 2 0.202 2 v2 -2 -3 3 0.303 3 v3 -3 - - -Getting data frames from R's environment - -Begin_Html -
-/////////////////////////////////////////////////////////////////////
-//Getting dataframe from R's environment//
-/////////////////////////////////////////////////////////////////////
-End_Html -ROOT::R::TRDataFrame df2; - -r<<"df2<-data.frame(v1=c(0.1,0.2,0.3),v2=c(3,2,1))"; -r["df2"]>>df2; - -TVectorD v(3); -df2["v1"]>>v; -v.Print(); - -df2["v2"]>>v; -v.Print(); -Begin_Html -
-End_Html - -Output -Vector (3) is as follows - - | 1 | ------------------- - 0 |0.1 - 1 |0.2 - 2 |0.3 - -Vector (3) is as follows - - | 1 | ------------------- - 0 |3 - 1 |2 - 2 |1 - - -Begin_Html -
-/////////////////////////////////////////////////////////////////////////
-//Working with colunms between dataframes//
-/////////////////////////////////////////////////////////////////////////
-End_Html - -df2["v3"]< -End_Html - - -Output -v1 v2 v3 -1 0.1 3 v1 -2 0.2 2 v2 -3 0.3 1 v3 - - -Begin_Html -
-//////////////////////////////////////////////////////////////////////
-//Working with colunms between dataframes//
-//////////////////////////////////////////////////////////////////////
-End_Html - -//passing values from colunm v3 of df2 to var1 of df1 -df2["v3"]>>df1["var1"]; -//updating df1 in R's environment -r["df1"]< -End_Html - - -Output -var1 var2 var3 strings var4 -1 v1 0.101 1 v1 -1 -2 v2 0.202 2 v2 -2 -3 v3 0.303 3 v3 -3 -*/ using namespace ROOT::R; ClassImp(TRDataFrame) -//////////////////////////////////////////////////////////////////////////////// - +//______________________________________________________________________________ TRDataFrame::TRDataFrame(): TObject() { df = Rcpp::DataFrame::create(); } -//////////////////////////////////////////////////////////////////////////////// - +//______________________________________________________________________________ TRDataFrame::TRDataFrame(const TRDataFrame &_df): TObject(_df) { df = _df.df; } -//////////////////////////////////////////////////////////////////////////////// - +//______________________________________________________________________________ TRDataFrame::Binding TRDataFrame::operator[](const TString &name) { return Binding(df,name); diff --git a/bindings/r/src/TRFunction.cxx b/bindings/r/src/TRFunction.cxx deleted file mode 100644 index a9cb53e9c3ccf..0000000000000 --- a/bindings/r/src/TRFunction.cxx +++ /dev/null @@ -1,133 +0,0 @@ -/************************************************************************* - * Copyright (C) 2013-2014, Omar Andres Zapata Mesa * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ -#include -//////////////////////////////////////////////////////////////////////////////// - -/* Begin_Html -

TRFunction class

- -

-The TRFunction class lets you pass ROOT's functions to R's environment
-

-

-The next example was based in
- -http://root.cern.ch/root/html/tutorials/fit/NumericalMinimization.C.html -
- -http://stat.ethz.ch/R-manual/R-devel/library/stats/html/optim.html
- -

-End_Html -Begin_Latex - -Let f(x,y)=(x-1)^{2} + 100(y-x^{2})^{2}, which is called the Rosenbrock -function. - -It's known that this function has a minimum when y = x^{2} , and x = 1. -Let's get the minimum using R's optim package through ROOTR's interface. -In the code this function was called "Double_t RosenBrock(const TVectorD xx )", because for -optim, the input in your function definition must be a single vector. - - -The Gradient is formed by -#frac{#partial f}{#partial x} = -400x(y - x^{2}) - 2(1 - x) - -#frac{#partial f}{#partial y} = 200(y - x^{2}); - -The "TVectorD RosenBrockGrad(const TVectorD xx )" function -must have a single vector as the argument a it will return a single vetor. - -End_Latex -Begin_Html -
-End_Html - -#include - -//in the next function the pointer *double must be changed by TVectorD, because the pointer has no -//sense in R's environment. -Double_t RosenBrock(const TVectorD xx ) -{ - const Double_t x = xx[0]; - const Double_t y = xx[1]; - const Double_t tmp1 = y-x*x; - const Double_t tmp2 = 1-x; - return 100*tmp1*tmp1+tmp2*tmp2; -} - -TVectorD RosenBrockGrad(const TVectorD xx ) -{ - const Double_t x = xx[0]; - const Double_t y = xx[1]; - TVectorD grad(2); - grad[0]=-400 * x * (y - x * x) - 2 * (1 - x); - grad[1]=200 * (y - x * x); - return grad; -} - - -void Minimization() -{ - ROOT::R::TRInterface &r=ROOT::R::TRInterface::Instance(); - //passing RosenBrock function to R - r["RosenBrock"]< -//////////////////////////////////////////////////////////////////////////////// - -/* Begin_Html -

TRInterface class

- -

-The TRInterface class lets you procces R code from ROOT.
-You can call R libraries and their functions, plot results in R or ROOT,
-and use the power of ROOT and R at the same time.
-It also lets you pass scalars, vectors and matrices from ROOT to R
-and from R to ROOT using TRObjectProxy; but you can to use overloaded opetarors [],<< and >>
-to work with ROOTR like work with streams of data.
- -TRInterface class can not be instantiated directly, but you can create objects using the static methods -TRInterface& Instance() and TRInterface* InstancePtr() to create your own objects.
-
-

-Show an example below: -End_Html -Begin_Macro(source) -{ - -//Create an exponential fit -//The idea is to create a set of numbers x,y with noise from ROOT, -//pass them to R and fit the data to x^3, -//get the fitted coefficient(power) and plot the data, -//the known function and the fitted function. -//Author:: Omar Zapata - TCanvas *c1 = new TCanvas("c1","Curve Fit",700,500); - c1->SetGrid(); - - // draw a frame for multiples graphs - TMultiGraph *mg = new TMultiGraph(); - - // create the first graph (points with gaussian noise) - const Int_t n = 24; - Double_t x[n] ; - Double_t y[n] ; - //Generate points along a X^3 with noise - TRandom rg; - rg.SetSeed(520); - for (Int_t i = 0; i < n; i++) { - x[i] = rg.Uniform(0, 1); - y[i] = TMath::Power(x[i], 3) + rg.Gaus() * 0.06; - } - - TGraph *gr1 = new TGraph(n,x,y); - gr1->SetMarkerColor(kBlue); - gr1->SetMarkerStyle(8); - gr1->SetMarkerSize(1); - mg->Add(gr1); - - // create second graph - TF1 *f_known=new TF1("f_known","pow(x,3)",0,1); - TGraph *gr2 = new TGraph(f_known); - gr2->SetMarkerColor(kRed); - gr2->SetMarkerStyle(8); - gr2->SetMarkerSize(1); - mg->Add(gr2); - - //passing x and y values to R for fitting - ROOT::R::TRInterface &r=ROOT::R::TRInterface::Instance(); - r["x"]<>power; - - TF1 *f_fitted=new TF1("f_fitted","pow(x,[0])",0,1); - f_fitted->SetParameter(0,power); - //plotting the fitted function - TGraph *gr3 = new TGraph(f_fitted); - gr3->SetMarkerColor(kGreen); - gr3->SetMarkerStyle(8); - gr3->SetMarkerSize(1); - - mg->Add(gr3); - mg->Draw("ap"); - - //displaying basic results - TPaveText *pt = new TPaveText(0.1,0.6,0.5,0.9,"brNDC"); - pt->SetFillColor(18); - pt->SetTextAlign(12); - pt->AddText("Fitting x^power "); - pt->AddText(" \"Blue\" Points with gaussian noise to be fitted"); - pt->AddText(" \"Red\" Known function x^3"); - TString fmsg; - fmsg.Form(" \"Green\" Fitted function with power=%.4lf",power); - pt->AddText(fmsg); - pt->Draw(); - c1->Update(); - return c1; -} -End_Macro */ - using namespace ROOT::R; ClassImp(TRInterface) static ROOT::R::TRInterface *gR = NULL; static Bool_t statusEventLoop; -//////////////////////////////////////////////////////////////////////////////// -/// The command line arguments are by deafult argc=0 and argv=NULL, -/// The verbose mode is by default disabled but you can enable it to show procedures information in stdout/stderr - TRInterface::TRInterface(const int argc, const char *argv[], const bool loadRcpp, const bool verbose, const bool interactive): TObject() { if (RInside::instancePtr()) throw std::runtime_error("Can only have one TRInterface instance"); @@ -142,6 +39,15 @@ TRInterface::TRInterface(const int argc, const char *argv[], const bool loadRcpp RComp_retrieveCompsSym = Rf_install(".retrieveCompletions"); rl_attempted_completion_function = R_custom_completion; statusEventLoop = kFALSE; + std::string osname=Eval("Sys.info()['sysname']"); + //only for linux/mac windows is not supported by ROOT yet. + if(osname=="Linux") + { + Execute("options(device='x11')"); + }else{ + Execute("options(device='quartz')"); + } + } TRInterface::~TRInterface() @@ -149,51 +55,12 @@ TRInterface::~TRInterface() if (th) delete th; } -void TRInterface::LoadModule(TString name) -{ - //Method to load wrapped ROOT's classes into R's environment - //e.g: r.LoadModule("Hist") load the current(partially) wrapped classes TF1 and TGraph - if (name == "Hist") { - gApplication->ProcessLine("#include"); - gApplication->ProcessLine("LOAD_ROOTR_MODULE(ROOTR_TRF1);"); - gR->Execute("TF1 <- .GlobalEnv$.__C__Rcpp_TRF1"); - - gApplication->ProcessLine("#include"); - gApplication->ProcessLine("LOAD_ROOTR_MODULE(ROOTR_TRGraph);"); - gR->Execute("TGraph <- .GlobalEnv$.__C__Rcpp_TRGraph"); - - } - if (name == "Gpad") { - gApplication->ProcessLine("#include"); - gApplication->ProcessLine("LOAD_ROOTR_MODULE(ROOTR_TRCanvas);"); - gR->Execute("TCanvas <- .GlobalEnv$.__C__Rcpp_TRCanvas"); - } - if (name == "Rint") { - gApplication->ProcessLine("#include"); - gApplication->ProcessLine("LOAD_ROOTR_MODULE(ROOTR_TRRint);"); - gR->Execute("TRint <- .GlobalEnv$.__C__Rcpp_TRRint"); - } - if (name == "Core") { - gApplication->ProcessLine("#include"); - gApplication->ProcessLine("LOAD_ROOTR_MODULE(ROOTR_TRSystem);"); - } - if (name == "IO") { - gApplication->ProcessLine("#include"); - gApplication->ProcessLine("LOAD_ROOTR_MODULE(ROOTR_TRFile);"); - gR->Execute("TFile <- .GlobalEnv$.__C__Rcpp_TRFile"); - } - -} - - -//////////////////////////////////////////////////////////////////////////////// -/// Parse R code and returns status of execution. -/// the RObject's response is saved in ans - -Int_t TRInterface::Eval(const TString &code, TRObjectProxy &ans) +//______________________________________________________________________________ +Int_t TRInterface::Eval(const TString &code, TRObject &ans) { SEXP fans; - Int_t rc = 0; + + Int_t rc=kFALSE; try{ rc = fR->parseEval(code.Data(), fans); } @@ -207,9 +74,7 @@ Int_t TRInterface::Eval(const TString &code, TRObjectProxy &ans) return rc; } -//////////////////////////////////////////////////////////////////////////////// -/// Execute R code. - +//______________________________________________________________________________ void TRInterface::Execute(const TString &code) { try{ @@ -223,14 +88,15 @@ void TRInterface::Execute(const TString &code) catch(...){Error("Execute", "Can execute the requested code: %s",code.Data());} } -//////////////////////////////////////////////////////////////////////////////// -/// Execute R code. -///The RObject result of execution is returned in TRObjectProxy - -TRObjectProxy TRInterface::Eval(const TString &code) +//______________________________________________________________________________ +TRObject TRInterface::Eval(const TString &code) { +// Execute R code. +//The RObject result of execution is returned in TRObject + SEXP ans; - int rc = 0; + + int rc=kFALSE; try{ rc = fR->parseEval(code.Data(), ans); } @@ -240,7 +106,7 @@ TRObjectProxy TRInterface::Eval(const TString &code) } catch(...){Error("Eval", "Can execute the requested code: %s",code.Data());} - return TRObjectProxy(ans , (rc == 0) ? kTRUE : kFALSE); + return TRObject(ans , (rc == 0) ? kTRUE : kFALSE); } @@ -251,25 +117,26 @@ void TRInterface::SetVerbose(Bool_t status) fR->setVerbose(status); } -//////////////////////////////////////////////////////////////////////////////// - +//______________________________________________________________________________ TRInterface::Binding TRInterface::operator[](const TString &name) { return Binding(this, name); } -//////////////////////////////////////////////////////////////////////////////// -///This method lets you pass c++ functions to R environment. - -void TRInterface::Assign(const TRFunction &obj, const TString &name) +//______________________________________________________________________________ +void TRInterface::Assign(const TRFunctionExport &obj, const TString &name) { fR->assign(*obj.f, name.Data()); } -//////////////////////////////////////////////////////////////////////////////// -///This method launches a R command line to run directly R code which you can -///pass to ROOT calling the apropiate method. +//______________________________________________________________________________ +void TRInterface::Assign(const TRDataFrame &obj, const TString &name) +{ + //This method lets you pass c++ functions to R environment. + fR->assign(obj.df, name.Data()); +} +//______________________________________________________________________________ void TRInterface::Interactive() { while (kTRUE) { @@ -283,9 +150,7 @@ void TRInterface::Interactive() } -//////////////////////////////////////////////////////////////////////////////// -///return a pointer to TRInterface. - +//______________________________________________________________________________ TRInterface *TRInterface::InstancePtr() { if (!gR) { @@ -296,26 +161,27 @@ TRInterface *TRInterface::InstancePtr() return gR; } -//////////////////////////////////////////////////////////////////////////////// -///return a reference object of TRInterface. - +//______________________________________________________________________________ TRInterface &TRInterface::Instance() { return *TRInterface::InstancePtr(); } +//______________________________________________________________________________ Bool_t TRInterface::IsInstalled(TString pkg) { TString cmd="is.element('"+pkg+"', installed.packages()[,1])"; return fR->parseEval(cmd.Data()); } +//______________________________________________________________________________ Bool_t TRInterface::Require(TString pkg) { TString cmd="require('"+pkg+"',quiet=TRUE)"; return fR->parseEval(cmd.Data()); } +//______________________________________________________________________________ Bool_t TRInterface::Install(TString pkg,TString repos) { TString cmd="install.packages('"+pkg+"',repos='"+repos+"',dependencies=TRUE)"; @@ -327,9 +193,7 @@ Bool_t TRInterface::Install(TString pkg,TString repos) #undef _POSIX_C_SOURCE #include -//////////////////////////////////////////////////////////////////////////////// -///run the R's eventloop to process graphics events - +//______________________________________________________________________________ void TRInterface::ProcessEventsLoop() { if (!statusEventLoop) { diff --git a/bindings/r/src/TRObject.cxx b/bindings/r/src/TRObject.cxx new file mode 100644 index 0000000000000..1f29cedbc281c --- /dev/null +++ b/bindings/r/src/TRObject.cxx @@ -0,0 +1,26 @@ +/************************************************************************* + * Copyright (C) 2013-2014, Omar Andres Zapata Mesa * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ +#include +#include + +using namespace ROOT::R; +ClassImp(TRObject) + +//______________________________________________________________________________ +TRObject::TRObject(SEXP robj): TObject(), fObj(robj),fStatus(kTRUE) { } + + +//______________________________________________________________________________ +void TRObject::operator=(SEXP robj) +{ + fStatus=kTRUE; + fObj = robj; +} + +//______________________________________________________________________________ +TRObject::TRObject(SEXP robj, Bool_t status): fObj(robj), fStatus(status) {} diff --git a/bindings/r/src/TRObjectProxy.cxx b/bindings/r/src/TRObjectProxy.cxx deleted file mode 100644 index c6ee68d43feb7..0000000000000 --- a/bindings/r/src/TRObjectProxy.cxx +++ /dev/null @@ -1,51 +0,0 @@ -/************************************************************************* - * Copyright (C) 2013-2014, Omar Andres Zapata Mesa * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ -#include -#include -//////////////////////////////////////////////////////////////////////////////// - -/* Begin_Html -

TRObjectProxy class

- -

-The TRObjectProxy class lets you obtain ROOT's objects from R's objects.
-It has some basic template opetarors to convert R's objects into ROOT's datatypes
-

-A simple example
-

- -

-
-End_Html -#include -void Proxy() -{ -ROOT::R::TRInterface &r=ROOT::R::TRInterface::Instance(); -ROOT::R::TRObjectProxy obj; -obj=r.ParseEval("seq(1,10)"); -TVectorD v=obj; -v.Print(); -} -*/ - -using namespace ROOT::R; -ClassImp(TRObjectProxy) - -//______________________________________________________________________________ -TRObjectProxy::TRObjectProxy(SEXP xx): TObject(), x(xx) { } - - -//////////////////////////////////////////////////////////////////////////////// - -void TRObjectProxy::operator=(SEXP xx) -{ - x = xx; -} - -//______________________________________________________________________________ -TRObjectProxy::TRObjectProxy(SEXP xx, Bool_t status): x(xx), fStatus(status) { } diff --git a/bindings/r/tests/Binding.C b/bindings/r/tests/Binding.C index 6d8564923ffa4..0f0bb773081cb 100644 --- a/bindings/r/tests/Binding.C +++ b/bindings/r/tests/Binding.C @@ -90,7 +90,7 @@ r<<"print(s)"; // r["d"]<>dfm; + dfm.Print(); + + dfm.Print("v1"); + + TMatrixT m=dfm.AsMatrix(); + m.Print(); + //Error Handling /* std::cout<<"------------------------------------\n"; try{ diff --git a/bindings/r/tests/Functions.C b/bindings/r/tests/Functions.C index 9bd076a12255c..a23b316d20cee 100644 --- a/bindings/r/tests/Functions.C +++ b/bindings/r/tests/Functions.C @@ -16,7 +16,7 @@ void funs(TString s) std::cout << "hello " << s.Data() << std::endl; } -//this prototype dont work because argument should be +//this prototype dont work because argument should be //an object to pass an array. Double_t fun3(Double_t *x, Double_t *par) { @@ -29,33 +29,93 @@ Double_t fun4(Double_t x) } -void Functions() +void Functions(TString type = "Import") { - ROOT::R::TRInterface &r=ROOT::R::TRInterface::Instance(); + ROOT::R::TRInterface &r = ROOT::R::TRInterface::Instance(); r.SetVerbose(kFALSE); + if (type == "Export") { + std::cout << "-----------------------" << std::endl; + std::cout << "Testing FunctionExport" << std::endl; + std::cout << "-----------------------" << std::endl; + r["funv"] << ROOT::R::TRFunctionExport(funv); + r << "print(funv(c(2,3)))"; - r["funv"]<()); + print(head(Rcpp::wrap(obj))); + print(head(obj)); + x11(); + plot(sin,0,6,ROOT::R::Label["type"]="s"); + x11(); + plot(sin,0,6,ROOT::R::Label["type"]="l"); + x11(); + plot(sin,0,6,ROOT::R::Label["type"]="p"); + + + +// devoff(); +// print(vector); + +// require("C50"); + } } diff --git a/bindings/r/tests/Object.C b/bindings/r/tests/Object.C new file mode 100644 index 0000000000000..a40c6bac319df --- /dev/null +++ b/bindings/r/tests/Object.C @@ -0,0 +1,30 @@ +//script to test TRFunction +#include + +ROOT::R::TRInterface &r = ROOT::R::TRInterface::Instance(); + +void Object() +{ +// r.SetVerbose(kFALSE); + ROOT::R::TRFunctionImport print("print"); + + ROOT::R::TRFunctionImport c("c"); + ROOT::R::TRFunctionImport cat("cat"); + ROOT::R::TRFunctionImport require("require"); + ROOT::R::TRFunctionImport head("head"); + ROOT::R::TRFunctionImport attributes("attributes"); + + ROOT::R::TRObject vector=c(1,2,3,4); + ROOT::R::TRObject v=vector; + v.SetAttribute("Size",4); + v.SetAttribute("Name","TestVector"); +// v.SetAttribute("NameNull",NULL); + + int s=v.GetAttribute("Size"); + TString name=v.GetAttribute("Name"); + + + print(attributes(v)); + print(cat("ROOT:",s)); + print(cat("ROOT:",name)); +} diff --git a/bindings/r/tests/training.csv b/bindings/r/tests/training.csv new file mode 100644 index 0000000000000..56c2e063b47d2 --- /dev/null +++ b/bindings/r/tests/training.csv @@ -0,0 +1,4 @@ +var1,var2,class +1.01,2.3, s +0.01,0.1, b + diff --git a/configure b/configure index f55e8ac2c1485..adae54f036317 100755 --- a/configure +++ b/configure @@ -200,7 +200,7 @@ if test "x$ENABLEALL" = "xyes"; then enable_unuran=yes enable_vc=yes enable_vdt=yes - #enable_r=yes + enable_r=yes fi # Remove old log file diff --git a/documentation/doxygen/Doxyfile b/documentation/doxygen/Doxyfile index 655ac398bd54c..61e4592f9c54a 100644 --- a/documentation/doxygen/Doxyfile +++ b/documentation/doxygen/Doxyfile @@ -800,7 +800,8 @@ INPUT = ../../core/base/ \ ../../tree \ ../../sql/ \ ../../gui/gui/ \ - ../../gui/fitpanel/ + ../../gui/fitpanel/ \ + ../../bindings/r/ # ../../gui/ged/ \ @@ -935,7 +936,7 @@ EXAMPLE_RECURSIVE = NO # that contain images that are to be included in the documentation (see the # \image command). -IMAGE_PATH = $(DOXYGEN_OUTPUT_DIRECTORY)/html +IMAGE_PATH = $(DOXYGEN_OUTPUT_DIRECTORY)/html ../../bindings/r/doc/users-guide/img/ # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program diff --git a/math/rtools/src/RMinimizer.cxx b/math/rtools/src/RMinimizer.cxx index e5b2f3c0d0358..fbc027af7b78a 100644 --- a/math/rtools/src/RMinimizer.cxx +++ b/math/rtools/src/RMinimizer.cxx @@ -1,6 +1,6 @@ #include "TRInterface.h" -#include "TRObjectProxy.h" +#include "TRObject.h" #include "Math/RMinimizer.h" #include "Math/IFunction.h" #include @@ -56,8 +56,8 @@ namespace ROOT { //pass functions and variables to R ROOT::R::TRInterface &r=ROOT::R::TRInterface::Instance(); - r["minfunction"] = ROOT::R::TRFunction((minfunction)); - r["mingradfunction"] = ROOT::R::TRFunction((mingradfunction)); + r["minfunction"] = ROOT::R::TRFunctionExport((minfunction)); + r["mingradfunction"] = ROOT::R::TRFunctionExport((mingradfunction)); r["method"] = fMethod.c_str(); std::vector stepSizes(StepSizes(), StepSizes()+NDim()); std::vector values(X(), X()+NDim()); diff --git a/tutorials/r/Function.C b/tutorials/r/Function.C new file mode 100644 index 0000000000000..7fc0f1755b47f --- /dev/null +++ b/tutorials/r/Function.C @@ -0,0 +1,51 @@ +#include + +using namespace ROOT::R; +void Function() +{ + TRInterface &r = TRInterface::Instance(); + r.SetVerbose(1); + //////////////////////////////////////// + //defining functions to be used from R// + //////////////////////////////////////// + TRFunctionImport c("c"); + TRFunctionImport list("list"); + TRFunctionImport asformula("as.formula"); + TRFunctionImport nls("nls"); + TRFunctionImport confint("confint"); + TRFunctionImport summary("summary"); + TRFunctionImport print("print"); + TRFunctionImport plot("plot"); + TRFunctionImport lines("lines"); + TRFunctionImport devnew("dev.new"); + TRFunctionImport devoff("dev.off"); + TRFunctionImport min("min"); + TRFunctionImport max("max"); + TRFunctionImport seq("seq"); + TRFunctionImport predict("predict"); + + r<<"options(device='png')"; + + //////////////////////// + //doing the procedure // + //////////////////////// + TRObject xdata = c(-2,-1.64,-1.33,-0.7,0,0.45,1.2,1.64,2.32,2.9); + TRObject ydata = c(0.699369,0.700462,0.695354,1.03905,1.97389,2.41143,1.91091,0.919576,-0.730975,-1.42001); + + TRDataFrame data; + data["xdata"]=xdata; + data["ydata"]=ydata; + + // fit = nls(ydata ~ p1*cos(p2*xdata) + p2*sin(p1*xdata), start=list(p1=1,p2=0.2)) + TRObject fit = nls(asformula("ydata ~ p1*cos(p2*xdata) + p2*sin(p1*xdata)"),Label["data"]=data, Label["start"]=list(Label["p1"]=1,Label["p2"]=0.2)); + print(summary(fit)); + + print(confint(fit)); + + devnew("Fitting Regression"); + plot(xdata,ydata); + + TRObject xgrid=seq(min(xdata),max(xdata),Label["len"]=10); + lines(xgrid,predict(fit,xgrid),Label["col"] = "green"); + devoff(); +} diff --git a/tutorials/r/GlobalMinimization.C b/tutorials/r/GlobalMinimization.C index e8a21413fe9b4..043bca426c45f 100644 --- a/tutorials/r/GlobalMinimization.C +++ b/tutorials/r/GlobalMinimization.C @@ -51,7 +51,7 @@ void GlobalMinimization() r<<"suppressMessages(library(DEoptim, quietly = TRUE))"; // passing RosenBrock function to R - r["GenRosenBrock"]<IsBatch()) { r<<"dev.new(title='RosenBrock Convergence')"; r<<"plot(result1,type='o',pch='.')"; + r<<"dev.off()"; r<<"dev.new(title='Rastrigin Convergence')"; r<<"plot(result2,type='o',pch='.')"; + r<<"dev.off()"; } } diff --git a/tutorials/r/Integration.C b/tutorials/r/Integration.C index ce7439e2556c3..64cacab37e366 100644 --- a/tutorials/r/Integration.C +++ b/tutorials/r/Integration.C @@ -29,7 +29,7 @@ void Integration() ROOT::R::TRInterface &r=ROOT::R::TRInterface::Instance(); - r["BreitWigner"]=ROOT::R::TRFunction(BreitWignerVectorized); + r["BreitWigner"]=ROOT::R::TRFunctionExport(BreitWignerVectorized); Double_t value=r.Eval("integrate(BreitWigner, lower = -2, upper = 2)$value"); diff --git a/tutorials/r/Interpolation.C b/tutorials/r/Interpolation.C index 439282d396627..16d459a2db9fd 100644 --- a/tutorials/r/Interpolation.C +++ b/tutorials/r/Interpolation.C @@ -26,7 +26,7 @@ void Interpolation() // do plotting only in non-batch mode if (!gROOT->IsBatch() ) { - + r<<"dev.new()";//Required to activate new window for plot //Plot parameter. Plotting using two rows and one column r<<"par(mfrow = c(2,1))"; @@ -66,4 +66,5 @@ void Interpolation() r << "print('Result of approxfun with const method')"; r << "print(paste('x = ',x,' f(x) = ',fc(x2)))"; } + r<<"dev.off()";//Required to close new window for plot } diff --git a/tutorials/r/Minimization.C b/tutorials/r/Minimization.C index f8fde75498f0a..7a0bf35aedb0c 100644 --- a/tutorials/r/Minimization.C +++ b/tutorials/r/Minimization.C @@ -32,10 +32,10 @@ void Minimization() ROOT::R::TRInterface &r=ROOT::R::TRInterface::Instance(); //passsing RosenBrock function to R - r["RosenBrock"]=ROOT::R::TRFunction(RosenBrock); + r["RosenBrock"]=ROOT::R::TRFunctionExport(RosenBrock); //passsing RosenBrockGrad function to R - r["RosenBrockGrad"]=ROOT::R::TRFunction(RosenBrockGrad); + r["RosenBrockGrad"]=ROOT::R::TRFunctionExport(RosenBrockGrad); //the option "method" could be "Nelder-Mead", "BFGS", "CG", "L-BFGS-B", "SANN","Brent" //the option "control" lets you put some constraints like diff --git a/tutorials/r/TF1.R b/tutorials/r/TF1.R deleted file mode 100644 index c251e6f3d09e6..0000000000000 --- a/tutorials/r/TF1.R +++ /dev/null @@ -1,13 +0,0 @@ -require(ROOT) -ROOT::LoadModule('Hist') -ROOT::LoadModule('Graf') - -c1 <- new(TCanvas,'c1','dilog',1) -dilog <- new(TF1,'dilog','TMath::DiLog(x)',0,0) -dilog$SetRange(0,2*pi) -dilog$Draw('') #plotting with ROOT's graphics system -c1$Update() - -x<-seq(0,2*pi,by=.1) -gamma<- new(TF1,'gamma','TMath::Gamma(x)',0,2*pi) -plot(x,gamma$Eval(x)) #plotting with R's graphics system diff --git a/tutorials/r/TFileRead.R b/tutorials/r/TFileRead.R deleted file mode 100644 index bfd130189ae70..0000000000000 --- a/tutorials/r/TFileRead.R +++ /dev/null @@ -1,11 +0,0 @@ -require(ROOT) -LoadModule('RIO') -LoadModule('Hist') -LoadModule('Graf') - -rfilein <- new(TFile,'gamma.root','read') -f1 <- rfilein$Get('gamma') -c1<-new(TCanvas,'c1','gamma') -f1$Draw() -c1$Update() -rfilein$Close('') diff --git a/tutorials/r/TFileWrite.R b/tutorials/r/TFileWrite.R deleted file mode 100644 index 95a7c7880938e..0000000000000 --- a/tutorials/r/TFileWrite.R +++ /dev/null @@ -1,11 +0,0 @@ -require(ROOT) -LoadModule('RIO') -LoadModule('Hist') -LoadModule('Graf') - -rfile <- new(TFile,'gamma.root','recreate') -gamma <- new(TF1,'gamma','TMath::Gamma(x)',0.1,2*pi) -gamma$Write('gamma') -rfile$Flush() -rfile$Close() - diff --git a/tutorials/r/rootlogon.C b/tutorials/r/rootlogon.C deleted file mode 100644 index 2839d62391c71..0000000000000 --- a/tutorials/r/rootlogon.C +++ /dev/null @@ -1,6 +0,0 @@ -#include - -void rootlogon(){ - gSystem->AddIncludePath(RINCLUDEPATH); - gSystem->AddLinkedLibs(RLINKEDLIBS); -}