[Rprotobuf-commits] r322 - pkg/src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat May 8 13:18:53 CEST 2010
Author: romain
Date: 2010-05-08 13:18:52 +0200 (Sat, 08 May 2010)
New Revision: 322
Removed:
pkg/src/constructors.cpp
Modified:
pkg/src/extractors.cpp
pkg/src/fileDescriptor.cpp
pkg/src/lookup.cpp
pkg/src/rprotobuf.cpp
pkg/src/rprotobuf.h
Log:
remove unused pseudo consructors
Deleted: pkg/src/constructors.cpp
===================================================================
--- pkg/src/constructors.cpp 2010-05-08 11:14:07 UTC (rev 321)
+++ pkg/src/constructors.cpp 2010-05-08 11:18:52 UTC (rev 322)
@@ -1,201 +0,0 @@
-#include "rprotobuf.h"
-
-namespace rprotobuf{
-
-/**
- * Creates an R object of S4 class Descriptor
- * from a google::protobuf::Descriptor pointer
- *
- * @param d Descriptor
- *
- * @return a new "Descriptor" R object holding the
- * descriptor as an external pointer
- */
-SEXP new_RS4_Descriptor( const GPB::Descriptor* d ){
-
- NEW_S4_OBJECT( "Descriptor") ;
-
- /* grab the fully qualified name of the message type */
- SEXP name = PROTECT( Rf_mkString( d->full_name().c_str() ) ) ;
-
- /*
- we don't protect anything with this xp, and we do not need
- a finalizer since the object belongs to the DescriptorPool
- it comes from
- */
- SEXP ptr = PROTECT( R_MakeExternalPtr( (void*)d , R_NilValue, R_NilValue));
-
- SET_SLOT( oo, Rf_install("type"), name ) ;
- SET_SLOT( oo, Rf_install("pointer"), ptr ) ;
-
- UNPROTECT(3) ; /* oo, name, ptr */
-
- return oo;
-}
-
-/**
- * Creates an new R object of S4 class "FieldDescriptor"
- *
- * @param fd pointer to a google::protobuf::FieldDescriptor
- *
- * @return a new "FieldDescriptor" R object
- */
-SEXP new_RS4_FieldDescriptor( const GPB::FieldDescriptor* fd ){
-
- NEW_S4_OBJECT( "FieldDescriptor") ;
-
- /* grab the short name of the field */
- SEXP name = PROTECT( Rf_mkString( fd->name().c_str() ) ) ;
-
- /* grab the full name */
- SEXP fname = PROTECT( Rf_mkString( fd->full_name().c_str() ) ) ;
-
- /* hold the FieldDescriptor as an external pointer */
- /* no need for a finalizer, the object belongs to the DescriptorPool */
- SEXP ptr = PROTECT( R_MakeExternalPtr( (void*)fd ,
- R_NilValue, R_NilValue));
-
- /* the fully qualified TYPE associated with this field descriptor */
- SEXP type = PROTECT( Rf_mkString( fd->containing_type()->full_name().c_str() ) ) ;
-
- SET_SLOT( oo, Rf_install("name"), name ) ;
- SET_SLOT( oo, Rf_install("full_name"), fname ) ;
- SET_SLOT( oo, Rf_install("type"), type ) ;
- SET_SLOT( oo, Rf_install("pointer"), ptr ) ;
-
- UNPROTECT(5) ; /* oo, name, fname, ptr, type */
-
- return oo;
-}
-
-/**
- * Creates a new "EnumDescriptor" R S4 object
- *
- * @param fd pointer to a google::protobuf::EnumDescriptor
- *
- * @return a new "EnumDescriptor" holding the
- * EnumDescriptor as an external pointer
- */
-SEXP new_RS4_EnumDescriptor( const GPB::EnumDescriptor* fd ){
-
- NEW_S4_OBJECT( "EnumDescriptor") ;
-
- /* the simple name of the enum */
- SEXP name = PROTECT( Rf_mkString( fd->name().c_str() ) ) ;
-
- /* the full name */
- SEXP fname = PROTECT( Rf_mkString( fd->full_name().c_str() ) ) ;
-
- /* external pointer to the EnumDescriptor */
- /* no need for a finalizer */
- SEXP ptr = PROTECT( R_MakeExternalPtr( (void*)fd ,
- R_NilValue, R_NilValue));
-
- /* message type where the enum is defined */
- const GPB::Descriptor *type_desc = fd->containing_type() ;
- SEXP type = R_NilValue ;
- if( type_desc ){
- type = PROTECT( Rf_mkString( type_desc->full_name().c_str() ) ) ;
- } else{
- type = PROTECT( Rf_allocVector( STRSXP, 0 ) ) ;
- }
- SET_SLOT( oo, Rf_install("name"), name ) ;
- SET_SLOT( oo, Rf_install("full_name"), fname ) ;
- SET_SLOT( oo, Rf_install("type"), type ) ;
- SET_SLOT( oo, Rf_install("pointer"), ptr ) ;
-
- UNPROTECT(5) ; /* oo, name, fname, ptr, type */
-
- return oo;
-}
-
-/**
- * Creates a new "ServiceDescriptor" R S4 object
- *
- * @param fd pointer to a google::protobuf::ServiceDescriptor
- *
- * @return a new "ServiceDescriptor" holding the
- * ServiceDescriptor as an external pointer
- */
-SEXP new_RS4_ServiceDescriptor( const GPB::ServiceDescriptor* sd ){
-
- NEW_S4_OBJECT( "ServiceDescriptor" ) ;
-
- /* the simple name of the enum */
- SEXP name = PROTECT( Rf_mkString( sd->full_name().c_str() ) ) ;
-
- /* external pointer to the ServiceDescriptor */
- /* no need for a finalizer */
- SEXP ptr = PROTECT( R_MakeExternalPtr( (void*)sd ,
- R_NilValue, R_NilValue));
-
- SET_SLOT( oo, Rf_install("name"), name ) ;
- SET_SLOT( oo, Rf_install("pointer"), ptr ) ;
-
- UNPROTECT(3) ; /* oo, name,ptr */
-
- return oo;
-}
-
-/**
- * Creates a new MethodDescriptor R S4 object
- *
- * @param fd pointer to a google::protobuf::MethodDescriptor
- *
- * @return a new holding the
- * MethodDescriptor as an external pointer
- */
-SEXP new_RS4_MethodDescriptor( const GPB::MethodDescriptor* md ){
-
- NEW_S4_OBJECT( "MethodDescriptor" ) ;
-
- /* the full name */
- SEXP fname = PROTECT( Rf_mkString( md->full_name().c_str() ) ) ;
-
- /* external pointer to the EnumDescriptor */
- /* no need for a finalizer */
- SEXP ptr = PROTECT( R_MakeExternalPtr( (void*)md ,
- R_NilValue, R_NilValue));
-
- /* message type where the enum is defined */
- SEXP service = PROTECT( Rf_mkString( md->service()->full_name().c_str() ) ) ;
-
- SET_SLOT( oo, Rf_install("name"), fname ) ;
- SET_SLOT( oo, Rf_install("service"), service ) ;
- SET_SLOT( oo, Rf_install("pointer"), ptr ) ;
-
- UNPROTECT(4) ; /* oo, fname, ptr, service */
-
- return oo;
-}
-
-SEXP new_RS4_FileDescriptor( const GPB::FileDescriptor* fd ){
-
- NEW_S4_OBJECT( "FileDescriptor" ) ;
-
- /* no need for a finalizer */
- SEXP ptr = PROTECT( R_MakeExternalPtr( (void*)fd ,
- R_NilValue, R_NilValue));
- SET_SLOT( oo, Rf_install("pointer"), ptr ) ;
-
- UNPROTECT(2) ; /* oo, ptr */
-
- return oo;
-}
-
-SEXP new_RS4_EnumValueDescriptor( const GPB::EnumValueDescriptor* fd ){
-
- NEW_S4_OBJECT( "EnumValueDescriptor" ) ;
-
- /* no need for a finalizer */
- SEXP ptr = PROTECT( R_MakeExternalPtr( (void*)fd ,
- R_NilValue, R_NilValue));
- SET_SLOT( oo, Rf_install("pointer"), ptr ) ;
-
- UNPROTECT(2) ; /* oo, ptr */
-
- return oo;
-}
-
-} // namespace rprotobuf
-
Modified: pkg/src/extractors.cpp
===================================================================
--- pkg/src/extractors.cpp 2010-05-08 11:14:07 UTC (rev 321)
+++ pkg/src/extractors.cpp 2010-05-08 11:18:52 UTC (rev 322)
@@ -219,7 +219,7 @@
throwException( "could not get MethodDescriptor", "NoSuchMethodException" ) ;
}
- return new_RS4_MethodDescriptor( method_desc );
+ return S4_MethodDescriptor( method_desc );
}
Modified: pkg/src/fileDescriptor.cpp
===================================================================
--- pkg/src/fileDescriptor.cpp 2010-05-08 11:14:07 UTC (rev 321)
+++ pkg/src/fileDescriptor.cpp 2010-05-08 11:18:52 UTC (rev 322)
@@ -7,7 +7,7 @@
*/
SEXP get_message_file_descriptor(SEXP xp){
GPB::Message* message = GET_MESSAGE_POINTER_FROM_XP( xp ) ;
- return new_RS4_FileDescriptor( message->GetDescriptor()->file() );
+ return S4_FileDescriptor( message->GetDescriptor()->file() );
}
/**
@@ -15,7 +15,7 @@
*/
SEXP get_descriptor_file_descriptor(SEXP xp){
GPB::Descriptor* desc = (GPB::Descriptor*) EXTPTR_PTR( xp ) ;
- return new_RS4_FileDescriptor( desc->file() );
+ return S4_FileDescriptor( desc->file() );
}
/**
@@ -23,7 +23,7 @@
*/
SEXP get_enum_file_descriptor(SEXP xp){
GPB::EnumDescriptor* desc = (GPB::EnumDescriptor*) EXTPTR_PTR( xp ) ;
- return new_RS4_FileDescriptor( desc->file() );
+ return S4_FileDescriptor( desc->file() );
}
/**
@@ -31,7 +31,7 @@
*/
SEXP get_field_file_descriptor(SEXP xp){
GPB::FieldDescriptor* desc = (GPB::FieldDescriptor*) EXTPTR_PTR( xp ) ;
- return new_RS4_FileDescriptor( desc->file() );
+ return S4_FileDescriptor( desc->file() );
}
/**
@@ -39,7 +39,7 @@
*/
SEXP get_service_file_descriptor(SEXP xp){
GPB::ServiceDescriptor* desc = (GPB::ServiceDescriptor*) EXTPTR_PTR( xp ) ;
- return new_RS4_FileDescriptor( desc->file() );
+ return S4_FileDescriptor( desc->file() );
}
/**
@@ -47,7 +47,7 @@
*/
SEXP get_method_file_descriptor(SEXP xp){
GPB::MethodDescriptor* desc = (GPB::MethodDescriptor*) EXTPTR_PTR( xp ) ;
- return new_RS4_FileDescriptor( desc->service()->file() );
+ return S4_FileDescriptor( desc->service()->file() );
}
Modified: pkg/src/lookup.cpp
===================================================================
--- pkg/src/lookup.cpp 2010-05-08 11:14:07 UTC (rev 321)
+++ pkg/src/lookup.cpp 2010-05-08 11:18:52 UTC (rev 322)
@@ -60,23 +60,23 @@
if( desc ){
/* message */
DescriptorPoolLookup::add( name_string ) ;
- return new_RS4_Descriptor( desc ) ;
+ return S4_Descriptor( desc ) ;
} else {
const GPB::EnumDescriptor* enum_desc = pool->FindEnumTypeByName( name_string ) ;
if( enum_desc ){
/* enum */
DescriptorPoolLookup::add( name_string ) ;
- return new_RS4_EnumDescriptor( enum_desc );
+ return S4_EnumDescriptor( enum_desc );
} else{
const GPB::ServiceDescriptor* service_desc = pool->FindServiceByName( name_string ) ;
if( service_desc ){
DescriptorPoolLookup::add( name_string ) ;
- return new_RS4_ServiceDescriptor( service_desc ) ;
+ return S4_ServiceDescriptor( service_desc ) ;
} else {
const GPB::MethodDescriptor* method_desc = pool->FindMethodByName( name_string );
if( method_desc ){
DescriptorPoolLookup::add( name_string ) ;
- return new_RS4_MethodDescriptor( method_desc );
+ return S4_MethodDescriptor( method_desc );
}
}
}
Modified: pkg/src/rprotobuf.cpp
===================================================================
--- pkg/src/rprotobuf.cpp 2010-05-08 11:14:07 UTC (rev 321)
+++ pkg/src/rprotobuf.cpp 2010-05-08 11:18:52 UTC (rev 322)
@@ -80,7 +80,7 @@
}
}
- return( new_RS4_Descriptor( desc ) ) ;
+ return( RS4_Descriptor( desc ) ) ;
}
/**
@@ -133,7 +133,7 @@
if( desc->field_count() ){
const GPB::FieldDescriptor* fd = desc->FindFieldByName(what) ;
if( fd ){
- return( new_RS4_FieldDescriptor(fd ) ) ;
+ return( RS4_FieldDescriptor(fd ) ) ;
}
}
@@ -141,7 +141,7 @@
if( desc->nested_type_count() ){
const GPB::Descriptor* d = desc->FindNestedTypeByName(what) ;
if( d ){
- return( new_RS4_Descriptor( d ) ) ;
+ return( S4_Descriptor( d ) ) ;
}
}
@@ -149,7 +149,7 @@
if( desc->enum_type_count() ){
const GPB::EnumDescriptor* ed = desc->FindEnumTypeByName(what) ;
if( ed ){
- return( new_RS4_EnumDescriptor( ed ) ) ;
+ return( S4_EnumDescriptor( ed ) ) ;
}
}
Modified: pkg/src/rprotobuf.h
===================================================================
--- pkg/src/rprotobuf.h 2010-05-08 11:14:07 UTC (rev 321)
+++ pkg/src/rprotobuf.h 2010-05-08 11:18:52 UTC (rev 322)
@@ -256,15 +256,6 @@
RcppExport SEXP check_libprotobuf_version( SEXP ) ;
RcppExport SEXP get_protobuf_library_version() ;
-/* in constructors.cpp */
-RcppExport SEXP new_RS4_Descriptor( const GPB::Descriptor* );
-RcppExport SEXP new_RS4_FieldDescriptor( const GPB::FieldDescriptor* );
-RcppExport SEXP new_RS4_EnumDescriptor( const GPB::EnumDescriptor*);
-RcppExport SEXP new_RS4_ServiceDescriptor( const GPB::ServiceDescriptor* ) ;
-RcppExport SEXP new_RS4_MethodDescriptor( const GPB::MethodDescriptor* ) ;
-RcppExport SEXP new_RS4_FileDescriptor( const GPB::FileDescriptor* ) ;
-RcppExport SEXP new_RS4_EnumValueDescriptor( const GPB::EnumValueDescriptor* ) ;
-
/* in extractors.cpp */
RcppExport SEXP getMessageField( SEXP, SEXP );
RcppExport SEXP extractFieldAsSEXP( const Rcpp::XPtr<GPB::Message>& , const GPB::Descriptor*, const GPB::FieldDescriptor* ) ;
More information about the Rprotobuf-commits
mailing list