[Rcpp-commits] r1408 - in pkg: Rcpp/inst Rcpp/inst/include/Rcpp RcppGSL/inst/doc/RcppGSL

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jun 3 10:09:57 CEST 2010


Author: romain
Date: 2010-06-03 10:09:55 +0200 (Thu, 03 Jun 2010)
New Revision: 1408

Modified:
   pkg/Rcpp/inst/ChangeLog
   pkg/Rcpp/inst/include/Rcpp/XPtr.h
   pkg/RcppGSL/inst/doc/RcppGSL/RcppGSL.Rnw
Log:
few missing bits in the XPtr interface

Modified: pkg/Rcpp/inst/ChangeLog
===================================================================
--- pkg/Rcpp/inst/ChangeLog	2010-06-03 07:52:53 UTC (rev 1407)
+++ pkg/Rcpp/inst/ChangeLog	2010-06-03 08:09:55 UTC (rev 1408)
@@ -1,6 +1,8 @@
 2010-06-03  Romain Francois <romain at r-enthusiasts.com>
 
 	* src/RcppCommn.cpp: added show method for C++Object and C++Class
+	
+	* inst/include/Rcpp/XPtr.h: missing bits in the XPtr interface
 
 2010-06-02  Romain Francois <romain at r-enthusiasts.com>
 

Modified: pkg/Rcpp/inst/include/Rcpp/XPtr.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/XPtr.h	2010-06-03 07:52:53 UTC (rev 1407)
+++ pkg/Rcpp/inst/include/Rcpp/XPtr.h	2010-06-03 08:09:55 UTC (rev 1408)
@@ -43,7 +43,10 @@
      *
      * @param xp external pointer to wrap
      */
-    explicit XPtr(SEXP m_sexp) : RObject(m_sexp){} ;
+    explicit XPtr(SEXP m_sexp, SEXP tag = R_NilValue, SEXP prot = R_NilValue) : RObject(m_sexp){
+    	setTag( tag ) ;
+    	setProtected( prot ) ;
+    } ;
 		
     /**
      * creates a new external pointer wrapping the dumb pointer p. 
@@ -91,6 +94,16 @@
      */
     SEXP getTag() ;
     
+    template <typename U>
+    void setTag( const U& u){
+    	R_SetExternalPtrTag( m_sexp, Rcpp::wrap( u ) );
+    }
+    
+    template <typename U>
+    void setProtected( const U& u){
+    	R_SetExternalPtrProtected( m_sexp, Rcpp::wrap( u ) );
+    }
+    
     void setDeleteFinalizer() ;
   	
     inline operator T*(){ return (T*)(EXTPTR_PTR(m_sexp)) ; }

Modified: pkg/RcppGSL/inst/doc/RcppGSL/RcppGSL.Rnw
===================================================================
--- pkg/RcppGSL/inst/doc/RcppGSL/RcppGSL.Rnw	2010-06-03 07:52:53 UTC (rev 1407)
+++ pkg/RcppGSL/inst/doc/RcppGSL/RcppGSL.Rnw	2010-06-03 08:09:55 UTC (rev 1408)
@@ -13,12 +13,8 @@
     urlcolor=link
 }
 
-\newcommand{\proglang}[1]{\textsf{#1}}
-\newcommand{\pkg}[1]{{\fontseries{b}\selectfont #1}}
-
 \setlength{\oddsidemargin}{0pt}
 \setlength{\textwidth}{17cm} % uh-oh, I use letter :)
-\usepackage[authoryear,round,longnamesfirst]{natbib}
 
 \newcommand{\proglang}[1]{\textsf{#1}}
 \newcommand{\pkg}[1]{{\fontseries{b}\selectfont #1}}
@@ -52,6 +48,8 @@
   between \proglang{R} and C++.
 }
 
+TODO: bibtex reference for GSL
+
 \section{Introduction}
 
 TODO
@@ -360,8 +358,5 @@
 \bibliographystyle{abbrvnat}
 \bibliography{RcppGSL}
 
-\bibliographystyle{abbrvnat}
-\bibliography{RcppGSL}
-
 \end{document}
 



More information about the Rcpp-commits mailing list