[Rcpp-commits] r4171 - in pkg/Rcpp: . R inst/include inst/include/Rcpp inst/include/Rcpp/api/meat inst/include/Rcpp/generated inst/include/Rcpp/macros inst/include/Rcpp/module inst/include/Rcpp/vector inst/unitTests inst/unitTests/cpp man src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Dec 22 10:27:29 CET 2012


Author: romain
Date: 2012-12-22 10:27:29 +0100 (Sat, 22 Dec 2012)
New Revision: 4171

Added:
   pkg/Rcpp/inst/unitTests/cpp/language.cpp
Removed:
   pkg/Rcpp/man/CppClassRepresentation-class.Rd
   pkg/Rcpp/man/CppObjectS3-class.Rd
Modified:
   pkg/Rcpp/ChangeLog
   pkg/Rcpp/DESCRIPTION
   pkg/Rcpp/NAMESPACE
   pkg/Rcpp/R/00_classes.R
   pkg/Rcpp/inst/include/Rcpp/DataFrame.h
   pkg/Rcpp/inst/include/Rcpp/DottedPair.h
   pkg/Rcpp/inst/include/Rcpp/Formula.h
   pkg/Rcpp/inst/include/Rcpp/InternalFunction.h
   pkg/Rcpp/inst/include/Rcpp/Language.h
   pkg/Rcpp/inst/include/Rcpp/Module.h
   pkg/Rcpp/inst/include/Rcpp/RObject.h
   pkg/Rcpp/inst/include/Rcpp/Reference.h
   pkg/Rcpp/inst/include/Rcpp/S4.h
   pkg/Rcpp/inst/include/Rcpp/XPtr.h
   pkg/Rcpp/inst/include/Rcpp/api/meat/Matrix.h
   pkg/Rcpp/inst/include/Rcpp/api/meat/Vector.h
   pkg/Rcpp/inst/include/Rcpp/config.h
   pkg/Rcpp/inst/include/Rcpp/generated/Language__ctors.h
   pkg/Rcpp/inst/include/Rcpp/macros/debug.h
   pkg/Rcpp/inst/include/Rcpp/module/class.h
   pkg/Rcpp/inst/include/Rcpp/module/class_Base.h
   pkg/Rcpp/inst/include/Rcpp/vector/Matrix.h
   pkg/Rcpp/inst/include/Rcpp/vector/SubMatrix.h
   pkg/Rcpp/inst/include/Rcpp/vector/Vector.h
   pkg/Rcpp/inst/include/Rcpp/vector/traits.h
   pkg/Rcpp/inst/include/RcppCommon.h
   pkg/Rcpp/inst/unitTests/runit.Language.R
   pkg/Rcpp/inst/unitTests/runit.Module.client.package.R
   pkg/Rcpp/src/Module.cpp
   pkg/Rcpp/src/api.cpp
   pkg/Rcpp/src/barrier.cpp
   pkg/Rcpp/src/internal.h
Log:
huge commit post 0.10.2, will add comments later, but now I gotta go

Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog	2012-12-21 12:27:00 UTC (rev 4170)
+++ pkg/Rcpp/ChangeLog	2012-12-22 09:27:29 UTC (rev 4171)
@@ -1,3 +1,8 @@
+2012-12-20 Romain Francois <romain at r-enthusiasts.com>
+
+        * NAMESPACE : remove C++ObjectS3 and C++ClassRepresentation classes
+        * R/00_classes.R: remove unused S4 classes
+
 2012-12-21  Dirk Eddelbuettel  <edd at debian.org>
 
         * DESCRIPTION: Release 0.10.2

Modified: pkg/Rcpp/DESCRIPTION
===================================================================
--- pkg/Rcpp/DESCRIPTION	2012-12-21 12:27:00 UTC (rev 4170)
+++ pkg/Rcpp/DESCRIPTION	2012-12-22 09:27:29 UTC (rev 4171)
@@ -1,6 +1,6 @@
 Package: Rcpp
 Title: Seamless R and C++ Integration
-Version: 0.10.2
+Version: 0.10.2.1
 Date: $Date$
 Author: Dirk Eddelbuettel and Romain Francois, with contributions 
  by Douglas Bates, John Chambers and JJ Allaire

Modified: pkg/Rcpp/NAMESPACE
===================================================================
--- pkg/Rcpp/NAMESPACE	2012-12-21 12:27:00 UTC (rev 4170)
+++ pkg/Rcpp/NAMESPACE	2012-12-22 09:27:29 UTC (rev 4171)
@@ -3,11 +3,10 @@
 import( methods )
 importFrom( utils, capture.output, assignInNamespace, .DollarNames, prompt, packageDescription )
 
-exportClasses( Module, "C++ObjectS3", "C++Field", 
+exportClasses( Module, "C++Field", 
     "C++OverloadedMethods", 
     "C++Constructor", 
-    "C++Class", "C++Object", "C++Function", 
-    "C++ClassRepresentation"
+    "C++Class", "C++Object", "C++Function"
     )
 
 S3method( .DollarNames, "C++Object" )

Modified: pkg/Rcpp/R/00_classes.R
===================================================================
--- pkg/Rcpp/R/00_classes.R	2012-12-21 12:27:00 UTC (rev 4170)
+++ pkg/Rcpp/R/00_classes.R	2012-12-22 09:27:29 UTC (rev 4171)
@@ -15,10 +15,6 @@
 # You should have received a copy of the GNU General Public License
 # along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
 
-# not used, but this keeps packages that import the class happy
-# e.g. highlight 
-setClass( "C++ObjectS3" ) 
-
 # anticipating a change in R 2.16.0
 setClass( "refClassGeneratorFunction" )
 setClassUnion("refGenerator", c("refObjectGenerator", "refClassGeneratorFunction")) 
@@ -84,16 +80,7 @@
 	), 
 	contains = "character"
 	)
-setClass( "C++ClassRepresentation", 
-    representation( 
-        pointer         = "externalptr", 
-        generator       = "refGenerator", 
-        cpp_fields      = "list", 
-        cpp_methods     = "list", 
-        cpp_constructor = "list"
-    ), 
-    contains = "classRepresentation" )
-
+	
 setClass( "C++Object")
 
 setClass( "C++Function", 

Modified: pkg/Rcpp/inst/include/Rcpp/DataFrame.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/DataFrame.h	2012-12-21 12:27:00 UTC (rev 4170)
+++ pkg/Rcpp/inst/include/Rcpp/DataFrame.h	2012-12-22 09:27:29 UTC (rev 4171)
@@ -47,7 +47,7 @@
 #include <Rcpp/generated/DataFrame_generated.h>           
 
     private:
-        void set(SEXP x) ;
+        void set_sexp(SEXP x) ;
         
     } ;
         

Modified: pkg/Rcpp/inst/include/Rcpp/DottedPair.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/DottedPair.h	2012-12-21 12:27:00 UTC (rev 4170)
+++ pkg/Rcpp/inst/include/Rcpp/DottedPair.h	2012-12-22 09:27:29 UTC (rev 4171)
@@ -33,10 +33,10 @@
 
 	DottedPair() ;
 	
-	DottedPair( const DottedPair& other) : RObject(){
-		setSEXP( other.asSexp() ) ;
-	}
+	DottedPair(SEXP x) : RObject(x){} 
 	
+	DottedPair( const DottedPair& other) : RObject(other.asSexp()){}
+	
 	DottedPair& operator=( const DottedPair& other) ; 
 	
 #ifdef HAS_VARIADIC_TEMPLATES

Modified: pkg/Rcpp/inst/include/Rcpp/Formula.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/Formula.h	2012-12-21 12:27:00 UTC (rev 4170)
+++ pkg/Rcpp/inst/include/Rcpp/Formula.h	2012-12-22 09:27:29 UTC (rev 4171)
@@ -2,7 +2,7 @@
 //
 // Formula.h: Rcpp R/C++ interface class library -- formula
 //
-// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois
+// Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois
 //
 // This file is part of Rcpp.
 //
@@ -39,6 +39,9 @@
 
         Formula& operator=(const Formula& other) ;
         
+    private:
+        void set_sexp(SEXP x) ;
+        
     } ; 
 
 } // namespace Rcpp

Modified: pkg/Rcpp/inst/include/Rcpp/InternalFunction.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/InternalFunction.h	2012-12-21 12:27:00 UTC (rev 4170)
+++ pkg/Rcpp/inst/include/Rcpp/InternalFunction.h	2012-12-22 09:27:29 UTC (rev 4171)
@@ -2,7 +2,7 @@
 //
 // InternalFunction.h: Rcpp R/C++ interface class library -- exposing C++ functions
 //
-// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois
+// Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois
 //
 // This file is part of Rcpp.
 //
@@ -39,8 +39,6 @@
 		
 private:
 	
-	// TODO: we can probably make this more efficient
-	//       by caching the Rcpp namespace or the function
 	inline void set( SEXP xp){
 		Environment RCPP = Environment::Rcpp_namespace() ;
 		Function intf = RCPP["internal_function"] ;

Modified: pkg/Rcpp/inst/include/Rcpp/Language.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/Language.h	2012-12-21 12:27:00 UTC (rev 4170)
+++ pkg/Rcpp/inst/include/Rcpp/Language.h	2012-12-22 09:27:29 UTC (rev 4171)
@@ -100,11 +100,11 @@
 #ifdef HAS_VARIADIC_TEMPLATES
         template<typename... Args> 
         Language( const std::string& symbol, const Args&... args) : DottedPair(Rf_install(symbol.c_str()), args...) {
-            update() ;
+            update_language_object() ;
         }
         template<typename... Args> 
         Language( const Function& function, const Args&... args) : DottedPair(function, args...) {
-            update() ;
+            update_language_object() ;
         }
 #else
 
@@ -142,9 +142,12 @@
         
         ~Language() ;
 
+    protected:
+        void update_language_object() ; 
+
     private:
-        virtual void update() ; 
-
+        void set_sexp(SEXP x) ;
+        
     };
 
     template <typename OUT=SEXP>

Modified: pkg/Rcpp/inst/include/Rcpp/Module.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/Module.h	2012-12-21 12:27:00 UTC (rev 4170)
+++ pkg/Rcpp/inst/include/Rcpp/Module.h	2012-12-22 09:27:29 UTC (rev 4171)
@@ -202,8 +202,11 @@
 
     template <typename Class>
     class S4_CppConstructor : public Rcpp::Reference {
-    public:             
-        S4_CppConstructor( SignedConstructor<Class>* m, SEXP class_xp, const std::string& class_name, std::string& buffer ) : Reference( "C++Constructor" ){
+    public:  
+        typedef XPtr<class_Base> XP_Class ;
+        
+        S4_CppConstructor( SignedConstructor<Class>* m, const XP_Class& class_xp, const std::string& class_name, std::string& buffer ) : Reference( "C++Constructor" ){
+            RCPP_DEBUG( "S4_CppConstructor( SignedConstructor<Class>* m, SEXP class_xp, const std::string& class_name, std::string& buffer" ) ;
             field( "pointer" )       = Rcpp::XPtr< SignedConstructor<Class> >( m, false ) ;
             field( "class_pointer" ) = class_xp ;
             field( "nargs" )         = m->nargs() ;
@@ -211,15 +214,28 @@
             field( "signature" )     = buffer ;
             field( "docstring" )     = m->docstring ;
         }
+        
+        S4_CppConstructor( const S4_CppConstructor& other) : Reference( other.asSexp() ) {}
+        S4_CppConstructor& operator=( const S4_CppConstructor& other){
+            setSEXP( other.asSexp() ); 
+            return *this ;
+        }
     } ;
 
     template <typename Class>
     class S4_CppOverloadedMethods : public Rcpp::Reference {
     public:    
+        typedef Rcpp::XPtr<class_Base> XP_Class ;
         typedef SignedMethod<Class> signed_method_class ;
         typedef std::vector<signed_method_class*> vec_signed_method ;
         
-        S4_CppOverloadedMethods( vec_signed_method* m, SEXP class_xp, const char* name, std::string& buffer ) : Reference( "C++OverloadedMethods" ){
+        // FIXME: is class_xp protected ?
+        S4_CppOverloadedMethods( vec_signed_method* m, const XP_Class& class_xp, const char* name, std::string& buffer ) : Reference( "C++OverloadedMethods" ){
+            RCPP_DEBUG_2( "S4_CppOverloadedMethods( vec_signed_method* m, const XP_Class& class_xp = <%p>, const char* name = %s, std::string& buffer )", name, class_xp.asSexp() )
+            #if RCPP_DEBUG_LEVEL > 0
+                Rf_PrintValue( class_xp ) ;
+            #endif
+            
             int n = m->size() ;
             Rcpp::LogicalVector voidness(n), constness(n) ;
             Rcpp::CharacterVector docstrings(n), signatures(n) ;
@@ -245,6 +261,13 @@
             field( "nargs" )         = nargs ;
             
         }
+        S4_CppOverloadedMethods( const S4_CppOverloadedMethods& other){ 
+            setSEXP( other.asSexp() ) ;
+        }
+        S4_CppOverloadedMethods& operator=( const S4_CppOverloadedMethods& other){ 
+            setSEXP( other.asSexp() ) ;
+            return *this ;
+        }
     } ;
 
 #include <Rcpp/module/Module_generated_CppMethod.h>
@@ -306,14 +329,21 @@
 
     template <typename Class>
     class S4_field : public Rcpp::Reference {
-    public:             
-        S4_field( CppProperty<Class>* p, SEXP class_xp ) : Reference( "C++Field" ){
+    public:   
+        typedef XPtr<class_Base> XP_Class ;
+        S4_field( CppProperty<Class>* p, const XP_Class& class_xp ) : Reference( "C++Field" ){
+            RCPP_DEBUG( "S4_field( CppProperty<Class>* p, const XP_Class& class_xp )" )
             field( "read_only" )     = p->is_readonly() ;
             field( "cpp_class" )     = p->get_class();
             field( "pointer" )       = Rcpp::XPtr< CppProperty<Class> >( p, false ) ;
             field( "class_pointer" ) = class_xp ;
             field( "docstring" )     = p->docstring ;
         }
+        S4_field( const S4_field& other) : Reference(other.asSexp()) {}
+        S4_field& operator=(const S4_field& other){
+            setSEXP(other.asSexp());
+            return *this ;
+        }
     } ;
 
 #include <Rcpp/module/Module_Property.h>
@@ -370,12 +400,18 @@
         typedef Rcpp::XPtr<Rcpp::Module> XP ;
         CppClass( Module* p, class_Base* clazz, std::string& ) ;
         CppClass( SEXP x) ;
+        CppClass( const CppClass& ) ;
+        CppClass& operator=( const CppClass& ) ;
+        
     } ;
 
     class CppObject : public S4{
     public:
         typedef Rcpp::XPtr<Rcpp::Module> XP ;
         CppObject( Module* p, class_Base*, SEXP xp ) ;
+        CppObject( const CppObject& ) ;
+        CppObject& operator=( const CppObject& ) ;
+        
     } ;
 
     class FunctionProxy{

Modified: pkg/Rcpp/inst/include/Rcpp/RObject.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/RObject.h	2012-12-21 12:27:00 UTC (rev 4170)
+++ pkg/Rcpp/inst/include/Rcpp/RObject.h	2012-12-22 09:27:29 UTC (rev 4171)
@@ -37,14 +37,14 @@
         /**
          * default constructor. uses R_NilValue
          */ 
-        RObject() : m_sexp(R_NilValue) {} ; 
+        RObject() ; 
 
         /**
          * wraps a SEXP. The SEXP is automatically protected from garbage 
          * collection by this object and the protection vanishes when this 
          * object is destroyed
          */
-        RObject(SEXP x) : m_sexp(R_NilValue) { setSEXP(x) ; };
+        RObject(SEXP x) ;
 
         /**
          * Copy constructor. set this SEXP to the SEXP of the copied object
@@ -246,7 +246,7 @@
          */
         SlotProxy slot(const std::string& name) const ;
     
-    protected:
+    protected:                                  
 
         /**
          * sets the SEXP wrapped by this object
@@ -261,15 +261,6 @@
          */
         SEXP m_sexp ;
     
-    private:
-
-        void preserve(){ if( m_sexp != R_NilValue ) R_PreserveObject(m_sexp) ; }
-        void release() { if( m_sexp != R_NilValue ) R_ReleaseObject(m_sexp) ; } 
-    
-        virtual void update(){
-            RCPP_DEBUG_1( "RObject::update(SEXP = <%p> )", m_sexp ) 
-        } ;
-    
     };
 
 } // namespace Rcpp

Modified: pkg/Rcpp/inst/include/Rcpp/Reference.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/Reference.h	2012-12-21 12:27:00 UTC (rev 4170)
+++ pkg/Rcpp/inst/include/Rcpp/Reference.h	2012-12-22 09:27:29 UTC (rev 4171)
@@ -138,7 +138,8 @@
     
     
     private:
-        void set( SEXP x) ;        
+        void set_sexp( SEXP x) ;
+        void check() ;        
     } ;
 
 } // namespace Rcpp

Modified: pkg/Rcpp/inst/include/Rcpp/S4.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/S4.h	2012-12-21 12:27:00 UTC (rev 4170)
+++ pkg/Rcpp/inst/include/Rcpp/S4.h	2012-12-22 09:27:29 UTC (rev 4171)
@@ -72,7 +72,7 @@
         bool is( const std::string& clazz) ;
         
     private:
-        void set( SEXP x) ;
+        void set_sexp( SEXP x) ;
     } ;
 
 } // namespace Rcpp

Modified: pkg/Rcpp/inst/include/Rcpp/XPtr.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/XPtr.h	2012-12-21 12:27:00 UTC (rev 4170)
+++ pkg/Rcpp/inst/include/Rcpp/XPtr.h	2012-12-22 09:27:29 UTC (rev 4171)
@@ -57,10 +57,10 @@
      * @param xp external pointer to wrap
      */
     explicit XPtr(SEXP m_sexp, SEXP tag = R_NilValue, SEXP prot = R_NilValue) : RObject(m_sexp){
-	if( TYPEOF(m_sexp) != EXTPTRSXP )
-	    throw ::Rcpp::not_compatible( "expecting an external pointer" ) ;
-    	R_SetExternalPtrTag( m_sexp, tag ) ;
-    	R_SetExternalPtrProtected( m_sexp, prot ) ;
+        if( TYPEOF(m_sexp) != EXTPTRSXP )
+            throw ::Rcpp::not_compatible( "expecting an external pointer" ) ;
+        R_SetExternalPtrTag( m_sexp, tag ) ;
+        R_SetExternalPtrProtected( m_sexp, prot ) ;
     } ;
 		
     /**
@@ -74,13 +74,18 @@
      *        so you need to make sure the pointer can be "delete" d
      *        this way (has to be a C++ object)
      */
-     explicit XPtr(T* p, bool set_delete_finalizer = true, SEXP tag = R_NilValue, SEXP prot = R_NilValue){
-         setSEXP( R_MakeExternalPtr( (void*)p , tag, prot) ) ;
+    explicit XPtr(T* p, bool set_delete_finalizer = true, SEXP tag = R_NilValue, SEXP prot = R_NilValue){
+        RCPP_DEBUG( "XPtr(T* p, bool set_delete_finalizer = true, SEXP tag = R_NilValue, SEXP prot = R_NilValue)" )
+        SEXP x = PROTECT( R_MakeExternalPtr( (void*)p , tag, prot) ) ; 
+        #if RCPP_DEBUG_LEVEL > 0
+        Rf_PrintValue( x ) ;
+        #endif
+        setSEXP( x ) ;
+        UNPROTECT(1); 
         if( set_delete_finalizer ){
-    	setDeleteFinalizer() ;
+            setDeleteFinalizer() ;
         }
-    
-     }
+    }
 
     XPtr( const XPtr& other ) : RObject( other.asSexp() ) {}
     

Modified: pkg/Rcpp/inst/include/Rcpp/api/meat/Matrix.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/api/meat/Matrix.h	2012-12-21 12:27:00 UTC (rev 4170)
+++ pkg/Rcpp/inst/include/Rcpp/api/meat/Matrix.h	2012-12-22 09:27:29 UTC (rev 4171)
@@ -25,18 +25,11 @@
 namespace Rcpp{ 
 
     template <int RTYPE>
-    Matrix<RTYPE>::Matrix(SEXP x) : VECTOR(), nrows(0) {
-        if( ! ::Rf_isMatrix(x) ) throw not_compatible("not a matrix") ;
-        SEXP y = r_cast<RTYPE>( x ) ;
-        VECTOR::setSEXP( y );
-        nrows = VECTOR::dims()[0] ;
-    }
-     
+    Matrix<RTYPE>::Matrix(SEXP x) : VECTOR( r_cast<RTYPE>( x ) ), nrows( VECTOR::dims()[0] ) {}
     
     template <int RTYPE>
-    Matrix<RTYPE>::Matrix( const Dimension& dims) : VECTOR(), nrows(dims[0]) {
+    Matrix<RTYPE>::Matrix( const Dimension& dims) : VECTOR( Rf_allocMatrix( RTYPE, dims[0], dims[1] ) ), nrows(dims[0]) {
         if( dims.size() != 2 ) throw not_compatible("not a matrix") ;
-        VECTOR::setSEXP( Rf_allocMatrix( RTYPE, dims[0], dims[1] ) ) ;
         VECTOR::init() ;
     }
     
@@ -59,25 +52,19 @@
     Matrix<RTYPE>::Matrix( const int& n) : VECTOR( Dimension( n, n ) ), nrows(n) {}
     
     template <int RTYPE>
-    Matrix<RTYPE>::Matrix( const Matrix& other) : VECTOR(), nrows(other.nrows) {
-        SEXP x = other.asSexp() ;
-        if( ! ::Rf_isMatrix(x) ) throw not_compatible("not a matrix") ;
-        VECTOR::setSEXP( x ) ;
-    }
+    Matrix<RTYPE>::Matrix( const Matrix& other) : VECTOR( other.asSexp() ), nrows(other.nrows) {}
     
     template <int RTYPE>
     template <bool NA, typename MAT>
-    Matrix<RTYPE>::Matrix( const MatrixBase<RTYPE,NA,MAT>& other ) : VECTOR(), nrows(other.nrow()) {
-        int nc = other.ncol() ;
-        RObject::setSEXP( Rf_allocMatrix( RTYPE, nrows, nc ) ) ;
-        import_matrix_expression<NA,MAT>( other, nrows, nc ) ;
+    Matrix<RTYPE>::Matrix( const MatrixBase<RTYPE,NA,MAT>& other ) : VECTOR( Rf_allocMatrix( RTYPE, other.nrow(), other.ncol() ) ), nrows(other.nrow()) {
+        import_matrix_expression<NA,MAT>( other, nrows, ncol() ) ;
     }
     
     template <int RTYPE>
     Matrix<RTYPE>& Matrix<RTYPE>::operator=(const Matrix& other) {
         SEXP x = other.asSexp() ;
         if( ! ::Rf_isMatrix(x) ) not_compatible("not a matrix") ;
-        VECTOR::setSEXP( x ) ;
+        VECTOR::set_sexp( x ) ;
         nrows = other.nrows ;
         return *this ;
     }

Modified: pkg/Rcpp/inst/include/Rcpp/api/meat/Vector.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/api/meat/Vector.h	2012-12-21 12:27:00 UTC (rev 4170)
+++ pkg/Rcpp/inst/include/Rcpp/api/meat/Vector.h	2012-12-22 09:27:29 UTC (rev 4171)
@@ -25,38 +25,40 @@
 namespace Rcpp{ 
 
     template <int RTYPE>
-    Vector<RTYPE>::Vector() : RObject() {
-        RCPP_DEBUG( "Vector()" ) ;
-        RObject::setSEXP( Rf_allocVector( RTYPE, 0 ) ) ;
+    Vector<RTYPE>::Vector() : RObject( Rf_allocVector( RTYPE, 0 ) ) {
+        RCPP_DEBUG( "Vector()" )
+        update_vector() ;
         init() ;
     }
     
     template <int RTYPE>
     Vector<RTYPE>::~Vector(){
-         RCPP_DEBUG( "~Vector()" )   
+         RCPP_DEBUG_1( "~Vector(<%p>)", m_sexp )   
     }
     
     template <int RTYPE>
-    Vector<RTYPE>::Vector( const Vector& other) : RObject(){
-         RObject::setSEXP( other.asSexp() ) ;   
+    Vector<RTYPE>::Vector( const Vector& other) : RObject(other.asSexp()){
+        RCPP_DEBUG_2( "Vector<%d>( const Vector& other ), SEXP= <%p>", RTYPE, m_sexp )
+        update_vector() ;
     }
     
     template <int RTYPE>
     Vector<RTYPE>& Vector<RTYPE>::operator=(const Vector& other){
-        RObject::setSEXP( other.asSexp() ) ;
+        set_sexp( other.asSexp() ) ;
         return *this ;    
     }
     
     template <int RTYPE>
-    Vector<RTYPE>::Vector( const int& size ) : RObject()  {
-    	RCPP_DEBUG_2( "Vector<%d>( int = %d )", RTYPE, size ) ;
-    	RObject::setSEXP( Rf_allocVector( RTYPE, size) ) ;
-        init() ;
+    Vector<RTYPE>::Vector( const int& size ) : RObject( Rf_allocVector( RTYPE, size) )  {
+    	RCPP_DEBUG_3( "Vector<%d>( int = %d )   m_sexp = <%p> ", RTYPE, size, m_sexp )
+    	update_vector(); 
+    	init() ;
     }
     
     template <int RTYPE>
-    Vector<RTYPE>::Vector( const Dimension& dims ) : RObject(){
-        RObject::setSEXP( Rf_allocVector( RTYPE, dims.prod() ) ) ;
+    Vector<RTYPE>::Vector( const Dimension& dims ) : RObject( Rf_allocVector( RTYPE, dims.prod() ) ){
+        RCPP_DEBUG_3( "Vector<%d>( const Dimension& (%d) )   m_sexp = <%p>", RTYPE, dims.size(), m_sexp )
+        update_vector();
         init() ;
         if( dims.size() > 1 ){
             RObject::attr( "dim" ) = dims;
@@ -65,8 +67,9 @@
     
     template <int RTYPE>
     template <typename U>
-    Vector<RTYPE>::Vector( const Dimension& dims, const U& u) : RObject() {
-    	RObject::setSEXP( Rf_allocVector( RTYPE, dims.prod() ) ) ;
+    Vector<RTYPE>::Vector( const Dimension& dims, const U& u) : RObject( Rf_allocVector( RTYPE, dims.prod() ) ) {
+        RCPP_DEBUG_2( "Vector<%d>( const Dimension& (%d), const U& )", RTYPE, dims.size() )
+        update_vector(); 
         fill(u) ;
         if( dims.size() > 1 ){
             RObject::attr( "dim" ) = dims;
@@ -75,75 +78,84 @@
     
     template <int RTYPE>
     template <typename U>
-    Vector<RTYPE>::Vector( const int& size, const U& u){
-    	RObject::setSEXP( Rf_allocVector( RTYPE, size) ) ;
+    Vector<RTYPE>::Vector( const int& size, const U& u): RObject( Rf_allocVector( RTYPE, size) ) {
+        RCPP_DEBUG_2( "Vector<%d>( const int& size, const U& u )", RTYPE, size )
+        update_vector() ;
         fill_or_generate( u ) ;	
     }
     
     template <int RTYPE>
     template <typename U1>
-    Vector<RTYPE>::Vector( const int& siz, stored_type (*gen)(U1), const U1& u1){
-    	RObject::setSEXP( Rf_allocVector( RTYPE, siz) ) ;
+    Vector<RTYPE>::Vector( const int& siz, stored_type (*gen)(U1), const U1& u1) : RObject( Rf_allocVector( RTYPE, siz) ) {
+        update_vector();
+        RCPP_DEBUG_2( "const int& siz, stored_type (*gen)(U1), const U1& u1 )", RTYPE, siz )
         iterator first = begin(), last = end() ;
-    	while( first != last ) *first++ = gen(u1) ;
+        while( first != last ) *first++ = gen(u1) ;
     }
     
     template <int RTYPE>
     template <typename U1, typename U2>
-    Vector<RTYPE>::Vector( const int& siz, stored_type (*gen)(U1,U2), const U1& u1, const U2& u2){
-    	RObject::setSEXP( Rf_allocVector( RTYPE, siz) ) ;
+    Vector<RTYPE>::Vector( const int& siz, stored_type (*gen)(U1,U2), const U1& u1, const U2& u2) : RObject(Rf_allocVector( RTYPE, siz)){
+        update_vector();
+        RCPP_DEBUG_2( "const int& siz, stored_type (*gen)(U1,U2), const U1& u1, const U2& u2)", RTYPE, siz )
         iterator first = begin(), last = end() ;
-    	while( first != last ) *first++ = gen(u1,u2) ;
+        while( first != last ) *first++ = gen(u1,u2) ;
     }
 
     template <int RTYPE>
     template <typename U1, typename U2, typename U3>
-    Vector<RTYPE>::Vector( const int& siz, stored_type (*gen)(U1,U2,U3), const U1& u1, const U2& u2, const U3& u3){
-    	RObject::setSEXP( Rf_allocVector( RTYPE, siz) ) ;
+    Vector<RTYPE>::Vector( const int& siz, stored_type (*gen)(U1,U2,U3), const U1& u1, const U2& u2, const U3& u3): RObject(  Rf_allocVector( RTYPE, siz) ){
+        update_vector() ;
+        RCPP_DEBUG_2( "const int& siz, stored_type (*gen)(U1,U2,U3), const U1& u1, const U2& u2, const U3& u3)", RTYPE, siz )
         iterator first = begin(), last = end() ;
-    	while( first != last ) *first++ = gen(u1,u2,u3) ;
+        while( first != last ) *first++ = gen(u1,u2,u3) ;
     }
 
     template <int RTYPE>
     template <typename InputIterator>
-    Vector<RTYPE>::Vector( InputIterator first, InputIterator last) : RObject( ){
-        int n = std::distance(first, last) ;
-        RObject::setSEXP( Rf_allocVector(RTYPE, n) ) ;
+    Vector<RTYPE>::Vector( InputIterator first, InputIterator last) : RObject( Rf_allocVector(RTYPE, std::distance(first, last) ) ){
+        RCPP_DEBUG_1( "Vector<%d>( InputIterator first, InputIterator last", RTYPE )
+        update_vector();
         std::copy( first, last, begin() ) ; 
     }
 
     template <int RTYPE>
     template <typename InputIterator>
-    Vector<RTYPE>::Vector( InputIterator first, InputIterator last, int n) : RObject( ){
-        RObject::setSEXP( Rf_allocVector(RTYPE, n) ) ;
+    Vector<RTYPE>::Vector( InputIterator first, InputIterator last, int n) : RObject( Rf_allocVector(RTYPE, n) ){
+        update_vector() ;
+        RCPP_DEBUG_2( "Vector<%d>( InputIterator first, InputIterator last, int n = %d)", RTYPE, n )
         std::copy( first, last, begin() ) ; 
     }
 
     template <int RTYPE>
     template <typename InputIterator, typename Func>
-    Vector<RTYPE>::Vector( InputIterator first, InputIterator last, Func func) : RObject( ){
-        RObject::setSEXP( Rf_allocVector( RTYPE, std::distance(first,last) ) ) ;
+    Vector<RTYPE>::Vector( InputIterator first, InputIterator last, Func func) : RObject( Rf_allocVector( RTYPE, std::distance(first,last) ) ){
+        update_vector() ;
+        RCPP_DEBUG_1( "Vector<%d>( InputIterator, InputIterator, Func )", RTYPE )
         std::transform( first, last, begin(), func) ;
     }
     
     template <int RTYPE>
     template <typename InputIterator, typename Func>
-    Vector<RTYPE>::Vector( InputIterator first, InputIterator last, Func func, int n) : RObject(  ){
-        RObject::setSEXP( Rf_allocVector( RTYPE, n ) ) ;
+    Vector<RTYPE>::Vector( InputIterator first, InputIterator last, Func func, int n) : RObject( Rf_allocVector( RTYPE, n ) ){
+        update_vector();
+        RCPP_DEBUG_2( "Vector<%d>( InputIterator, InputIterator, Func, int n = %d )", RTYPE, n )
         std::transform( first, last, begin(), func) ;
     }
-
+          
     
     template <int RTYPE>
     template <bool NA, typename VEC>
     Vector<RTYPE>::Vector( const VectorBase<RTYPE,NA,VEC>& other ) : RObject() {
-    	import_sugar_expression( other, typename traits::same_type<Vector,VEC>::type() ) ;
+        RCPP_DEBUG_2( "Vector<%d>( const VectorBase<RTYPE,NA,VEC>& ) [VEC = %s]", RTYPE, DEMANGLE(VEC) )
+        import_sugar_expression( other, typename traits::same_type<Vector,VEC>::type() ) ;
     }
     
     template <>
     template <bool NA, typename T>
-    Vector<LGLSXP>::Vector( const sugar::SingleLogicalResult<NA,T>& obj ) : RObject() {
-    	RObject::setSEXP( const_cast<sugar::SingleLogicalResult<NA,T>&>( obj ) .get_sexp() ) ;
+    Vector<LGLSXP>::Vector( const sugar::SingleLogicalResult<NA,T>& obj ) : RObject(const_cast<sugar::SingleLogicalResult<NA,T>&>( obj ).get_sexp() ) {
+        update_vector() ;
+        RCPP_DEBUG_2( "Vector<%d>( const sugar::SingleLogicalResult<NA,T>& ) [T = %s]", LGLSXP, DEMANGLE(T) )
     }
     
     
@@ -163,7 +175,7 @@
             import_expression<T>(x, n ) ;
         } else{
             // different size, so we change the memory
-            RObject::setSEXP( r_cast<RTYPE>( wrap(x) ) ); 
+            set_sexp( r_cast<RTYPE>( wrap(x) ) ); 
         }
     }
     
@@ -179,7 +191,7 @@
     template <typename T>
     inline void Vector<RTYPE>::assign_object( const T& x, traits::false_type ){
         // TODO: maybe we already have the memory to host the results
-        RObject::setSEXP( r_cast<RTYPE>( wrap(x) ) ) ;
+        set_sexp( r_cast<RTYPE>( wrap(x) ) ) ;
     }
     
     template <int RTYPE>
@@ -187,7 +199,7 @@
     inline void Vector<RTYPE>::import_sugar_expression( const Rcpp::VectorBase<RTYPE,NA,VEC>& other, traits::false_type ){
         RCPP_DEBUG_4( "Vector<%d>::import_sugar_expression( VectorBase<%d,%d,%s>, false_type )", RTYPE, NA, RTYPE, DEMANGLE(VEC) ) ;
     	int n = other.size() ;
-    	RObject::setSEXP( Rf_allocVector( RTYPE, n ) ) ;
+    	set_sexp( Rf_allocVector( RTYPE, n ) ) ;
     	import_expression<VEC>( other.get_ref() , n ) ;
     }   
     
@@ -195,7 +207,7 @@
     template <bool NA, typename VEC>
     inline void Vector<RTYPE>::import_sugar_expression( const Rcpp::VectorBase<RTYPE,NA,VEC>& other, traits::true_type ){
         RCPP_DEBUG_4( "Vector<%d>::import_sugar_expression( VectorBase<%d,%d,%s>, true_type )", RTYPE, NA, RTYPE, DEMANGLE(VEC) ) ;
-    	RObject::setSEXP( other.get_ref() ) ;
+    	set_sexp( other.get_ref() ) ;
     }   
 
     template <int RTYPE>

Modified: pkg/Rcpp/inst/include/Rcpp/config.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/config.h	2012-12-21 12:27:00 UTC (rev 4170)
+++ pkg/Rcpp/inst/include/Rcpp/config.h	2012-12-22 09:27:29 UTC (rev 4171)
@@ -25,7 +25,7 @@
 #define Rcpp_Version(v,p,s) (((v) * 65536) + ((p) * 256) + (s))
 
 // All three digits have to be integers for g++-4.7 or later
-#define RCPP_VERSION Rcpp_Version(0,10,2)
+#define RCPP_VERSION Rcpp_Version(0,10,3)
                                                                                                                 
 #endif
 

Modified: pkg/Rcpp/inst/include/Rcpp/generated/Language__ctors.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/generated/Language__ctors.h	2012-12-21 12:27:00 UTC (rev 4170)
+++ pkg/Rcpp/inst/include/Rcpp/generated/Language__ctors.h	2012-12-22 09:27:29 UTC (rev 4171)
@@ -2,7 +2,7 @@
 //
 // Language__ctors.h: Rcpp R/C++ interface class library -- generated helper code for Language.h
 //
-// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois
+// Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois
 //
 // This file is part of Rcpp.
 //
@@ -26,213 +26,213 @@
 
 template <TYPENAMES> 
 Language( const std::string& symbol, ARGUMENTS) : DottedPair(Rf_install(symbol.c_str()), PARAMETERS) { 
-	update() ;
+	update_language_object() ;
 } 
 	
 template <TYPENAMES> 
 Language( const Function& function, ARGUMENTS) : DottedPair(function, PARAMETERS) { 
-	update() ;
+	update_language_object() ;
 } 
 			
 */
 template <typename T1> 
 Language( const std::string& symbol, const T1& t1) : DottedPair(Rf_install(symbol.c_str()), t1) { 
-	update() ;
+	update_language_object() ;
 } 
 	
 template <typename T1> 
 Language( const Function& function, const T1& t1) : DottedPair(function, t1) { 
-	update() ;
+	update_language_object() ;
 } 
 			
 template <typename T1, typename T2> 
 Language( const std::string& symbol, const T1& t1, const T2& t2) : DottedPair(Rf_install(symbol.c_str()), t1, t2) { 
-	update() ;
+	update_language_object() ;
 } 
 	
 template <typename T1, typename T2> 
 Language( const Function& function, const T1& t1, const T2& t2) : DottedPair(function, t1, t2) { 
-	update() ;
+	update_language_object() ;
 } 
 			
 template <typename T1, typename T2, typename T3> 
 Language( const std::string& symbol, const T1& t1, const T2& t2, const T3& t3) : DottedPair(Rf_install(symbol.c_str()), t1, t2, t3) { 
-	update() ;
+	update_language_object() ;
 } 
 	
 template <typename T1, typename T2, typename T3> 
 Language( const Function& function, const T1& t1, const T2& t2, const T3& t3) : DottedPair(function, t1, t2, t3) { 
-	update() ;
+	update_language_object() ;
 } 
 			
 template <typename T1, typename T2, typename T3, typename T4> 
 Language( const std::string& symbol, const T1& t1, const T2& t2, const T3& t3, const T4& t4) : DottedPair(Rf_install(symbol.c_str()), t1, t2, t3, t4) { 
-	update() ;
+	update_language_object() ;
 } 
 	
 template <typename T1, typename T2, typename T3, typename T4> 
 Language( const Function& function, const T1& t1, const T2& t2, const T3& t3, const T4& t4) : DottedPair(function, t1, t2, t3, t4) { 
-	update() ;
+	update_language_object() ;
 } 
 			
 template <typename T1, typename T2, typename T3, typename T4, typename T5> 
 Language( const std::string& symbol, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5) : DottedPair(Rf_install(symbol.c_str()), t1, t2, t3, t4, t5) { 
-	update() ;
+	update_language_object() ;
 } 
 	
 template <typename T1, typename T2, typename T3, typename T4, typename T5> 
 Language( const Function& function, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5) : DottedPair(function, t1, t2, t3, t4, t5) { 
-	update() ;
+	update_language_object() ;
 } 
 			
 template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> 
 Language( const std::string& symbol, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6) : DottedPair(Rf_install(symbol.c_str()), t1, t2, t3, t4, t5, t6) { 
-	update() ;
+	update_language_object() ;
 } 
 	
 template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> 
 Language( const Function& function, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6) : DottedPair(function, t1, t2, t3, t4, t5, t6) { 
-	update() ;
+	update_language_object() ;
 } 
 			
 template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> 
 Language( const std::string& symbol, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7) : DottedPair(Rf_install(symbol.c_str()), t1, t2, t3, t4, t5, t6, t7) { 
-	update() ;
+	update_language_object() ;
 } 
 	
 template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> 
 Language( const Function& function, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7) : DottedPair(function, t1, t2, t3, t4, t5, t6, t7) { 
-	update() ;
+	update_language_object() ;
 } 
 			
 template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> 
 Language( const std::string& symbol, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8) : DottedPair(Rf_install(symbol.c_str()), t1, t2, t3, t4, t5, t6, t7, t8) { 
-	update() ;
+	update_language_object() ;
 } 
 	
 template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> 
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/rcpp -r 4171


More information about the Rcpp-commits mailing list