[Rcpp-commits] r1725 - in pkg/Rcpp: inst/include src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Jun 25 11:12:14 CEST 2010
Author: romain
Date: 2010-06-25 11:12:14 +0200 (Fri, 25 Jun 2010)
New Revision: 1725
Modified:
pkg/Rcpp/inst/include/RcppResultSet.h
pkg/Rcpp/inst/include/RcppResultSet__backward.h
pkg/Rcpp/src/RcppResultSet.cpp
Log:
clear out some dust of the old api
Modified: pkg/Rcpp/inst/include/RcppResultSet.h
===================================================================
--- pkg/Rcpp/inst/include/RcppResultSet.h 2010-06-25 09:07:42 UTC (rev 1724)
+++ pkg/Rcpp/inst/include/RcppResultSet.h 2010-06-25 09:12:14 UTC (rev 1725)
@@ -78,12 +78,17 @@
void add(std::string, SEXP, bool isProtected);
SEXP getReturnList();
SEXP getSEXP();
+
protected:
int numProtected;
LIST values;
private:
+ inline void push_back( const std::string& name, SEXP x){
+ values.push_back( PAIR(name, x ) ) ;
+ }
+
// defined later because it needs wrap
template <typename T>
void add__impl( const std::string& name, const T& t ) ;
Modified: pkg/Rcpp/inst/include/RcppResultSet__backward.h
===================================================================
--- pkg/Rcpp/inst/include/RcppResultSet__backward.h 2010-06-25 09:07:42 UTC (rev 1724)
+++ pkg/Rcpp/inst/include/RcppResultSet__backward.h 2010-06-25 09:12:14 UTC (rev 1725)
@@ -24,7 +24,7 @@
template <typename T>
void RcppResultSet::add__impl( const std::string& name, const T& t ){
- values.push_back(make_pair(name, Rcpp::wrap(t)));
+ push_back( name, Rcpp::wrap(t) );
}
template <typename T>
@@ -33,7 +33,7 @@
for (int i = 0; i < nx; i++)
for (int j = 0; j < ny; j++)
mat[i + nx*j] = input[i][j];
- values.push_back( make_pair(name, mat.asSexp() ));
+ push_back( name, mat );
}
template <typename T>
@@ -50,7 +50,7 @@
for (int i = 0; i < nx; i++)
for (int j = 0; j < ny; j++)
out[i + nx*j] = mat[i][j];
- values.push_back(make_pair( name, out.asSexp() ));
+ push_back( name, out );
}
#endif
Modified: pkg/Rcpp/src/RcppResultSet.cpp
===================================================================
--- pkg/Rcpp/src/RcppResultSet.cpp 2010-06-25 09:07:42 UTC (rev 1724)
+++ pkg/Rcpp/src/RcppResultSet.cpp 2010-06-25 09:12:14 UTC (rev 1725)
@@ -164,7 +164,7 @@
}
void RcppResultSet::add(std::string name, SEXP sexp, bool isProtected) {
- values.push_back(make_pair(name, sexp));
+ push_back(name, sexp);
if (isProtected)
numProtected++;
}
@@ -245,7 +245,7 @@
SET_STRING_ELT(nm, i, Rf_mkChar(colNames[i].c_str()));
}
Rf_setAttrib(rl, R_NamesSymbol, nm);
- values.push_back(make_pair(name, rl));
+ push_back(name, rl);
}
SEXP RcppResultSet::getReturnList() {
More information about the Rcpp-commits
mailing list