[Rcpp-commits] r599 - in pkg: inst/doc src src/Rcpp

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Feb 6 15:48:36 CET 2010


Author: romain
Date: 2010-02-06 15:48:36 +0100 (Sat, 06 Feb 2010)
New Revision: 599

Removed:
   pkg/src/Rcpp/ComplexVector.h
   pkg/src/Rcpp/GenericVector.h
   pkg/src/Rcpp/IntegerVector.h
   pkg/src/Rcpp/LogicalVector.h
   pkg/src/Rcpp/NumericVector.h
   pkg/src/Rcpp/RawVector.h
Modified:
   pkg/inst/doc/Makefile
   pkg/src/CharacterVector.cpp
   pkg/src/Dimension.cpp
   pkg/src/DottedPair.cpp
   pkg/src/ExpressionVector.cpp
   pkg/src/Function.cpp
   pkg/src/Language.cpp
   pkg/src/Pairlist.cpp
   pkg/src/Promise.cpp
   pkg/src/Rcpp.h
   pkg/src/Rcpp/CharacterVector.h
   pkg/src/Rcpp/Dimension.h
   pkg/src/Rcpp/DottedPair.h
   pkg/src/Rcpp/ExpressionVector.h
   pkg/src/Rcpp/Function.h
   pkg/src/Rcpp/Language.h
   pkg/src/Rcpp/Pairlist.h
   pkg/src/Rcpp/Promise.h
   pkg/src/Rcpp/SEXP_Vector.h
   pkg/src/Rcpp/SimpleVector.h
   pkg/src/Rcpp/Symbol.h
   pkg/src/Rcpp/WeakReference.h
   pkg/src/Rcpp/XPtr.h
   pkg/src/Symbol.cpp
   pkg/src/WeakReference.cpp
Log:
add copy constructors and assignement operators so that the compiler does not generate wrong defaults implicitely

Modified: pkg/inst/doc/Makefile
===================================================================
--- pkg/inst/doc/Makefile	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/inst/doc/Makefile	2010-02-06 14:48:36 UTC (rev 599)
@@ -17,3 +17,9 @@
 	Rscript -e "tools::texi2dvi( 'Rcpp-unitTests.tex', pdf = TRUE, clean = TRUE )"
 	rm -fr Rcpp-unitTests.tex
 
+Rcpp-api.pdf: Rcpp-api.Rnw
+	R CMD Sweave Rcpp-api.Rnw
+	Rscript -e "tools::texi2dvi( 'Rcpp-api.tex', pdf = TRUE, clean = TRUE ) "
+	rm -fr Rcpp-api.tex
+
+

Modified: pkg/src/CharacterVector.cpp
===================================================================
--- pkg/src/CharacterVector.cpp	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/CharacterVector.cpp	2010-02-06 14:48:36 UTC (rev 599)
@@ -24,7 +24,16 @@
 namespace Rcpp{
 
 CharacterVector::CharacterVector() : VectorBase(){}
-	
+
+CharacterVector::CharacterVector(const CharacterVector& other) : VectorBase(){
+	setSEXP( other.asSexp() ); 
+}
+
+CharacterVector& CharacterVector::operator=(const CharacterVector& other ){
+	setSEXP( other.asSexp() ) ;
+	return *this ;
+}
+
 CharacterVector::CharacterVector(SEXP x) throw(not_compatible) : VectorBase() {
 	SEXP y = r_cast<STRSXP>( x) ;
 	setSEXP( y ) ;

Modified: pkg/src/Dimension.cpp
===================================================================
--- pkg/src/Dimension.cpp	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Dimension.cpp	2010-02-06 14:48:36 UTC (rev 599)
@@ -29,6 +29,15 @@
 		dims = as< std::vector<int> >(x) ;
 	}
 	
+	Dimension::Dimension( const Dimension& other ) : dims(){
+		dims = other.dims ; /* copy */
+	}
+	
+	Dimension& Dimension::operator=(const Dimension& other){
+		dims = other.dims ; /* copy */
+		return *this ;
+	}
+	
 	Dimension::Dimension(const size_t& n1) : dims(1){
 		dims[0] = n1 ;
 	}

Modified: pkg/src/DottedPair.cpp
===================================================================
--- pkg/src/DottedPair.cpp	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/DottedPair.cpp	2010-02-06 14:48:36 UTC (rev 599)
@@ -26,6 +26,11 @@
 	DottedPair::~DottedPair(){}
 	DottedPair::DottedPair() : RObject(){}
 	
+	DottedPair& DottedPair::operator=(const DottedPair& other){
+		setSEXP( other.asSexp() ) ;
+		return *this ;
+	}
+	
 	void DottedPair::remove( const size_t& index ) throw(index_out_of_bounds) {
 		if( static_cast<R_len_t>(index) >= Rf_length(m_sexp) ) throw index_out_of_bounds() ;
 		if( index == 0 ){

Modified: pkg/src/ExpressionVector.cpp
===================================================================
--- pkg/src/ExpressionVector.cpp	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/ExpressionVector.cpp	2010-02-06 14:48:36 UTC (rev 599)
@@ -44,13 +44,22 @@
 			throw parse_error() ;
 		}
 	}
+        
+	ExpressionVector::ExpressionVector( const ExpressionVector& other ) : ExpressionVector_Base() {
+		setSEXP( other.asSexp() ) ;
+	}
+	
+	ExpressionVector& ExpressionVector::operator=( const ExpressionVector& other){
+		setSEXP( other.asSexp() ) ;
+		return *this ;
+	}
+	
+	SEXP ExpressionVector::eval() throw(Evaluator::eval_error){
+		return Evaluator::run( Rf_lcons( Rf_install( "eval" ) , Rf_cons( m_sexp, R_NilValue) )) ;
+	}
+	
+	SEXP ExpressionVector::eval(const Environment& env) throw(Evaluator::eval_error){
+		return Evaluator::run( Rf_lcons( Rf_install( "eval" ) , Rf_cons( m_sexp, Rf_cons(env.asSexp(), R_NilValue)) ) ) ;
+	}
 
-SEXP ExpressionVector::eval() throw(Evaluator::eval_error){
-	return Evaluator::run( Rf_lcons( Rf_install( "eval" ) , Rf_cons( m_sexp, R_NilValue) )) ;
-}
-
-SEXP ExpressionVector::eval(const Environment& env) throw(Evaluator::eval_error){
-	return Evaluator::run( Rf_lcons( Rf_install( "eval" ) , Rf_cons( m_sexp, Rf_cons(env.asSexp(), R_NilValue)) ) ) ;
-}
-
 } // namespace 

Modified: pkg/src/Function.cpp
===================================================================
--- pkg/src/Function.cpp	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Function.cpp	2010-02-06 14:48:36 UTC (rev 599)
@@ -48,6 +48,15 @@
 		UNPROTECT(1) ;
 	}
 	
+	Function::Function(const Function& other) : RObject(){
+		setSEXP( other.asSexp() );
+	}
+	
+	Function& Function::operator=(const Function& other){
+		setSEXP( other.asSexp() );
+		return *this ;
+	}
+	
 	Function::~Function(){}	
 	
 	SEXP Function::environment() const throw(not_a_closure){

Modified: pkg/src/Language.cpp
===================================================================
--- pkg/src/Language.cpp	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Language.cpp	2010-02-06 14:48:36 UTC (rev 599)
@@ -29,6 +29,15 @@
 		setSEXP( r_cast<LANGSXP>(x) ) ;
 	};
 	
+	Language::Language( const Language& other): DottedPair(){
+		setSEXP( other.asSexp() ) ;
+	}
+	
+	Language& Language::operator=(const Language& other){
+		setSEXP( other.asSexp() ) ;
+		return *this ;
+	}
+	
 	Language::Language( const std::string& symbol ): DottedPair() {
 		setSEXP( Rf_lcons( Symbol(symbol), R_NilValue ) );
 	}

Modified: pkg/src/Pairlist.cpp
===================================================================
--- pkg/src/Pairlist.cpp	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Pairlist.cpp	2010-02-06 14:48:36 UTC (rev 599)
@@ -28,6 +28,12 @@
 		setSEXP( r_cast<LISTSXP>(x) );
 	};
 	Pairlist::~Pairlist(){}
+	Pairlist::Pairlist( const Pairlist& other): DottedPair(){
+		setSEXP( other.asSexp() ) ;
+	}
+	Pairlist& Pairlist::operator=(const Pairlist& other){
+		setSEXP( other.asSexp() ) ;
+		return *this ;
+	}
 	
-	
 } // namespace Rcpp

Modified: pkg/src/Promise.cpp
===================================================================
--- pkg/src/Promise.cpp	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Promise.cpp	2010-02-06 14:48:36 UTC (rev 599)
@@ -35,6 +35,15 @@
 		}
 	}
 
+	Promise::Promise(const Promise& other) : RObject() {
+		setSEXP( other.asSexp() );
+	}
+	
+	Promise& Promise::operator=(const Promise& other){
+		setSEXP( other.asSexp() );
+		return *this ;
+	}
+	
 	int Promise::seen() const {
 		return PRSEEN(m_sexp);
 	}

Modified: pkg/src/Rcpp/CharacterVector.h
===================================================================
--- pkg/src/Rcpp/CharacterVector.h	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Rcpp/CharacterVector.h	2010-02-06 14:48:36 UTC (rev 599)
@@ -57,7 +57,9 @@
 	} ;
 
 	CharacterVector() ;
-	CharacterVector(SEXP x) throw(not_compatible);
+	CharacterVector( const CharacterVector& other ) ;
+	CharacterVector& operator=( const CharacterVector& other ) ;
+	CharacterVector( SEXP x) throw(not_compatible);
 	CharacterVector( const size_t& size) ;
 	CharacterVector( const std::string& x );
 	CharacterVector( const std::vector<std::string>& x );

Deleted: pkg/src/Rcpp/ComplexVector.h
===================================================================
--- pkg/src/Rcpp/ComplexVector.h	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Rcpp/ComplexVector.h	2010-02-06 14:48:36 UTC (rev 599)
@@ -1,34 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
-//
-// ComplexVector.h: Rcpp R/C++ interface class library -- complex vectors
-//
-// Copyright (C) 2010	Dirk Eddelbuettel and Romain Francois
-//
-// This file is part of Rcpp.
-//
-// Rcpp is free software: you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// Rcpp is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef Rcpp_ComplexVector_h
-#define Rcpp_ComplexVector_h
-
-#include <RcppCommon.h>
-#include <Rcpp/SimpleVector.h>
-
-namespace Rcpp{ 
-
-typedef SimpleVector<CPLXSXP> ComplexVector ;	
-
-} // namespace
-
-#endif

Modified: pkg/src/Rcpp/Dimension.h
===================================================================
--- pkg/src/Rcpp/Dimension.h	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Rcpp/Dimension.h	2010-02-06 14:48:36 UTC (rev 599)
@@ -30,6 +30,8 @@
 public:
 	Dimension() ;
 	Dimension(SEXP dims);
+	Dimension( const Dimension& other ) ;
+	Dimension& operator=( const Dimension& other ) ;
 	Dimension(const size_t& n1) ;
 	Dimension(const size_t& n1, const size_t& n2) ;
 	Dimension(const size_t& n1, const size_t& n2, const size_t& n3) ;

Modified: pkg/src/Rcpp/DottedPair.h
===================================================================
--- pkg/src/Rcpp/DottedPair.h	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Rcpp/DottedPair.h	2010-02-06 14:48:36 UTC (rev 599)
@@ -35,6 +35,12 @@
 
 	DottedPair() ;
 	
+	DottedPair( const DottedPair& other) : RObject(){
+		setSEXP( other.asSexp() ) ;
+	}
+	
+	DottedPair& operator=( const DottedPair& other) ; 
+	
 #ifdef HAS_VARIADIC_TEMPLATES
 template<typename... Args> 
 	DottedPair( const Args&... args) : RObject() {

Modified: pkg/src/Rcpp/ExpressionVector.h
===================================================================
--- pkg/src/Rcpp/ExpressionVector.h	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Rcpp/ExpressionVector.h	2010-02-06 14:48:36 UTC (rev 599)
@@ -42,6 +42,8 @@
 	ExpressionVector(SEXP x) throw(not_compatible);
 	ExpressionVector(const size_t& size) ;
 	ExpressionVector(const std::string& code) throw(parse_error) ;
+	ExpressionVector(const ExpressionVector& other) ;
+	ExpressionVector& operator=(const ExpressionVector& other) ;
 	
 	SEXP eval() throw(Evaluator::eval_error) ;
 	SEXP eval(const Environment& env) throw(Evaluator::eval_error);

Modified: pkg/src/Rcpp/Function.h
===================================================================
--- pkg/src/Rcpp/Function.h	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Rcpp/Function.h	2010-02-06 14:48:36 UTC (rev 599)
@@ -71,6 +71,9 @@
 	 */
 	Function(const std::string& name) throw(no_such_function) ;
 	
+	Function(const Function& other) ;
+	Function& operator=(const Function& other );
+	
 	// /**
 	//  * Finds a function, searching from a specific environment
 	//  *

Deleted: pkg/src/Rcpp/GenericVector.h
===================================================================
--- pkg/src/Rcpp/GenericVector.h	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Rcpp/GenericVector.h	2010-02-06 14:48:36 UTC (rev 599)
@@ -1,35 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
-//
-// GenericVector.h: Rcpp R/C++ interface class library -- generic vectors (lists)
-//
-// Copyright (C) 2010	Dirk Eddelbuettel and Romain Francois
-//
-// This file is part of Rcpp.
-//
-// Rcpp is free software: you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// Rcpp is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef Rcpp_GenericVector_h
-#define Rcpp_GenericVector_h
-
-#include <RcppCommon.h>
-#include <Rcpp/SEXP_Vector.h>
-
-namespace Rcpp{ 
-
-typedef SEXP_Vector<VECSXP> GenericVector ;
-typedef GenericVector List ;
-
-} // namespace
-
-#endif

Deleted: pkg/src/Rcpp/IntegerVector.h
===================================================================
--- pkg/src/Rcpp/IntegerVector.h	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Rcpp/IntegerVector.h	2010-02-06 14:48:36 UTC (rev 599)
@@ -1,34 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
-//
-// IntegerVector.h: Rcpp R/C++ interface class library -- integer vectors
-//
-// Copyright (C) 2010	Dirk Eddelbuettel and Romain Francois
-//
-// This file is part of Rcpp.
-//
-// Rcpp is free software: you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// Rcpp is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef Rcpp_IntegerVector_h
-#define Rcpp_IntegerVector_h
-
-#include <RcppCommon.h>
-#include <Rcpp/SimpleVector.h>
-
-namespace Rcpp{ 
-
-typedef SimpleVector<INTSXP> IntegerVector ;
-
-} // namespace
-
-#endif

Modified: pkg/src/Rcpp/Language.h
===================================================================
--- pkg/src/Rcpp/Language.h	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Rcpp/Language.h	2010-02-06 14:48:36 UTC (rev 599)
@@ -49,6 +49,9 @@
 	 */
 	Language(SEXP lang) throw(not_compatible) ;
 
+	Language(const Language& other) ;
+	Language& operator=(const Language& other) ;
+	
 	/**
 	 * Creates a call using the given symbol as the function name
 	 *

Deleted: pkg/src/Rcpp/LogicalVector.h
===================================================================
--- pkg/src/Rcpp/LogicalVector.h	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Rcpp/LogicalVector.h	2010-02-06 14:48:36 UTC (rev 599)
@@ -1,34 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
-//
-// LogicalVector.h: Rcpp R/C++ interface class library -- logical vectors
-//
-// Copyright (C) 2010	Dirk Eddelbuettel and Romain Francois
-//
-// This file is part of Rcpp.
-//
-// Rcpp is free software: you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// Rcpp is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef Rcpp_LogicalVector_h
-#define Rcpp_LogicalVector_h
-
-#include <RcppCommon.h>
-#include <Rcpp/SimpleVector.h>
-
-namespace Rcpp{
-
-typedef SimpleVector<LGLSXP> LogicalVector ;
-
-} // namespace
-
-#endif

Deleted: pkg/src/Rcpp/NumericVector.h
===================================================================
--- pkg/src/Rcpp/NumericVector.h	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Rcpp/NumericVector.h	2010-02-06 14:48:36 UTC (rev 599)
@@ -1,34 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
-//
-// NumericVector.h: Rcpp R/C++ interface class library -- numeric vectors
-//
-// Copyright (C) 2010	Dirk Eddelbuettel and Romain Francois
-//
-// This file is part of Rcpp.
-//
-// Rcpp is free software: you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// Rcpp is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef Rcpp_NumericVector_h
-#define Rcpp_NumericVector_h
-
-#include <RcppCommon.h>
-#include <Rcpp/SimpleVector.h>
-
-namespace Rcpp{ 
-
-typedef SimpleVector<REALSXP> NumericVector ;
-
-} // namespace
-
-#endif

Modified: pkg/src/Rcpp/Pairlist.h
===================================================================
--- pkg/src/Rcpp/Pairlist.h	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Rcpp/Pairlist.h	2010-02-06 14:48:36 UTC (rev 599)
@@ -32,6 +32,8 @@
 public:		
 	Pairlist();
 	Pairlist(SEXP x) throw(not_compatible) ;
+	Pairlist(const Pairlist& other) ;
+	Pairlist& operator=(const Pairlist& other) ;
 		
 #ifdef HAS_VARIADIC_TEMPLATES
 template<typename... Args> 

Modified: pkg/src/Rcpp/Promise.h
===================================================================
--- pkg/src/Rcpp/Promise.h	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Rcpp/Promise.h	2010-02-06 14:48:36 UTC (rev 599)
@@ -41,6 +41,9 @@
 
 	Promise( SEXP x) throw(not_compatible) ;
 	
+	Promise( const Promise& other) ;
+	Promise& operator=(const Promise& other ) ;
+	
 	/** 
 	 * Return the result of the PRSEEN macro
 	 */

Deleted: pkg/src/Rcpp/RawVector.h
===================================================================
--- pkg/src/Rcpp/RawVector.h	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Rcpp/RawVector.h	2010-02-06 14:48:36 UTC (rev 599)
@@ -1,34 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
-//
-// RawVector.h: Rcpp R/C++ interface class library -- raw vectors
-//
-// Copyright (C) 2010	Dirk Eddelbuettel and Romain Francois
-//
-// This file is part of Rcpp.
-//
-// Rcpp is free software: you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// Rcpp is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef Rcpp_RawVector_h
-#define Rcpp_RawVector_h
-
-#include <RcppCommon.h>
-#include <Rcpp/SimpleVector.h>
-
-namespace Rcpp{ 
-
-typedef SimpleVector<RAWSXP> RawVector ;
-
-} // namespace
-
-#endif

Modified: pkg/src/Rcpp/SEXP_Vector.h
===================================================================
--- pkg/src/Rcpp/SEXP_Vector.h	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Rcpp/SEXP_Vector.h	2010-02-06 14:48:36 UTC (rev 599)
@@ -68,6 +68,13 @@
 
 	SEXP_Vector(): VectorBase(){}
 	
+	SEXP_Vector(const SEXP_Vector& other) : VectorBase(other.asSexp()) {} ;
+	
+	SEXP_Vector& operator=(const SEXP_Vector& other){
+		setSEXP( other.asSexp() ) ;
+		return *this ;
+	}
+	
 	SEXP_Vector(SEXP x) : VectorBase() {
 		SEXP y = r_cast<RTYPE>(x) ;
 		setSEXP( y );
@@ -125,7 +132,11 @@
 	}
 	
 } ;
-	
+
+typedef SEXP_Vector<VECSXP> GenericVector ;
+typedef GenericVector List ;
+
+
 } //namespace Rcpp
 
 #endif

Modified: pkg/src/Rcpp/SimpleVector.h
===================================================================
--- pkg/src/Rcpp/SimpleVector.h	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Rcpp/SimpleVector.h	2010-02-06 14:48:36 UTC (rev 599)
@@ -58,6 +58,15 @@
 		}
 	}
 	
+	SimpleVector( const SimpleVector& other) : VectorBase() {
+		setSEXP( other.asSexp() ) ;
+	}
+	
+	SimpleVector& operator=(const SimpleVector& other){
+		setSEXP( other.asSexp() ) ;
+		return *this ;
+	}
+	
 	template <typename InputIterator>
 	SimpleVector( InputIterator first, InputIterator last) : VectorBase(), start(){
 		assign( first, last ) ;
@@ -104,6 +113,12 @@
 	
 } ;
 
+typedef SimpleVector<CPLXSXP> ComplexVector ;
+typedef SimpleVector<INTSXP> IntegerVector ;
+typedef SimpleVector<LGLSXP> LogicalVector ;
+typedef SimpleVector<REALSXP> NumericVector ;
+typedef SimpleVector<RAWSXP> RawVector ;
+
 }// namespace Rcpp
 
 #endif

Modified: pkg/src/Rcpp/Symbol.h
===================================================================
--- pkg/src/Rcpp/Symbol.h	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Rcpp/Symbol.h	2010-02-06 14:48:36 UTC (rev 599)
@@ -43,6 +43,9 @@
      */
     Symbol(const std::string& symbol) ;
     
+    Symbol( const Symbol& other) ;
+    Symbol& operator=(const Symbol& other) ;
+    
     /**
      * Nothing specific
      */ 

Modified: pkg/src/Rcpp/WeakReference.h
===================================================================
--- pkg/src/Rcpp/WeakReference.h	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Rcpp/WeakReference.h	2010-02-06 14:48:36 UTC (rev 599)
@@ -39,6 +39,9 @@
 	 */
 	WeakReference( SEXP x) throw(not_compatible) ; 
 
+	WeakReference( const WeakReference& other) ;
+	WeakReference& operator=(const WeakReference& other) ;
+	
 	/* TODO: constructor that makes a new weak reference based
 		on key, value, finalizer (C and R) */
 	

Modified: pkg/src/Rcpp/XPtr.h
===================================================================
--- pkg/src/Rcpp/XPtr.h	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Rcpp/XPtr.h	2010-02-06 14:48:36 UTC (rev 599)
@@ -58,6 +58,13 @@
      */
     explicit XPtr(T* p, bool set_delete_finalizer) ;
 
+    XPtr( const XPtr& other ) : RObject( other.asSexp() ) {}
+    
+    XPtr& operator=(const XPtr& other){
+    	    setSEXP( other.asSexp() ) ;
+    	    return *this ;
+    }
+    
     /**
      * Returns a reference to the object wrapped. This allows this
      * object to look and feel like a dumb pointer to T

Modified: pkg/src/Rcpp.h
===================================================================
--- pkg/src/Rcpp.h	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Rcpp.h	2010-02-06 14:48:36 UTC (rev 599)
@@ -63,14 +63,8 @@
 #include <Rcpp/DottedPair.h>
 #include <Rcpp/Pairlist.h>
 #include <Rcpp/Function.h>
-#include <Rcpp/IntegerVector.h>
-#include <Rcpp/NumericVector.h>
-#include <Rcpp/RawVector.h>
-#include <Rcpp/LogicalVector.h>
-#include <Rcpp/GenericVector.h>
 #include <Rcpp/WeakReference.h>
 #include <Rcpp/CharacterVector.h>
 #include <Rcpp/ExpressionVector.h>
-#include <Rcpp/ComplexVector.h>
 
 #endif

Modified: pkg/src/Symbol.cpp
===================================================================
--- pkg/src/Symbol.cpp	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/Symbol.cpp	2010-02-06 14:48:36 UTC (rev 599)
@@ -45,10 +45,19 @@
 		} 
 	}
 	
-	Symbol::Symbol(const std::string& symbol){
+	Symbol::Symbol(const std::string& symbol): RObject(){
 		setSEXP( Rf_install(symbol.c_str()) );
 	}
 	
+	Symbol::Symbol( const Symbol& other) : RObject() {
+		setSEXP( other.asSexp() );
+	}
+	
+	Symbol& Symbol::operator=(const Symbol& other){
+		setSEXP( other.asSexp() );
+		return *this;
+	}
+	
 	Symbol::~Symbol(){}
 	
 } // namespace Rcpp

Modified: pkg/src/WeakReference.cpp
===================================================================
--- pkg/src/WeakReference.cpp	2010-02-06 14:21:33 UTC (rev 598)
+++ pkg/src/WeakReference.cpp	2010-02-06 14:48:36 UTC (rev 599)
@@ -39,5 +39,12 @@
 		return R_WeakRefValue(m_sexp);
 	}
 	
+	WeakReference::WeakReference( const WeakReference& other ) : RObject( other.asSexp() ){}
+	
+	WeakReference& WeakReference::operator=(const WeakReference& other){
+		setSEXP( other.asSexp() );
+		return *this;
+	}
+	
 }
 // namesapce



More information about the Rcpp-commits mailing list