[Rcpp-commits] r3819 - scripts

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Oct 23 16:38:17 CEST 2012


Author: romain
Date: 2012-10-23 16:38:17 +0200 (Tue, 23 Oct 2012)
New Revision: 3819

Modified:
   scripts/generator_Module_PointerCppMethod.R
Log:
using module_wrap

Modified: scripts/generator_Module_PointerCppMethod.R
===================================================================
--- scripts/generator_Module_PointerCppMethod.R	2012-10-23 14:10:57 UTC (rev 3818)
+++ scripts/generator_Module_PointerCppMethod.R	2012-10-23 14:38:17 UTC (rev 3819)
@@ -19,7 +19,7 @@
 		
 		Pointer_CppMethod%d(Method m) : method_class(), met(m){} 
 		SEXP operator()( Class* object, SEXP* args){
-			return Rcpp::wrap( met( object, %s ) ) ;
+			return Rcpp::module_wrap<Class,OUT>( met( object, %s ) ) ;
 		}
 		inline int nargs(){ return %d ; }
 		inline bool is_void(){ return false ; }
@@ -30,25 +30,6 @@
 		Method met ;
 	} ;
 	
-	template < typename Class, typename T, %s > 
-	class Pointer_CppMethod%d<Class, result<T>, %s> : public CppMethod<Class> {
-	public:
-		typedef result<T> (*Method)(Class*, %s) ;
-		typedef CppMethod<Class> method_class ;
-		
-		Pointer_CppMethod%d(Method m) : method_class(), met(m){} 
-		SEXP operator()( Class* object, SEXP* args){
-			return Rcpp::wrap( met( object, %s ) ) ;
-		}
-		inline int nargs(){ return %d ; }
-		inline bool is_void(){ return false ; }
-		inline bool is_const(){ return false ; }
-		inline void signature(std::string& s, const char* name){ Rcpp::signature<result<T>,%s>(s, name) ; }
-		
-	private:
-		Method met ;
-	} ;
-
 	template < typename Class, %s > class Pointer_CppMethod%d<Class,void,%s> : public CppMethod<Class> {
 	public:
 		typedef void (*Method)(Class*, %s) ;
@@ -78,7 +59,7 @@
 		
 		Const_Pointer_CppMethod%d(Method m) : method_class(), met(m){} 
 		SEXP operator()( Class* object, SEXP* args){
-			return Rcpp::wrap( met( object, %s ) ) ;
+			return Rcpp::module_wrap<Class,OUT>( met( object, %s ) ) ;
 		}
 		inline int nargs(){ return %d ; }
 		inline bool is_void(){ return false ; }
@@ -119,16 +100,7 @@
 U, 
 
 typenames,  # typename U0, ...
-i,           
-U,
-u,          # U0 u0, ...
 i, 
-as,         # Rcpp::as<U0>( args[0] ) , ...
-i,
-U, 
-
-typenames,  # typename U0, ...
-i, 
 U, 			# U0, ...
 u,          # U0 u0, ...
 i, 
@@ -165,7 +137,7 @@
 //
 // Module_generated_CppMethod.h: Rcpp R/C++ interface class library -- Rcpp modules
 //
-// Copyright (C) 2010	Doug Bates, Dirk Eddelbuettel and Romain Francois
+// Copyright (C) 2010-2012  Doug Bates, Dirk Eddelbuettel and Romain Francois
 //
 // This file is part of Rcpp.
 //
@@ -192,7 +164,7 @@
 		typedef CppMethod<Class> method_class ;
 		Pointer_CppMethod0( Method m) : method_class(), met(m){} 
 		SEXP operator()( Class* object, SEXP* ){
-			return Rcpp::wrap( met(object) ) ;
+			return Rcpp::module_wrap<Class,OUT>( met(object) ) ;
 		}
 		inline int nargs(){ return 0 ; }
 		inline bool is_void(){ return false ; }
@@ -203,25 +175,6 @@
 		Method met ;
 	} ;
 	
-	template <typename Class, typename T> 
-	class Pointer_CppMethod0< Class,result<T> > : public CppMethod<Class> {
-	public:
-		typedef result<T> (*Method)(Class*) ;
-		typedef CppMethod<Class> method_class ;
-		Pointer_CppMethod0( Method m) : method_class(), met(m){} 
-		SEXP operator()( Class* object, SEXP* ){
-		    T* ptr = met(object) ;
-			return internal::make_new_object<T>(ptr) ; 
-		}
-		inline int nargs(){ return 0 ; }
-		inline bool is_void(){ return false ; }
-		inline bool is_const(){ return false ; }
-		inline void signature(std::string& s, const char* name){ Rcpp::signature< result<T> >(s, name) ; }
-		
-	private:
-		Method met ;
-	} ;
-
 	template <typename Class> class Pointer_CppMethod0<Class,void> : public CppMethod<Class> {
 	public:
 		typedef void (*Method)(Class*) ;
@@ -250,7 +203,7 @@
 		typedef CppMethod<Class> method_class ;
 		Const_Pointer_CppMethod0( Method m) : method_class(), met(m){} 
 		SEXP operator()( Class* object, SEXP* ){
-			return Rcpp::wrap( met(object) ) ;
+			return Rcpp::module_wrap<Class,OUT>( met(object) ) ;
 		}
 		inline int nargs(){ return 0 ; }
 		inline bool is_void(){ return false ; }



More information about the Rcpp-commits mailing list