[Rcpp-commits] r514 - in pkg: inst/unitTests src src/Rcpp/internal
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Jan 30 14:04:26 CET 2010
Author: romain
Date: 2010-01-30 14:04:26 +0100 (Sat, 30 Jan 2010)
New Revision: 514
Removed:
pkg/inst/unitTests/runit.wrap.R
pkg/src/wrap.cpp
Modified:
pkg/src/CharacterVector.cpp
pkg/src/Rcpp/internal/wrap.h
Log:
minor cleaning
Deleted: pkg/inst/unitTests/runit.wrap.R
===================================================================
--- pkg/inst/unitTests/runit.wrap.R 2010-01-30 11:37:54 UTC (rev 513)
+++ pkg/inst/unitTests/runit.wrap.R 2010-01-30 13:04:26 UTC (rev 514)
@@ -1,72 +0,0 @@
-#!/usr/bin/r -t
-#
-# Copyright (C) 2009 - 2010 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/>.
-
-.setUp <- function(){
- suppressMessages( require( inline ) )
-}
-
-if( Rcpp:::capabilities()[["initializer lists"]] ){
-
- # disabled for now
-
- # test.wrap.initializerlist.int <- function(){
- # funx <- cfunction(signature(), '
- # return Rcpp::wrap( {0,1,2} );
- # ', Rcpp=TRUE, verbose=FALSE,
- # cxxargs = "-std=c++0x")
- # checkEquals( funx(), 0:2,
- # msg = "wrap( initializer_list<int> )" )
- # }
- #
- # test.wrap.initializerlist.double <- function(){
- # funx <- cfunction(signature(), '
- # return Rcpp::wrap( {0.0,1.0,2.0} );
- # ', Rcpp=TRUE, verbose=FALSE,
- # cxxargs = "-std=c++0x")
- # checkEquals( funx(), as.numeric(0:2),
- # msg = "wrap( initializer_list<double> )" )
- # }
- #
- # test.wrap.initializerlist.bool <- function(){
- # funx <- cfunction(signature(), '
- # return Rcpp::wrap( {false, true, false} );
- # ', Rcpp=TRUE, verbose=FALSE,
- # cxxargs = "-std=c++0x")
- # checkEquals( funx(), c(FALSE, TRUE, FALSE),
- # msg = "wrap( initializer_list<bool> )" )
- # }
- #
- # test.wrap.initializerlist.Rbyte <- function(){
- # funx <- cfunction(signature(), '
- # return Rcpp::wrap( { (Rbyte)0, (Rbyte)1 } );
- # ', Rcpp=TRUE, verbose=FALSE,
- # cxxargs = "-std=c++0x")
- # checkEquals( funx(), as.raw(0:1),
- # msg = "wrap( initializer_list<Rbyte> )" )
- # }
-
- # test.wrap.initializerlist.RObject <- function(){
- # funx <- cfunction(signature(), '
- # return Rcpp::wrap( { Rcpp::wrap(1), Rcpp::wrap("foo"), Rcpp::wrap(1.0) } );
- # ', Rcpp=TRUE, verbose=FALSE)
- # checkEquals( funx(), list(1L, "foo", 1.0) ,
- # msg = "wrap( initializer_list<SEXP> )" )
- # }
-
-}
Modified: pkg/src/CharacterVector.cpp
===================================================================
--- pkg/src/CharacterVector.cpp 2010-01-30 11:37:54 UTC (rev 513)
+++ pkg/src/CharacterVector.cpp 2010-01-30 13:04:26 UTC (rev 514)
@@ -105,9 +105,4 @@
return StringProxy(*this, offset(i,j) ) ;
}
-SEXP wrap(const char* const v){ return Rf_mkString(v); }
-// template<> SEXP<const char*>( const char* object ){
-// return Rf_mkString(object) ;
-// }
-
} // namespace
Modified: pkg/src/Rcpp/internal/wrap.h
===================================================================
--- pkg/src/Rcpp/internal/wrap.h 2010-01-30 11:37:54 UTC (rev 513)
+++ pkg/src/Rcpp/internal/wrap.h 2010-01-30 13:04:26 UTC (rev 514)
@@ -240,14 +240,9 @@
} // internal
-/* partial specialization */
template <typename T> SEXP wrap(const T& object){
return internal::wrap_dispatch( object, typename internal::wrap_type_traits<T>::category() ) ;
- // SEXP x = object ; /* let implicit conversion work */
- // return x ;
}
-// template<> SEXP wrap<const char*>( const char* object ) ;
-
// {{{ // explicit instanciations (not needed)
// template SEXP wrap<int>(const int& object) ;
// template SEXP wrap<double>(const double& object) ;
@@ -272,18 +267,20 @@
// template SEXP wrap< std::deque<bool> >( const std::deque<bool>& object ) ;
// }}}
-#ifdef HAS_INIT_LISTS
-// template SEXP wrap< std::initializer_list<bool> >(const std::initializer_list<bool>& list) ;
-// template SEXP wrap< std::initializer_list<std::string> >(const std::initializer_list<std::string>& list ) ;
-// // template SEXP wrap< std::initializer_list<SEXP> >(const std::initializer_list<SEXP>& list ) ;
-// template SEXP wrap< std::initializer_list<Rbyte> >(const std::initializer_list<Rbyte>& list) ;
-// template SEXP wrap< std::initializer_list<double> >(const std::initializer_list<double>& list) ;
-// template SEXP wrap< std::initializer_list<int> >(const std::initializer_list<int>& list) ;
-#endif
+// special cases - FIXME : these are not template specializations of wrap<>
+inline SEXP wrap(const char* const v ){ return Rf_mkString(v) ; } ;
-// special case
-SEXP wrap(const char* const v );
+// wrap( { ... } ) : disabled for now
+// #ifdef HAS_INIT_LISTS
+// inline SEXP wrap(std::initializer_list<bool> v) { return internal::range_wrap( v.begin() , v.end() ); };
+// inline SEXP wrap(std::initializer_list<std::string> v ) { return internal::range_wrap( v.begin() , v.end() ); };
+// inline SEXP wrap(std::initializer_list<SEXP> v ) { return internal::range_wrap( v.begin() , v.end() ); };
+// inline SEXP wrap(std::initializer_list<Rbyte> v) { return internal::range_wrap( v.begin() , v.end() ); };
+// inline SEXP wrap(std::initializer_list<double> v) { return internal::range_wrap( v.begin() , v.end() ); } ;
+// inline SEXP wrap(std::initializer_list<int> v) { return internal::range_wrap( v.begin() , v.end() ); } ;
+// #endif
+
} // Rcpp
#endif
Deleted: pkg/src/wrap.cpp
===================================================================
--- pkg/src/wrap.cpp 2010-01-30 11:37:54 UTC (rev 513)
+++ pkg/src/wrap.cpp 2010-01-30 13:04:26 UTC (rev 514)
@@ -1,150 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
-//
-// wrap.cpp: Rcpp R/C++ interface class library -- general R object wrapper
-//
-// 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/>.
-
-#include <Rcpp.h>
-
-namespace Rcpp{
-
-// RObject wrap(SEXP m_sexp){
-// switch( TYPEOF(m_sexp) ){
-// case SYMSXP:
-// return Symbol(m_sexp) ;
-// case ENVSXP:
-// return Environment(m_sexp);
-// case LISTSXP:
-// case DOTSXP: /* maybe change this later */
-// return Pairlist(m_sexp);
-// case CLOSXP:
-// case SPECIALSXP: /* maybe change this later */
-// case BUILTINSXP: /* maybe change this later */
-// return Function(m_sexp);
-// case LANGSXP:
-// return Language(m_sexp);
-// case LGLSXP:
-// return LogicalVector(m_sexp);
-// case INTSXP:
-// return IntegerVector(m_sexp);
-// case REALSXP:
-// return NumericVector(m_sexp);
-// case CPLXSXP:
-// return ComplexVector(m_sexp);
-// case STRSXP:
-// return CharacterVector(m_sexp);
-// case VECSXP:
-// return List(m_sexp);
-// case EXPRSXP:
-// return ExpressionVector(m_sexp);
-// case WEAKREFSXP:
-// return WeakReference(m_sexp);
-// case RAWSXP:
-// return RawVector(m_sexp);
-// default:
-// break ;
-// }
-// /* for all other, just use RObject */
-// return RObject(m_sexp) ;
-// }
-
-// template<> SEXP wrap(const bool & v){
-// logTxt("RObject from bool\n");
-// LogicalVector o(Rf_ScalarLogical(v));
-// return o ;
-// }
-//
-// template<> SEXP wrap(const double & v){
-// logTxt("RObject from double\n");
-// NumericVector o(Rf_ScalarReal(v));
-// return o ;
-// }
-//
-// template<> SEXP wrap(const int & v){
-// logTxt("RObject from int\n");
-// IntegerVector o(Rf_ScalarInteger(v));
-// return o ;
-// }
-//
-// template<> SEXP wrap(const size_t & v){
-// logTxt("RObject from size_t\n");
-// IntegerVector o(Rf_ScalarInteger(static_cast<int>(v)));
-// return o ;
-// }
-//
-// template<> SEXP wrap(const Rbyte & v){
-// logTxt("RObject from raw\n");
-// RawVector o(Rf_ScalarRaw(v));
-// return o ;
-// }
-
-// template<> SEXP wrap(const std::vector<bool> & v){ return internal::range_wrap( v.begin(), v.end() ) ; }
-// template<> SEXP wrap(const std::vector<int> & v){ return internal::range_wrap( v.begin(), v.end() ) ; }
-// template<> SEXP wrap(const std::vector<double> & v){ return internal::range_wrap( v.begin(), v.end() ) ; }
-// template<> SEXP wrap(const std::vector<Rbyte> & v){ return internal::range_wrap( v.begin(), v.end() ) ; }
-// template<> SEXP wrap(const std::vector<std::string> & v){ return internal::range_wrap(v.begin(), v.end()); }
-
-/* sets */
-
-// template<> SEXP wrap(const std::set<int> & v){
-// logTxt("RObject from set<int>\n");
-// size_t n = v.size();
-// SEXP m_sexp = PROTECT( Rf_allocVector(INTSXP, n) );
-// copy( v.begin(), v.end(), INTEGER(m_sexp) ) ;
-// IntegerVector o(m_sexp) ;
-// UNPROTECT(1) ;
-// return o ;
-// }
-//
-// template<> SEXP wrap(const std::set<double> & v){
-// logTxt("RObject from set<double>\n");
-// size_t n = v.size();
-// SEXP m_sexp = PROTECT( Rf_allocVector(REALSXP, n) );
-// copy( v.begin(), v.end(), REAL(m_sexp) ) ;
-// NumericVector o(m_sexp) ;
-// UNPROTECT(1) ;
-// return o ;
-// }
-//
-// template<> SEXP wrap(const std::set<Rbyte> & v){
-// logTxt("RObject from set<Rbyte> \n");
-// size_t n = v.size();
-// SEXP m_sexp = PROTECT( Rf_allocVector(RAWSXP, n) );
-// copy( v.begin(), v.end(), RAW(m_sexp) ) ;
-// RawVector o(m_sexp) ;
-// UNPROTECT(1) ;
-// return o ;
-// }
-//
-// template<> SEXP wrap(const std::set<std::string> & v){
-// logTxt("RObject from set<string>\n");
-// size_t n = v.size();
-// SEXP m_sexp = PROTECT( Rf_allocVector(STRSXP, n) );
-// size_t i=0;
-// std::set<std::string>::iterator it = v.begin();
-// while( i<n ){
-// SET_STRING_ELT(m_sexp, i, Rf_mkChar(it->c_str()));
-// i++ ;
-// it++;
-// }
-// CharacterVector o(m_sexp) ;
-// UNPROTECT(1) ;
-// return o ;
-// }
-
-} // namespace Rcpp
More information about the Rcpp-commits
mailing list