[Rcpp-devel] [Rcpp-commits] r300 - in pkg: inst src src/Rcpp

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jan 7 15:30:29 CET 2010


Author: romain
Date: 2010-01-07 15:30:29 +0100 (Thu, 07 Jan 2010)
New Revision: 300

Modified:
   pkg/inst/ChangeLog
   pkg/src/RObject.cpp
   pkg/src/Rcpp/RObject.h
Log:
RObject::attr now returns RObject instead of SEXP

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2010-01-07 14:19:02 UTC (rev 299)
+++ pkg/inst/ChangeLog	2010-01-07 14:30:29 UTC (rev 300)
@@ -1,5 +1,9 @@
 2010-01-07  Romain Francois <francoisromain at free.fr>
 
+	* src/Rcpp/RObject.h: the result of attr is now an RObject
+	rather than a SEXP. This does not change previous behavior
+	because of the implicit conversion
+
 	* src/Rcpp/ExpressionVector.h: new class Rcpp::ExpressionVector
 	which shares a lot with GenericVector.
 	* src/ExpressionVector.cpp: implementation

Modified: pkg/src/RObject.cpp
===================================================================
--- pkg/src/RObject.cpp	2010-01-07 14:19:02 UTC (rev 299)
+++ pkg/src/RObject.cpp	2010-01-07 14:30:29 UTC (rev 300)
@@ -24,6 +24,7 @@
 #include <Rcpp/Symbol.h>
 #include <algorithm>
 #include <Rcpp/as.h>
+#include <Rcpp/wrap.h>
 
 namespace Rcpp {
 
@@ -99,7 +100,7 @@
 }
 
 SEXP RObject::attr( const std::string& name) const{
-	return Rf_getAttrib( m_sexp, Rf_install( name.c_str() ) );
+	return wrap( Rf_getAttrib( m_sexp, Rf_install( name.c_str() ) ) );
 }
 
 const char* RObject::not_compatible::what( ) const throw() {

Modified: pkg/src/Rcpp/RObject.h
===================================================================
--- pkg/src/Rcpp/RObject.h	2010-01-07 14:19:02 UTC (rev 299)
+++ pkg/src/Rcpp/RObject.h	2010-01-07 14:30:29 UTC (rev 300)
@@ -115,7 +115,7 @@
     /**
      * extract the given attribute
      */
-    SEXP attr( const std::string& name) const  ;
+    RObject attr( const std::string& name) const  ;
     
     /**
      * is this object NULL

_______________________________________________
Rcpp-commits mailing list
Rcpp-commits at lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-commits


More information about the Rcpp-devel mailing list