[Rprotobuf-commits] r533 - in pkg: . src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Sep 13 03:50:57 CEST 2013


Author: murray
Date: 2013-09-13 03:50:54 +0200 (Fri, 13 Sep 2013)
New Revision: 533

Modified:
   pkg/ChangeLog
   pkg/src/RcppMacros.h
   pkg/src/wrapper_Descriptor.cpp
   pkg/src/wrapper_EnumDescriptor.cpp
   pkg/src/wrapper_EnumValueDescriptor.cpp
   pkg/src/wrapper_FieldDescriptor.cpp
   pkg/src/wrapper_FileDescriptor.cpp
   pkg/src/wrapper_Message.cpp
   pkg/src/wrapper_MethodDescriptor.cpp
   pkg/src/wrapper_ServiceDescriptor.cpp
Log:
Finish the macro conversion job by getting the RCPP_METHOD_XP ones as
well.  These are the ones that would seem to be even more suitable for
Rcpp Modules as I understand them.



Modified: pkg/ChangeLog
===================================================================
--- pkg/ChangeLog	2013-09-13 01:20:02 UTC (rev 532)
+++ pkg/ChangeLog	2013-09-13 01:50:54 UTC (rev 533)
@@ -1,3 +1,9 @@
+2013-09-12  Murray Stokely  <murray at FreeBSD.org>
+
+	* src/RcppMacros.h: Add Rcpp compatibility macros
+	  which are simplified versions of the now deprecated ones from
+	  Rcpp.
+
 2013-09-11  Murray Stokely  <mstokely at FreeBSD.org>
 
 	* configure.in: If pkg-config is not available add -lprotobuf to

Modified: pkg/src/RcppMacros.h
===================================================================
--- pkg/src/RcppMacros.h	2013-09-13 01:20:02 UTC (rev 532)
+++ pkg/src/RcppMacros.h	2013-09-13 01:50:54 UTC (rev 533)
@@ -136,4 +136,36 @@
 }                                                   \
 void RCPP_DECORATE(__NAME__)(___0, ___1, ___2, ___3)
 
+#define RPB_XP_METHOD_0(__NAME__,__CLASS__,__METHOD__ )   \
+extern "C" SEXP __NAME__( SEXP xp  ){                     \
+BEGIN_RCPP                                                \
+        ::Rcpp::XPtr< __CLASS__ > ptr(xp) ;               \
+        return ::Rcpp::wrap( ptr->__METHOD__(  ) ) ;      \
+END_RCPP                                                  \
+}
+
+#define RPB_XP_METHOD_VOID_0(__NAME__,__CLASS__,__METHOD__)    \
+extern "C" SEXP __NAME__( SEXP xp  ){                          \
+BEGIN_RCPP                                                     \
+::Rcpp::XPtr< __CLASS__ > ptr(xp) ;                            \
+ptr->__METHOD__(  ) ;                                          \
+END_RCPP                                                       \
+}
+
+#define RPB_XP_METHOD_CAST_0(__NAME__,__CLASS__,__METHOD__,__CAST__)  \
+extern "C" SEXP __NAME__( SEXP xp  ){                                 \
+BEGIN_RCPP                                                            \
+        ::Rcpp::XPtr< __CLASS__ > ptr(xp) ;                           \
+        return ::Rcpp::wrap( __CAST__( ptr->__METHOD__(  ) ) ) ;      \
+END_RCPP                                                              \
+}
+
+#define RPB_XP_METHOD_CAST_1(__NAME__,__CLASS__,__METHOD__,__CAST__)   \
+extern "C" SEXP __NAME__( SEXP xp ,  SEXP x0 ){                       \
+BEGIN_RCPP                                                            \
+        ::Rcpp::XPtr< __CLASS__ > ptr(xp) ;                           \
+        return ::Rcpp::wrap( __CAST__( ptr->__METHOD__( ::Rcpp::internal::converter( x0 ) ) ) ) ; \
+END_RCPP                                                              \
+}
+
 #endif

Modified: pkg/src/wrapper_Descriptor.cpp
===================================================================
--- pkg/src/wrapper_Descriptor.cpp	2013-09-13 01:20:02 UTC (rev 532)
+++ pkg/src/wrapper_Descriptor.cpp	2013-09-13 01:50:54 UTC (rev 533)
@@ -6,12 +6,12 @@
 #undef METHOD
 #define METHOD(__NAME__) RCPP_PP_CAT(Descriptor__,__NAME__)	
 
-RCPP_XP_METHOD_0( METHOD(as_character), GPB::Descriptor          , DebugString)
-RCPP_XP_METHOD_0( METHOD(field_count), GPB::Descriptor, field_count )
-RCPP_XP_METHOD_0( METHOD(nested_type_count), GPB::Descriptor, nested_type_count )
-RCPP_XP_METHOD_0( METHOD(enum_type_count), GPB::Descriptor, enum_type_count )
+RPB_XP_METHOD_0( METHOD(as_character), GPB::Descriptor          , DebugString)
+RPB_XP_METHOD_0( METHOD(field_count), GPB::Descriptor, field_count )
+RPB_XP_METHOD_0( METHOD(nested_type_count), GPB::Descriptor, nested_type_count )
+RPB_XP_METHOD_0( METHOD(enum_type_count), GPB::Descriptor, enum_type_count )
 
-RCPP_XP_METHOD_CAST_0( METHOD(containing_type), GPB::Descriptor, containing_type, S4_Descriptor )
+RPB_XP_METHOD_CAST_0( METHOD(containing_type), GPB::Descriptor, containing_type, S4_Descriptor )
 
 
 /**

Modified: pkg/src/wrapper_EnumDescriptor.cpp
===================================================================
--- pkg/src/wrapper_EnumDescriptor.cpp	2013-09-13 01:20:02 UTC (rev 532)
+++ pkg/src/wrapper_EnumDescriptor.cpp	2013-09-13 01:50:54 UTC (rev 533)
@@ -27,9 +27,9 @@
 #undef METHOD
 #define METHOD(__NAME__) RCPP_PP_CAT(EnumDescriptor__,__NAME__)	
 
-	RCPP_XP_METHOD_0(METHOD(as_character), GPB::EnumDescriptor      , DebugString) ;
-	RCPP_XP_METHOD_0(METHOD(length)      ,GPB::EnumDescriptor,value_count)
-	RCPP_XP_METHOD_0(METHOD(value_count) ,GPB::EnumDescriptor,value_count)
+	RPB_XP_METHOD_0(METHOD(as_character), GPB::EnumDescriptor      , DebugString) ;
+	RPB_XP_METHOD_0(METHOD(length)      ,GPB::EnumDescriptor,value_count)
+	RPB_XP_METHOD_0(METHOD(value_count) ,GPB::EnumDescriptor,value_count)
 	
 	RPB_FUNCTION_1(S4_Descriptor, METHOD(containing_type), Rcpp::XPtr<GPB::EnumDescriptor> d ){
 		return S4_Descriptor( d->containing_type() ) ;

Modified: pkg/src/wrapper_EnumValueDescriptor.cpp
===================================================================
--- pkg/src/wrapper_EnumValueDescriptor.cpp	2013-09-13 01:20:02 UTC (rev 532)
+++ pkg/src/wrapper_EnumValueDescriptor.cpp	2013-09-13 01:50:54 UTC (rev 533)
@@ -27,7 +27,7 @@
 #undef METHOD
 #define METHOD(__NAME__) RCPP_PP_CAT(EnumValueDescriptor__,__NAME__)
 
-RCPP_XP_METHOD_0( METHOD(as_character) , GPB::EnumValueDescriptor , DebugString) ;
+RPB_XP_METHOD_0( METHOD(as_character) , GPB::EnumValueDescriptor , DebugString) ;
 
 RPB_FUNCTION_1(S4_Message, METHOD(as_Message) , Rcpp::XPtr<GPB::EnumValueDescriptor> d ){
 	GPB::EnumValueDescriptorProto* message = new GPB::EnumValueDescriptorProto() ; 

Modified: pkg/src/wrapper_FieldDescriptor.cpp
===================================================================
--- pkg/src/wrapper_FieldDescriptor.cpp	2013-09-13 01:20:02 UTC (rev 532)
+++ pkg/src/wrapper_FieldDescriptor.cpp	2013-09-13 01:50:54 UTC (rev 533)
@@ -27,16 +27,16 @@
 #undef METHOD
 #define METHOD(__NAME__) RCPP_PP_CAT(FieldDescriptor__,__NAME__)	
 
-	RCPP_XP_METHOD_0( METHOD(as_character)      , GPB::FieldDescriptor, DebugString)
-	RCPP_XP_METHOD_0( METHOD(is_extension)      , GPB::FieldDescriptor, is_extension)  
-	RCPP_XP_METHOD_0( METHOD(number)            , GPB::FieldDescriptor, number)  
-	RCPP_XP_METHOD_0( METHOD(type)              , GPB::FieldDescriptor, type )  
-	RCPP_XP_METHOD_0( METHOD(cpp_type)          , GPB::FieldDescriptor, cpp_type )  
-	RCPP_XP_METHOD_0( METHOD(label)             , GPB::FieldDescriptor, label )  
-	RCPP_XP_METHOD_0( METHOD(is_repeated)       , GPB::FieldDescriptor, is_repeated )  
-	RCPP_XP_METHOD_0( METHOD(is_optional)       , GPB::FieldDescriptor, is_optional )  
-	RCPP_XP_METHOD_0( METHOD(is_required)       , GPB::FieldDescriptor, is_required )  
-	RCPP_XP_METHOD_0( METHOD(has_default_value) , GPB::FieldDescriptor, has_default_value )  
+	RPB_XP_METHOD_0( METHOD(as_character)      , GPB::FieldDescriptor, DebugString)
+	RPB_XP_METHOD_0( METHOD(is_extension)      , GPB::FieldDescriptor, is_extension)  
+	RPB_XP_METHOD_0( METHOD(number)            , GPB::FieldDescriptor, number)  
+	RPB_XP_METHOD_0( METHOD(type)              , GPB::FieldDescriptor, type )  
+	RPB_XP_METHOD_0( METHOD(cpp_type)          , GPB::FieldDescriptor, cpp_type )  
+	RPB_XP_METHOD_0( METHOD(label)             , GPB::FieldDescriptor, label )  
+	RPB_XP_METHOD_0( METHOD(is_repeated)       , GPB::FieldDescriptor, is_repeated )  
+	RPB_XP_METHOD_0( METHOD(is_optional)       , GPB::FieldDescriptor, is_optional )  
+	RPB_XP_METHOD_0( METHOD(is_required)       , GPB::FieldDescriptor, is_required )  
+	RPB_XP_METHOD_0( METHOD(has_default_value) , GPB::FieldDescriptor, has_default_value )  
 
 	RPB_FUNCTION_1( S4_Descriptor, METHOD(containing_type), Rcpp::XPtr<GPB::FieldDescriptor> d){
 		return S4_Descriptor( d->containing_type() ) ;

Modified: pkg/src/wrapper_FileDescriptor.cpp
===================================================================
--- pkg/src/wrapper_FileDescriptor.cpp	2013-09-13 01:20:02 UTC (rev 532)
+++ pkg/src/wrapper_FileDescriptor.cpp	2013-09-13 01:50:54 UTC (rev 533)
@@ -6,7 +6,7 @@
 #undef METHOD
 #define METHOD(__NAME__) RCPP_PP_CAT(FileDescriptor__,__NAME__)
 
-RCPP_XP_METHOD_0( METHOD(as_character)       , GPB::FileDescriptor      , DebugString) ;
+RPB_XP_METHOD_0( METHOD(as_character)       , GPB::FileDescriptor      , DebugString) ;
 
 RPB_FUNCTION_1(S4_Message, METHOD(as_Message), Rcpp::XPtr<GPB::FileDescriptor> d ){
 	GPB::FileDescriptorProto* message = new GPB::FileDescriptorProto() ; 

Modified: pkg/src/wrapper_Message.cpp
===================================================================
--- pkg/src/wrapper_Message.cpp	2013-09-13 01:20:02 UTC (rev 532)
+++ pkg/src/wrapper_Message.cpp	2013-09-13 01:50:54 UTC (rev 533)
@@ -158,7 +158,7 @@
 	return( payload ) ;
 }
 
-RCPP_XP_METHOD_VOID_0(METHOD(clear), GPB::Message, Clear )
+RPB_XP_METHOD_VOID_0(METHOD(clear), GPB::Message, Clear )
 
 /**
  * Clear a field of a message
@@ -253,8 +253,8 @@
 	return( message->GetDescriptor() ) ;
 }
 
-RCPP_XP_METHOD_0( METHOD(as_character) , GPB::Message, DebugString) 
-RCPP_XP_METHOD_0( METHOD(bytesize), GPB::Message, ByteSize )
+RPB_XP_METHOD_0( METHOD(as_character) , GPB::Message, DebugString) 
+RPB_XP_METHOD_0( METHOD(bytesize), GPB::Message, ByteSize )
 
 RPB_FUNCTION_2( int, METHOD(field_size), Rcpp::XPtr<GPB::Message> message, SEXP field  ){
 	

Modified: pkg/src/wrapper_MethodDescriptor.cpp
===================================================================
--- pkg/src/wrapper_MethodDescriptor.cpp	2013-09-13 01:20:02 UTC (rev 532)
+++ pkg/src/wrapper_MethodDescriptor.cpp	2013-09-13 01:50:54 UTC (rev 533)
@@ -6,7 +6,7 @@
 #undef METHOD
 #define METHOD(__NAME__) RCPP_PP_CAT(MethodDescriptor__,__NAME__)
 
-RCPP_XP_METHOD_0( METHOD(as_character)     , GPB::MethodDescriptor    , DebugString)
+RPB_XP_METHOD_0( METHOD(as_character)     , GPB::MethodDescriptor    , DebugString)
 
 RPB_FUNCTION_1(S4_Message, METHOD(as_Message), Rcpp::XPtr<GPB::MethodDescriptor> d ){
 	GPB::MethodDescriptorProto* message = new GPB::MethodDescriptorProto() ; 

Modified: pkg/src/wrapper_ServiceDescriptor.cpp
===================================================================
--- pkg/src/wrapper_ServiceDescriptor.cpp	2013-09-13 01:20:02 UTC (rev 532)
+++ pkg/src/wrapper_ServiceDescriptor.cpp	2013-09-13 01:50:54 UTC (rev 533)
@@ -6,12 +6,12 @@
 #undef METHOD
 #define METHOD(__NAME__) RCPP_PP_CAT(ServiceDescriptor__,__NAME__)	
 	
-	RCPP_XP_METHOD_0( METHOD(length),GPB::ServiceDescriptor, method_count )
-	RCPP_XP_METHOD_0( METHOD(method_count),GPB::ServiceDescriptor, method_count )
-	RCPP_XP_METHOD_0( METHOD(as_character)    , GPB::ServiceDescriptor   , DebugString)
+	RPB_XP_METHOD_0( METHOD(length),GPB::ServiceDescriptor, method_count )
+	RPB_XP_METHOD_0( METHOD(method_count),GPB::ServiceDescriptor, method_count )
+	RPB_XP_METHOD_0( METHOD(as_character)    , GPB::ServiceDescriptor   , DebugString)
 	
-	RCPP_XP_METHOD_CAST_1( METHOD(getMethodByIndex) , GPB::ServiceDescriptor , method          , S4_MethodDescriptor ) 
-	RCPP_XP_METHOD_CAST_1( METHOD(getMethodByName)  , GPB::ServiceDescriptor , FindMethodByName, S4_MethodDescriptor ) 
+	RPB_XP_METHOD_CAST_1( METHOD(getMethodByIndex) , GPB::ServiceDescriptor , method          , S4_MethodDescriptor ) 
+	RPB_XP_METHOD_CAST_1( METHOD(getMethodByName)  , GPB::ServiceDescriptor , FindMethodByName, S4_MethodDescriptor ) 
 
 	RPB_FUNCTION_1( Rcpp::CharacterVector, METHOD(getMethodNames), Rcpp::XPtr<GPB::ServiceDescriptor> desc){
 		int nmeths  = desc->method_count() ;



More information about the Rprotobuf-commits mailing list