[Rprotobuf-commits] r421 - pkg/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Apr 11 16:14:03 CEST 2011


Author: edd
Date: 2011-04-11 16:14:02 +0200 (Mon, 11 Apr 2011)
New Revision: 421

Modified:
   pkg/src/extractors.cpp
   pkg/src/mutators.cpp
   pkg/src/wrapper_FieldDescriptor.cpp
Log:
compatected #ifdef a little by grouping INT64 and UINT64 into a single #ifdef


Modified: pkg/src/extractors.cpp
===================================================================
--- pkg/src/extractors.cpp	2011-04-10 18:11:59 UTC (rev 420)
+++ pkg/src/extractors.cpp	2011-04-11 14:14:02 UTC (rev 421)
@@ -72,13 +72,11 @@
 			return Rcpp::wrap( RepeatedFieldImporter<DATATYPE>(ref, *message, fieldDesc) ) ; \
 
 			HANDLE_REPEATED_FIELD(CPPTYPE_INT32, GPB::int32) ;
+    		HANDLE_REPEATED_FIELD(CPPTYPE_UINT32, GPB::uint32) ;
 #ifdef RCPP_HAS_LONG_LONG_TYPES
     		HANDLE_REPEATED_FIELD(CPPTYPE_INT64, GPB::int64) ;
+    		HANDLE_REPEATED_FIELD(CPPTYPE_UINT64, GPB::uint64) ;
 #endif
-    		HANDLE_REPEATED_FIELD(CPPTYPE_UINT32 , GPB::uint32) ;
-#ifdef RCPP_HAS_LONG_LONG_TYPES
-    		HANDLE_REPEATED_FIELD(CPPTYPE_UINT64 , GPB::uint64) ;
-#endif
     		HANDLE_REPEATED_FIELD(CPPTYPE_DOUBLE, double) ;
     		HANDLE_REPEATED_FIELD(CPPTYPE_FLOAT, float) ;
     		HANDLE_REPEATED_FIELD(CPPTYPE_BOOL, bool) ;
@@ -115,11 +113,9 @@
 			return Rcpp::wrap( ref->Get##SUFFIX(*message, fieldDesc ) ) ;
 
 		HANDLE_SINGLE_FIELD( CPPTYPE_INT32,  Int32 ); 
-#ifdef RCPP_HAS_LONG_LONG_TYPES
-		HANDLE_SINGLE_FIELD( CPPTYPE_INT64,  Int64 );
-#endif
 		HANDLE_SINGLE_FIELD( CPPTYPE_UINT32, UInt32 ); 
 #ifdef RCPP_HAS_LONG_LONG_TYPES
+		HANDLE_SINGLE_FIELD( CPPTYPE_INT64,  Int64 );
 		HANDLE_SINGLE_FIELD( CPPTYPE_UINT64, UInt64 );
 #endif
 		HANDLE_SINGLE_FIELD( CPPTYPE_DOUBLE, Double );

Modified: pkg/src/mutators.cpp
===================================================================
--- pkg/src/mutators.cpp	2011-04-10 18:11:59 UTC (rev 420)
+++ pkg/src/mutators.cpp	2011-04-11 14:14:02 UTC (rev 421)
@@ -984,29 +984,28 @@
 			// {{{ simple cases using macro expansion
 #undef HANDLE_SINGLE_FIELD
 #define HANDLE_SINGLE_FIELD( CPPTYPE, CAMEL, TYPE )						\
-case CPPTYPE :																\
-	{																		\
-		ref->Set##CAMEL( message, field_desc, Rcpp::as<TYPE>(value) ) ;	\
-		break ;   															\
-	}
-HANDLE_SINGLE_FIELD( CPPTYPE_INT32, Int32, GPB::int32) ;
+			case CPPTYPE :												\
+				{														\
+					ref->Set##CAMEL( message, field_desc, Rcpp::as<TYPE>(value) ) ;	\
+					break ;												\
+				}
+
+			HANDLE_SINGLE_FIELD( CPPTYPE_INT32, Int32, GPB::int32) ;
+			HANDLE_SINGLE_FIELD( CPPTYPE_UINT32, UInt32, GPB::uint32) ;
 #ifdef RCPP_HAS_LONG_LONG_TYPES
-HANDLE_SINGLE_FIELD( CPPTYPE_INT64, Int64, GPB::int64) ;
+			HANDLE_SINGLE_FIELD( CPPTYPE_INT64, Int64, GPB::int64) ;
+			HANDLE_SINGLE_FIELD( CPPTYPE_UINT64, UInt64, GPB::uint64) ;
 #endif
-HANDLE_SINGLE_FIELD( CPPTYPE_UINT32, UInt32, GPB::uint32) ;
-#ifdef RCPP_HAS_LONG_LONG_TYPES
-HANDLE_SINGLE_FIELD( CPPTYPE_UINT64, UInt64, GPB::uint64) ;
-#endif
-HANDLE_SINGLE_FIELD( CPPTYPE_DOUBLE, Double, double) ;
-HANDLE_SINGLE_FIELD( CPPTYPE_FLOAT, Float, float) ;
-HANDLE_SINGLE_FIELD( CPPTYPE_BOOL, Bool, bool) ;
+			HANDLE_SINGLE_FIELD( CPPTYPE_DOUBLE, Double, double) ;
+			HANDLE_SINGLE_FIELD( CPPTYPE_FLOAT, Float, float) ;
+			HANDLE_SINGLE_FIELD( CPPTYPE_BOOL, Bool, bool) ;
 #undef HANDLE_SINGLE_FIELD
-		default:
-			throwException("Unsupported type", "ConversionException");
+			default:
+				throwException("Unsupported type", "ConversionException");
 // }}}  
      		
 			// {{{ string
-			case CPPTYPE_STRING:
+		    case CPPTYPE_STRING:
     			{
     				switch( TYPEOF( value ) ){
     					case STRSXP:
@@ -1039,7 +1038,7 @@
 			// }}}
     		
 			// {{{ message
-    		case CPPTYPE_MESSAGE:
+		case CPPTYPE_MESSAGE:
     			{
     				if( TYPEOF( value ) == S4SXP && Rf_inherits( value, "Message" ) ){
     					GPB::Message* mess = (GPB::Message*) EXTPTR_PTR( GET_SLOT( value, Rf_install("pointer") ) ) ;
@@ -1058,7 +1057,7 @@
     			// }}}
     		
 			// {{{ enum
-    		case CPPTYPE_ENUM : 
+		case CPPTYPE_ENUM : 
     			{
     				const GPB::EnumDescriptor* enum_desc = field_desc->enum_type() ;
     				

Modified: pkg/src/wrapper_FieldDescriptor.cpp
===================================================================
--- pkg/src/wrapper_FieldDescriptor.cpp	2011-04-10 18:11:59 UTC (rev 420)
+++ pkg/src/wrapper_FieldDescriptor.cpp	2011-04-11 14:14:02 UTC (rev 421)
@@ -52,11 +52,9 @@
 		switch( d->cpp_type() ){
 			
 			RPB_HANDLE_CASE(INT32,int32)
-#ifdef RCPP_HAS_LONG_LONG_TYPES
-			RPB_HANDLE_CASE(INT64,int64)
-#endif
 			RPB_HANDLE_CASE(UINT32,uint32)
 #ifdef RCPP_HAS_LONG_LONG_TYPES
+			RPB_HANDLE_CASE(INT64,int64)
 			RPB_HANDLE_CASE(UINT64,uint64)
 #endif
 			RPB_HANDLE_CASE(DOUBLE,double)



More information about the Rprotobuf-commits mailing list