[Rcpp-commits] r199 - in pkg: inst src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Dec 19 17:28:42 CET 2009


Author: edd
Date: 2009-12-19 17:28:42 +0100 (Sat, 19 Dec 2009)
New Revision: 199

Modified:
   pkg/inst/ChangeLog
   pkg/src/RcppResultSet.cpp
   pkg/src/RcppResultSet.h
Log:
added simple single-SEXP return function


Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2009-12-19 16:20:52 UTC (rev 198)
+++ pkg/inst/ChangeLog	2009-12-19 16:28:42 UTC (rev 199)
@@ -1,3 +1,8 @@
+2009-12-19  Dirk Eddelbuettel  <edd at debian.org>
+
+	* src/RcppResultsSetp.{h,cpp}: Added simple single SEXP return
+	* src/RcppCommon.{h,cpp}: Adding simple logging facility
+
 2009-12-18  Dirk Eddelbuettel  <edd at debian.org>
 
 	* R/RcppInline.R: Another improvement for Rcpp use

Modified: pkg/src/RcppResultSet.cpp
===================================================================
--- pkg/src/RcppResultSet.cpp	2009-12-19 16:20:52 UTC (rev 198)
+++ pkg/src/RcppResultSet.cpp	2009-12-19 16:28:42 UTC (rev 199)
@@ -360,3 +360,12 @@
     return rl;
 }
 
+SEXP RcppResultSet::getSEXP() {
+    if (values.size() != 1) {
+	throw std::range_error("RcppResultSet::getSEXP only sensible for single return arguments");
+    }
+    SEXP val = values.begin()->second;
+    UNPROTECT(numProtected);
+    return val;
+}
+

Modified: pkg/src/RcppResultSet.h
===================================================================
--- pkg/src/RcppResultSet.h	2009-12-19 16:20:52 UTC (rev 198)
+++ pkg/src/RcppResultSet.h	2009-12-19 16:28:42 UTC (rev 199)
@@ -65,6 +65,7 @@
     void add(std::string, RcppList&);
     void add(std::string, SEXP, bool isProtected);
     SEXP getReturnList();
+    SEXP getSEXP();
 protected:
     int numProtected;
     std::list<std::pair<std::string,SEXP> > values;



More information about the Rcpp-commits mailing list