[Rprotobuf-commits] r328 - pkg/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jul 14 19:33:46 CEST 2010


Author: romain
Date: 2010-07-14 19:33:46 +0200 (Wed, 14 Jul 2010)
New Revision: 328

Modified:
   pkg/src/RconnectionCopyingInputStream.cpp
   pkg/src/S4_classes.h
   pkg/src/ZeroCopyInputStreamWrapper.cpp
   pkg/src/ZeroCopyInputStreamWrapper.h
   pkg/src/ZeroCopyOutputStreamWrapper.cpp
   pkg/src/ZeroCopyOutputStreamWrapper.h
   pkg/src/rprotobuf.h
   pkg/src/wrapper_Descriptor.cpp
Log:
some more changes (still does not work)

Modified: pkg/src/RconnectionCopyingInputStream.cpp
===================================================================
--- pkg/src/RconnectionCopyingInputStream.cpp	2010-07-14 17:05:31 UTC (rev 327)
+++ pkg/src/RconnectionCopyingInputStream.cpp	2010-07-14 17:33:46 UTC (rev 328)
@@ -20,13 +20,13 @@
 		Rcpp::Language call( "readBin", connection_id, Rcpp::RawVector(0), size ) ;
 		Rcpp::RawVector res ;
 		try{
-			res = call.run(); 
+			res = call.eval(); 
 		}  catch( ... ){
 			return 0 ;
 		}
 		
 		int len = res.size() ;
-		memcpy( buffer, res.begin(), lenlen) ;
+		memcpy( buffer, res.begin(), len) ;
 		return len ;
 	}
 	

Modified: pkg/src/S4_classes.h
===================================================================
--- pkg/src/S4_classes.h	2010-07-14 17:05:31 UTC (rev 327)
+++ pkg/src/S4_classes.h	2010-07-14 17:33:46 UTC (rev 328)
@@ -168,8 +168,7 @@
 				new GPB::io::ArrayOutputStream( payload.begin(), size, block_size ) ;
 		
 			Rcpp::XPtr<ZeroCopyOutputStreamWrapper> wrapper( 
-				new ZeroCopyOutputStreamWrapper(stream), true  ) ;
-			SETCDR( wrapper, payload ); /* TODO: update the API of Rcpp::XPtr */
+				new ZeroCopyOutputStreamWrapper(stream), true, R_NilValue, payload ) ;
 			slot( "pointer" ) = wrapper ;
 		}
 		
@@ -188,12 +187,11 @@
 		S4_ArrayInputStream( Rcpp::RawVector payload, int block_size ) : S4( "ArrayInputStream" ){
 			GPB::io::ArrayInputStream* stream = 
 				new GPB::io::ArrayInputStream( payload.begin(), payload.size() , block_size ) ;
-			Rcpp::XPtr<ZeroCopyInputStreamWrapper> wrapper( 
-				new ZeroCopyInputStreamWrapper(stream), true ) ;
-			SETCDR( wrapper, payload ) ; /* TODO: update the API of Rcpp::XPtr */
+			Rcpp::XPtr<rprotobuf::ZeroCopyInputStreamWrapper> wrapper( 
+				new ZeroCopyInputStreamWrapper(stream), true, R_NilValue, payload ) ;
 			slot("pointer") = wrapper ;
 		}
-	}
+	} ;
 	
 	
 	

Modified: pkg/src/ZeroCopyInputStreamWrapper.cpp
===================================================================
--- pkg/src/ZeroCopyInputStreamWrapper.cpp	2010-07-14 17:05:31 UTC (rev 327)
+++ pkg/src/ZeroCopyInputStreamWrapper.cpp	2010-07-14 17:33:46 UTC (rev 328)
@@ -1,4 +1,4 @@
-#include "ZeroCopyInputStreamWrapper.h"
+#include "rprotobuf.h"
 
 namespace rprotobuf{
 	

Modified: pkg/src/ZeroCopyInputStreamWrapper.h
===================================================================
--- pkg/src/ZeroCopyInputStreamWrapper.h	2010-07-14 17:05:31 UTC (rev 327)
+++ pkg/src/ZeroCopyInputStreamWrapper.h	2010-07-14 17:33:46 UTC (rev 328)
@@ -1,27 +1,8 @@
 #ifndef RPROTOBUF_ZeroCopyInputStreamWrapper_H
 #define RPROTOBUF_ZeroCopyInputStreamWrapper_H
-#include "rprotobuf.h"
 
 namespace rprotobuf{
 	
-	/**
-	 * simple class that wraps together a ZeroCopyInputStream 
-	 * and its associated CodedInputStream. Since we don't expose
-	 * CodedInputStream at the R level, this allows to keep only one such 
-	 * object with each zero copy input stream
-	 */
-	class ZeroCopyInputStreamWrapper {
-		public:	
-			ZeroCopyInputStreamWrapper( GPB::io::ZeroCopyInputStream* stream );
-			~ZeroCopyInputStreamWrapper() ;
-			
-			GPB::io::ZeroCopyInputStream* get_stream(); 
-			GPB::io::CodedInputStream* get_coded_stream() ; 
-			
-		private: 
-			GPB::io::ZeroCopyInputStream* stream ;
-			GPB::io::CodedInputStream* coded_stream ;
-} ;
 
 } // namespace rprotobuf
 

Modified: pkg/src/ZeroCopyOutputStreamWrapper.cpp
===================================================================
--- pkg/src/ZeroCopyOutputStreamWrapper.cpp	2010-07-14 17:05:31 UTC (rev 327)
+++ pkg/src/ZeroCopyOutputStreamWrapper.cpp	2010-07-14 17:33:46 UTC (rev 328)
@@ -1,4 +1,4 @@
-#include "ZeroCopyOutputStreamWrapper.h"
+#include "rprotobuf.h"
 
 namespace rprotobuf{
 	

Modified: pkg/src/ZeroCopyOutputStreamWrapper.h
===================================================================
--- pkg/src/ZeroCopyOutputStreamWrapper.h	2010-07-14 17:05:31 UTC (rev 327)
+++ pkg/src/ZeroCopyOutputStreamWrapper.h	2010-07-14 17:33:46 UTC (rev 328)
@@ -1,28 +1,8 @@
 #ifndef RPROTOBUF_ZeroCopyOutputStreamWrapper_H
 #define RPROTOBUF_ZeroCopyOutputStreamWrapper_H
-#include "rprotobuf.h"
 
 namespace rprotobuf{
 	
-	/**
-	 * simple class that wraps together a ZeroCopyOutputStream 
-	 * and its associated CodedOutputStream. Since we don't expose
-	 * CodedOutputStream at the R level, this allows to keep only one such 
-	 * object with each ZeroCopyOutputStream
-	 */
-	class ZeroCopyOutputStreamWrapper {
-		public:	
-			ZeroCopyOutputStreamWrapper( GPB::io::ZeroCopyOutputStream* stream );
-			~ZeroCopyOutputStreamWrapper() ;
-			
-			GPB::io::ZeroCopyOutputStream* get_stream(); 
-			GPB::io::CodedOutputStream* get_coded_stream() ; 
-			
-		private: 
-			GPB::io::ZeroCopyOutputStream* stream ;
-			GPB::io::CodedOutputStream* coded_stream ;
-} ;
-
 } // namespace rprotobuf
 
 #endif

Modified: pkg/src/rprotobuf.h
===================================================================
--- pkg/src/rprotobuf.h	2010-07-14 17:05:31 UTC (rev 327)
+++ pkg/src/rprotobuf.h	2010-07-14 17:33:46 UTC (rev 328)
@@ -98,8 +98,6 @@
 
 #define NEW_S4_OBJECT(CLAZZ) SEXP oo = PROTECT( NEW_OBJECT(MAKE_CLASS(CLAZZ)) ); \
   		if (!Rf_inherits(oo, CLAZZ)) throwException(CLAZZ, "CannotCreateObjectException" );
-
-#include "S4_classes.h"  		
   		
 namespace rprotobuf{
 
@@ -191,7 +189,48 @@
 
 RcppExport SEXP new_RS4_Message_( const GPB::Message* message );
 
+
+	/**
+	 * simple class that wraps together a ZeroCopyOutputStream 
+	 * and its associated CodedOutputStream. Since we don't expose
+	 * CodedOutputStream at the R level, this allows to keep only one such 
+	 * object with each ZeroCopyOutputStream
+	 */
+	class ZeroCopyOutputStreamWrapper {
+		public:	                                    
+			ZeroCopyOutputStreamWrapper( GPB::io::ZeroCopyOutputStream* stream );
+			~ZeroCopyOutputStreamWrapper() ;
+			
+			GPB::io::ZeroCopyOutputStream* get_stream(); 
+			GPB::io::CodedOutputStream* get_coded_stream() ; 
+			
+		private: 
+			GPB::io::ZeroCopyOutputStream* stream ;
+			GPB::io::CodedOutputStream* coded_stream ;
+} ;
+
+	/**
+	 * simple class that wraps together a ZeroCopyInputStream 
+	 * and its associated CodedInputStream. Since we don't expose
+	 * CodedInputStream at the R level, this allows to keep only one such 
+	 * object with each zero copy input stream
+	 */
+	class ZeroCopyInputStreamWrapper {
+		public:	
+			ZeroCopyInputStreamWrapper( GPB::io::ZeroCopyInputStream* stream );
+			~ZeroCopyInputStreamWrapper() ;
+			
+			GPB::io::ZeroCopyInputStream* get_stream(); 
+			GPB::io::CodedInputStream* get_coded_stream() ; 
+			
+		private: 
+			GPB::io::ZeroCopyInputStream* stream ;
+			GPB::io::CodedInputStream* coded_stream ;
+	} ;
+
+
 } // namespace rprotobuf
 
+#include "S4_classes.h"  		
 
 #endif

Modified: pkg/src/wrapper_Descriptor.cpp
===================================================================
--- pkg/src/wrapper_Descriptor.cpp	2010-07-14 17:05:31 UTC (rev 327)
+++ pkg/src/wrapper_Descriptor.cpp	2010-07-14 17:33:46 UTC (rev 328)
@@ -106,9 +106,10 @@
 	return d->enum_type( i ) ;
 }
 
-RCPP_FUNCTION_2( S4_EnumDescriptor, METHOD(enum_type), Rcpp::XPtr<GPB::Descriptor> d, std::string name){
-	return d->FindEnumTypeByName( i ) ;
-}
+// FIXME: two methods cant have the same name
+// RCPP_FUNCTION_2( S4_EnumDescriptor, METHOD(enum_type), Rcpp::XPtr<GPB::Descriptor> d, std::string name){
+// 	return d->FindEnumTypeByName( i ) ;
+// }
 
 RCPP_FUNCTION_1( S4_FileDescriptor, METHOD(fileDescriptor), Rcpp::XPtr<GPB::Descriptor> desc){
 	return S4_FileDescriptor( desc->file() ); 



More information about the Rprotobuf-commits mailing list