[Rcpp-commits] r431 - pkg/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jan 22 18:16:13 CET 2010


Author: romain
Date: 2010-01-22 18:16:13 +0100 (Fri, 22 Jan 2010)
New Revision: 431

Modified:
   pkg/src/as.cpp
Log:
re-enable transform again

Modified: pkg/src/as.cpp
===================================================================
--- pkg/src/as.cpp	2010-01-22 17:13:49 UTC (rev 430)
+++ pkg/src/as.cpp	2010-01-22 17:16:13 UTC (rev 431)
@@ -114,20 +114,20 @@
     std::vector<bool> v(n);
     switch( TYPEOF(m_sexp) ){
     case LGLSXP:
-    	// transform( LOGICAL(m_sexp), LOGICAL(m_sexp)+n, v.begin(), Rboolean_to_bool ) ;
-    	v.assign( LOGICAL(m_sexp), LOGICAL(m_sexp)+n ) ;
+    	transform( LOGICAL(m_sexp), LOGICAL(m_sexp)+n, v.begin(), Rboolean_to_bool ) ;
+    	// v.assign( LOGICAL(m_sexp), LOGICAL(m_sexp)+n ) ;
     	break ;
     case INTSXP:
-    	// transform( INTEGER(m_sexp), INTEGER(m_sexp)+n, v.begin(), int_to_bool ) ;
-    	v.assign( INTEGER(m_sexp), INTEGER(m_sexp)+n ) ;
+    	transform( INTEGER(m_sexp), INTEGER(m_sexp)+n, v.begin(), int_to_bool ) ;
+    	// v.assign( INTEGER(m_sexp), INTEGER(m_sexp)+n ) ;
     	break;
     case REALSXP:
-    	// transform( REAL(m_sexp), REAL(m_sexp)+n, v.begin(), double_to_bool ) ;
-    	v.assign( REAL(m_sexp), REAL(m_sexp)+n ) ;
+    	transform( REAL(m_sexp), REAL(m_sexp)+n, v.begin(), double_to_bool ) ;
+    	// v.assign( REAL(m_sexp), REAL(m_sexp)+n ) ;
     	break;
     case RAWSXP:
-    	// transform( RAW(m_sexp), RAW(m_sexp)+n, v.begin(), Rbyte_to_bool ) ;
-    	v.assign( RAW(m_sexp), RAW(m_sexp)+n ) ;
+    	transform( RAW(m_sexp), RAW(m_sexp)+n, v.begin(), Rbyte_to_bool ) ;
+    	// v.assign( RAW(m_sexp), RAW(m_sexp)+n ) ;
     	break;
     default:
     		throw std::range_error( "as< vector<bool> >: invalid R type" ) ; 
@@ -144,16 +144,16 @@
     	v.assign( INTEGER(m_sexp), INTEGER(m_sexp)+n ) ;
     	break;
     case LGLSXP:
-    	// transform( LOGICAL(m_sexp), LOGICAL(m_sexp)+n, v.begin(), Rboolean_to_int ) ;
-    	v.assign( LOGICAL(m_sexp), LOGICAL(m_sexp)+n) ;
+    	transform( LOGICAL(m_sexp), LOGICAL(m_sexp)+n, v.begin(), Rboolean_to_int ) ;
+    	// v.assign( LOGICAL(m_sexp), LOGICAL(m_sexp)+n) ;
     	break;
     case REALSXP:
-    	// transform( REAL(m_sexp), REAL(m_sexp)+n, v.begin(), double_to_int ) ;
-    	v.assign( REAL(m_sexp), REAL(m_sexp) + n) ;
+    	transform( REAL(m_sexp), REAL(m_sexp)+n, v.begin(), double_to_int ) ;
+    	// v.assign( REAL(m_sexp), REAL(m_sexp) + n) ;
     	break;
     case RAWSXP:
-    	// transform( RAW(m_sexp), RAW(m_sexp)+n, v.begin(), Rbyte_to_int ) ;
-    	v.assign( RAW(m_sexp), RAW(m_sexp)+n) ;
+    	transform( RAW(m_sexp), RAW(m_sexp)+n, v.begin(), Rbyte_to_int ) ;
+    	// v.assign( RAW(m_sexp), RAW(m_sexp)+n) ;
     	break;
     default:
     		throw std::range_error( "as< vector<int> >: invalid R type" ) ; 
@@ -166,19 +166,19 @@
     std::vector<Rbyte> v(n);
     switch( TYPEOF(m_sexp) ){
     case LGLSXP:
-    	// transform( LOGICAL(m_sexp), LOGICAL(m_sexp)+n, v.begin(), Rboolean_to_Rbyte ) ;
-    	v.assign( LOGICAL(m_sexp), LOGICAL(m_sexp)+n) ;
+    	transform( LOGICAL(m_sexp), LOGICAL(m_sexp)+n, v.begin(), Rboolean_to_Rbyte ) ;
+    	// v.assign( LOGICAL(m_sexp), LOGICAL(m_sexp)+n) ;
     	break ;
     case RAWSXP:
     	v.assign( RAW(m_sexp), RAW(m_sexp)+n ) ;
     	break ;
     case REALSXP:
-    	// transform( REAL(m_sexp), REAL(m_sexp)+n, v.begin(), double_to_Rbyte ) ;
-    	v.assign( REAL(m_sexp), REAL(m_sexp) + n ) ;
+    	transform( REAL(m_sexp), REAL(m_sexp)+n, v.begin(), double_to_Rbyte ) ;
+    	// v.assign( REAL(m_sexp), REAL(m_sexp) + n ) ;
     	break;
     case INTSXP:
-    	// transform( INTEGER(m_sexp), INTEGER(m_sexp)+n, v.begin(), int_to_Rbyte ) ;
-    	v.assign( INTEGER(m_sexp), INTEGER(m_sexp)+n) ;
+    	transform( INTEGER(m_sexp), INTEGER(m_sexp)+n, v.begin(), int_to_Rbyte ) ;
+    	// v.assign( INTEGER(m_sexp), INTEGER(m_sexp)+n) ;
     	break;
     default:
     	throw std::range_error("as< vector<Rbyte> > expects raw, double or int");
@@ -191,19 +191,19 @@
     std::vector<double> v(n);
     switch( TYPEOF(m_sexp) ){
     case LGLSXP:
-    	// transform( LOGICAL(m_sexp), LOGICAL(m_sexp)+n, v.begin(), Rboolean_to_double ) ;
-    	v.assign( LOGICAL(m_sexp), LOGICAL(m_sexp)+n ); 
+    	transform( LOGICAL(m_sexp), LOGICAL(m_sexp)+n, v.begin(), Rboolean_to_double ) ;
+    	// v.assign( LOGICAL(m_sexp), LOGICAL(m_sexp)+n ); 
     	break ;
     case RAWSXP:
-    	// transform( RAW(m_sexp), RAW(m_sexp)+n, v.begin(), Rbyte_to_double ) ;
-    	v.assign( RAW(m_sexp), RAW(m_sexp)+n ) ;
+    	transform( RAW(m_sexp), RAW(m_sexp)+n, v.begin(), Rbyte_to_double ) ;
+    	// v.assign( RAW(m_sexp), RAW(m_sexp)+n ) ;
     	break ;
     case REALSXP:
     	v.assign( REAL(m_sexp), REAL(m_sexp)+n) ;
     	break;
     case INTSXP:
-    	// transform( INTEGER(m_sexp), INTEGER(m_sexp)+n, v.begin(), int_to_double) ;
-    	v.assign( INTEGER(m_sexp), INTEGER(m_sexp)+n ) ;
+    	transform( INTEGER(m_sexp), INTEGER(m_sexp)+n, v.begin(), int_to_double) ;
+    	// v.assign( INTEGER(m_sexp), INTEGER(m_sexp)+n ) ;
     	break;
     default:
     	    throw std::range_error("as< vector<double> >:  expects raw, double or int");



More information about the Rcpp-commits mailing list