[Rcpp-commits] r1560 - in pkg/Rcpp/inst/include: . Rcpp Rcpp/traits Rcpp/vector
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jun 17 11:25:43 CEST 2010
Author: romain
Date: 2010-06-17 11:25:43 +0200 (Thu, 17 Jun 2010)
New Revision: 1560
Added:
pkg/Rcpp/inst/include/Rcpp/traits/init_type.h
pkg/Rcpp/inst/include/Rcpp/vector/00_forward_Vector.h
pkg/Rcpp/inst/include/Rcpp/vector/00_forward_eval_methods.h
pkg/Rcpp/inst/include/Rcpp/vector/00_forward_proxy.h
pkg/Rcpp/inst/include/Rcpp/vector/get_iterator.h
Modified:
pkg/Rcpp/inst/include/Rcpp/Vector.h
pkg/Rcpp/inst/include/Rcpp/traits/is_trivial.h
pkg/Rcpp/inst/include/Rcpp/vector/Vector.h
pkg/Rcpp/inst/include/Rcpp/vector/VectorBase.h
pkg/Rcpp/inst/include/Rcpp/vector/converter.h
pkg/Rcpp/inst/include/Rcpp/vector/eval_methods.h
pkg/Rcpp/inst/include/Rcpp/vector/proxy.h
pkg/Rcpp/inst/include/Rcpp/vector/swap.h
pkg/Rcpp/inst/include/Rcpp/vector/traits.h
pkg/Rcpp/inst/include/RcppCommon.h
Log:
code reorg so that VectorBase has a useful interface for implementing sugar
Modified: pkg/Rcpp/inst/include/Rcpp/Vector.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/Vector.h 2010-06-17 08:22:44 UTC (rev 1559)
+++ pkg/Rcpp/inst/include/Rcpp/Vector.h 2010-06-17 09:25:43 UTC (rev 1560)
@@ -31,17 +31,24 @@
namespace Rcpp{
-template <int RTYPE> class Vector ;
+#include <Rcpp/vector/get_iterator.h>
+#include <Rcpp/vector/VectorBase.h>
+
+#include <Rcpp/vector/00_forward_Vector.h>
+#include <Rcpp/vector/00_forward_proxy.h>
+#include <Rcpp/vector/00_forward_eval_methods.h>
+
+#include <Rcpp/vector/converter.h>
+
template <int RTYPE> class MatrixRow ;
template <int RTYPE> class MatrixColumn ;
+#include <Rcpp/vector/Vector.h>
+
#include <Rcpp/vector/proxy.h>
-#include <Rcpp/vector/converter.h>
#include <Rcpp/vector/eval_methods.h>
#include <Rcpp/vector/traits.h>
-#include <Rcpp/vector/VectorBase.h>
-#include <Rcpp/vector/Vector.h>
#include <Rcpp/vector/Matrix.h>
#include <Rcpp/vector/MatrixRow.h>
#include <Rcpp/vector/MatrixColumn.h>
@@ -49,8 +56,9 @@
#include <Rcpp/vector/instantiation.h>
#include <Rcpp/vector/string_proxy.h>
-#include <Rcpp/vector/swap.h>
} // Rcpp
+#include <Rcpp/vector/swap.h>
+
#endif
Added: pkg/Rcpp/inst/include/Rcpp/traits/init_type.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/traits/init_type.h (rev 0)
+++ pkg/Rcpp/inst/include/Rcpp/traits/init_type.h 2010-06-17 09:25:43 UTC (rev 1560)
@@ -0,0 +1,41 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+//
+// init_type.h: Rcpp R/C++ interface class library -- support traits for vector
+//
+// 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__traits__init_type_h
+#define Rcpp__traits__init_type_h
+
+namespace Rcpp {
+namespace traits {
+
+ template<int RTYPE> struct init_type {
+ typedef typename storage_type<RTYPE>::type type ;
+ } ;
+ template<> struct init_type<STRSXP>{
+ typedef const char* type ;
+ } ;
+ template<> struct init_type<LGLSXP>{
+ typedef bool type ;
+ } ;
+
+}
+}
+
+#endif
Modified: pkg/Rcpp/inst/include/Rcpp/traits/is_trivial.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/traits/is_trivial.h 2010-06-17 08:22:44 UTC (rev 1559)
+++ pkg/Rcpp/inst/include/Rcpp/traits/is_trivial.h 2010-06-17 09:25:43 UTC (rev 1560)
@@ -30,6 +30,6 @@
template <> struct is_trivial<EXPRSXP> : public false_type{} ;
} // traits
-}Ê// Rcpp
-
+} // Rcpp
+
#endif
Added: pkg/Rcpp/inst/include/Rcpp/vector/00_forward_Vector.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/00_forward_Vector.h (rev 0)
+++ pkg/Rcpp/inst/include/Rcpp/vector/00_forward_Vector.h 2010-06-17 09:25:43 UTC (rev 1560)
@@ -0,0 +1,30 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+//
+// 00_forward_Vector.h: Rcpp R/C++ interface class library --
+//
+// 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__vector__forward_Vector_h
+#define Rcpp__vector__forward_Vector_h
+
+template <int RTYPE> class Vector ;
+namespace traits {
+ template <int RTYPE> struct get_iterator< Rcpp::Vector<RTYPE> > ;
+}
+
+#endif
Added: pkg/Rcpp/inst/include/Rcpp/vector/00_forward_eval_methods.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/00_forward_eval_methods.h (rev 0)
+++ pkg/Rcpp/inst/include/Rcpp/vector/00_forward_eval_methods.h 2010-06-17 09:25:43 UTC (rev 1560)
@@ -0,0 +1,57 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+//
+// eval_methods.h: Rcpp R/C++ interface class library --
+//
+// 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__vector__forward_eval_methods_h
+#define Rcpp__vector__forward_eval_methods_h
+
+namespace internal{
+ template <int RTYPE>
+ SEXP vector_from_string( const std::string& st ) throw(parse_error,not_compatible) {
+ return r_cast<RTYPE>( Rf_mkString( st.c_str() ) ) ;
+ }
+
+ template <int RTYPE>
+ SEXP vector_from_string_expr( const std::string& code) throw(parse_error,not_compatible) {
+ ParseStatus status;
+ SEXP expr = PROTECT( ::Rf_mkString( code.c_str() ) );
+ SEXP res = PROTECT( ::R_ParseVector(expr, -1, &status, R_NilValue));
+ switch( status ){
+ case PARSE_OK:
+ UNPROTECT( 2) ;
+ return(res) ;
+ break;
+ default:
+ UNPROTECT(2) ;
+ throw parse_error() ;
+ }
+ return R_NilValue ; /* -Wall */
+ }
+
+ template <>
+ inline SEXP vector_from_string<EXPRSXP>( const std::string& st ) throw(parse_error,not_compatible) {
+ return vector_from_string_expr<EXPRSXP>( st ) ;
+ }
+
+ template <int RTYPE> class eval_methods {} ;
+ template <> class eval_methods<EXPRSXP> ;
+
+}
+#endif
Added: pkg/Rcpp/inst/include/Rcpp/vector/00_forward_proxy.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/00_forward_proxy.h (rev 0)
+++ pkg/Rcpp/inst/include/Rcpp/vector/00_forward_proxy.h 2010-06-17 09:25:43 UTC (rev 1560)
@@ -0,0 +1,42 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+//
+// proxy.h: Rcpp R/C++ interface class library -- proxies
+//
+// 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__vector__forward_proxy_h
+#define Rcpp__vector__forward_proxy_h
+
+namespace internal{
+ template <int RTYPE> class string_proxy ;
+ template <int RTYPE> class generic_proxy ;
+ template <int RTYPE> class simple_name_proxy ;
+ template <int RTYPE> class string_name_proxy ;
+ template <int RTYPE> class generic_name_proxy ;
+}
+
+namespace traits {
+
+ template <int RTYPE> struct r_vector_name_proxy ;
+ template <int RTYPE> struct r_vector_proxy ;
+ template <int RTYPE> struct r_vector_iterator ;
+ template <int RTYPE> class r_vector_cache ;
+}
+
+
+#endif
Modified: pkg/Rcpp/inst/include/Rcpp/vector/Vector.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/Vector.h 2010-06-17 08:22:44 UTC (rev 1559)
+++ pkg/Rcpp/inst/include/Rcpp/vector/Vector.h 2010-06-17 09:25:43 UTC (rev 1560)
@@ -24,9 +24,9 @@
template <int RTYPE>
class Vector :
- public RObject,
- public VectorBase< Vector<RTYPE> >,
- public internal::eval_methods< Vector<RTYPE> >
+ public RObject,
+ public VectorBase< RTYPE, true, Vector<RTYPE> >,
+ public internal::eval_methods<RTYPE>
{
public:
typedef typename traits::r_vector_proxy<RTYPE>::type Proxy ;
@@ -39,8 +39,6 @@
typedef MatrixRow<RTYPE> Row ;
typedef MatrixColumn<RTYPE> Column ;
- struct r_type : traits::integral_constant<int,RTYPE>{} ;
-
Vector() : RObject() {
RCPP_DEBUG( "Vector()", 0 ) ;
RObject::setSEXP( Rf_allocVector( RTYPE, 0 ) ) ;
Modified: pkg/Rcpp/inst/include/Rcpp/vector/VectorBase.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/VectorBase.h 2010-06-17 08:22:44 UTC (rev 1559)
+++ pkg/Rcpp/inst/include/Rcpp/vector/VectorBase.h 2010-06-17 09:25:43 UTC (rev 1560)
@@ -23,12 +23,23 @@
#define Rcpp__vector__VectorBase_h
/** a base class for vectors, modelled after the CRTP */
-template <typename VECTOR>
+template <int RTYPE, bool na, typename VECTOR>
class VectorBase {
public:
+ struct r_type : traits::integral_constant<int,RTYPE>{} ;
+ struct can_contain_na : traits::integral_constant<bool,na>{} ;
+
+ typedef typename traits::get_iterator<VECTOR>::type iterator ;
+ typedef typename traits::storage_type<RTYPE>::type stored_type ;
+
VECTOR& get_ref(){
return static_cast<VECTOR&>(*this) ;
}
+ inline iterator begin(){ return static_cast<VECTOR*>(this)->begin() ; }
+ inline iterator end(){ return static_cast<VECTOR*>(this)->end() ; }
+
+ inline stored_type operator[]( int i) const { return static_cast<VECTOR*>(this)->operator[](i) ; }
+
} ;
#endif
Modified: pkg/Rcpp/inst/include/Rcpp/vector/converter.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/converter.h 2010-06-17 08:22:44 UTC (rev 1559)
+++ pkg/Rcpp/inst/include/Rcpp/vector/converter.h 2010-06-17 09:25:43 UTC (rev 1560)
@@ -78,4 +78,19 @@
} ;
}
+namespace traits{
+ template <int RTYPE> struct r_vector_element_converter{
+ typedef typename ::Rcpp::internal::element_converter<RTYPE> type ;
+ } ;
+ template<> struct r_vector_element_converter<STRSXP>{
+ typedef ::Rcpp::internal::string_element_converter<STRSXP> type ;
+ } ;
+ template<> struct r_vector_element_converter<VECSXP>{
+ typedef ::Rcpp::internal::generic_element_converter<VECSXP> type ;
+ } ;
+ template<> struct r_vector_element_converter<EXPRSXP>{
+ typedef ::Rcpp::internal::generic_element_converter<EXPRSXP> type ;
+ } ;
+}
+
#endif
Modified: pkg/Rcpp/inst/include/Rcpp/vector/eval_methods.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/eval_methods.h 2010-06-17 08:22:44 UTC (rev 1559)
+++ pkg/Rcpp/inst/include/Rcpp/vector/eval_methods.h 2010-06-17 09:25:43 UTC (rev 1560)
@@ -23,37 +23,11 @@
#define Rcpp__vector__eval_methods_h
namespace internal{
- template <int RTYPE>
- SEXP vector_from_string( const std::string& st ) throw(parse_error,not_compatible) {
- return r_cast<RTYPE>( Rf_mkString( st.c_str() ) ) ;
- }
- template <int RTYPE>
- SEXP vector_from_string_expr( const std::string& code) throw(parse_error,not_compatible) {
- ParseStatus status;
- SEXP expr = PROTECT( ::Rf_mkString( code.c_str() ) );
- SEXP res = PROTECT( ::R_ParseVector(expr, -1, &status, R_NilValue));
- switch( status ){
- case PARSE_OK:
- UNPROTECT( 2) ;
- return(res) ;
- break;
- default:
- UNPROTECT(2) ;
- throw parse_error() ;
- }
- return R_NilValue ; /* -Wall */
- }
-
- template <>
- inline SEXP vector_from_string<EXPRSXP>( const std::string& st ) throw(parse_error,not_compatible) {
- return vector_from_string_expr<EXPRSXP>( st ) ;
- }
-
- template <typename VECTOR> class eval_methods {} ;
-
- template <typename VECTOR> class expr_eval_methods {
+ template <int RTYPE> class expr_eval_methods {
public:
+ typedef Rcpp::Vector<RTYPE> VECTOR ;
+
SEXP eval(){
SEXP xp = ( static_cast<VECTOR&>(*this) ).asSexp() ;
return try_catch( ::Rf_lcons( ::Rf_install( "eval" ) , ::Rf_cons( xp, R_NilValue) ) ) ;
@@ -64,8 +38,7 @@
} ;
} ;
- template<> class eval_methods< ::Rcpp::Vector<EXPRSXP> > :
- public expr_eval_methods< ::Rcpp::Vector<EXPRSXP> > {} ;
+ template<> class eval_methods<EXPRSXP> : public expr_eval_methods<EXPRSXP> {} ;
}
#endif
Added: pkg/Rcpp/inst/include/Rcpp/vector/get_iterator.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/get_iterator.h (rev 0)
+++ pkg/Rcpp/inst/include/Rcpp/vector/get_iterator.h 2010-06-17 09:25:43 UTC (rev 1560)
@@ -0,0 +1,34 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+//
+// get_iterator.h: Rcpp R/C++ interface class library --
+//
+// 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__vector__get_iterator_h
+#define Rcpp__vector__get_iterator_h
+
+namespace traits{
+
+ template <typename T>
+ struct get_iterator{
+ typedef typename T::iterator type ;
+ } ;
+
+} // internal
+
+#endif
Modified: pkg/Rcpp/inst/include/Rcpp/vector/proxy.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/proxy.h 2010-06-17 08:22:44 UTC (rev 1559)
+++ pkg/Rcpp/inst/include/Rcpp/vector/proxy.h 2010-06-17 09:25:43 UTC (rev 1560)
@@ -23,8 +23,6 @@
#define Rcpp__vector__proxy_h
namespace internal{
- template <int RTYPE> class string_proxy ;
- template <int RTYPE> class generic_proxy ;
template <int RTYPE> class simple_name_proxy {
public:
@@ -193,4 +191,54 @@
} ;
}
+namespace traits {
+
+ template <int RTYPE>
+ struct r_vector_name_proxy{
+ typedef typename ::Rcpp::internal::simple_name_proxy<RTYPE> type ;
+ } ;
+ template<> struct r_vector_name_proxy<STRSXP>{
+ typedef ::Rcpp::internal::string_name_proxy<STRSXP> type ;
+ } ;
+ template<> struct r_vector_name_proxy<VECSXP>{
+ typedef ::Rcpp::internal::generic_name_proxy<VECSXP> type ;
+ } ;
+ template<> struct r_vector_name_proxy<EXPRSXP>{
+ typedef ::Rcpp::internal::generic_name_proxy<EXPRSXP> type ;
+ } ;
+
+ template <int RTYPE>
+ struct r_vector_proxy{
+ typedef typename storage_type<RTYPE>::type& type ;
+ } ;
+ template<> struct r_vector_proxy<STRSXP> {
+ typedef ::Rcpp::internal::string_proxy<STRSXP> type ;
+ } ;
+ template<> struct r_vector_proxy<EXPRSXP> {
+ typedef ::Rcpp::internal::generic_proxy<EXPRSXP> type ;
+ } ;
+ template<> struct r_vector_proxy<VECSXP> {
+ typedef ::Rcpp::internal::generic_proxy<VECSXP> type ;
+ } ;
+
+ template <int RTYPE>
+ struct r_vector_iterator {
+ typedef typename storage_type<RTYPE>::type* type ;
+ };
+ template <int RTYPE> struct proxy_based_iterator{
+ typedef ::Rcpp::internal::Proxy_Iterator< typename r_vector_proxy<RTYPE>::type > type ;
+ } ;
+ template<> struct r_vector_iterator<VECSXP> : proxy_based_iterator<VECSXP>{} ;
+ template<> struct r_vector_iterator<EXPRSXP> : proxy_based_iterator<EXPRSXP>{} ;
+ template<> struct r_vector_iterator<STRSXP> : proxy_based_iterator<STRSXP>{} ;
+
+ template <int RTYPE>
+ struct get_iterator< Rcpp::Vector<RTYPE> >{
+ typedef typename traits::r_vector_iterator<RTYPE>::type type ;
+ } ;
+
+} // traits
+
+
+
#endif
Modified: pkg/Rcpp/inst/include/Rcpp/vector/swap.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/swap.h 2010-06-17 08:22:44 UTC (rev 1559)
+++ pkg/Rcpp/inst/include/Rcpp/vector/swap.h 2010-06-17 09:25:43 UTC (rev 1560)
@@ -32,9 +32,9 @@
a.swap(b) ; \
}
-RCPP_GENERATE_SWAP( generic_proxy,VECSXP)
-RCPP_GENERATE_SWAP( generic_proxy,EXPRSXP)
-RCPP_GENERATE_SWAP( string_proxy,STRSXP)
+RCPP_GENERATE_SWAP(generic_proxy,VECSXP)
+RCPP_GENERATE_SWAP(generic_proxy,EXPRSXP)
+RCPP_GENERATE_SWAP(string_proxy,STRSXP)
#undef RCPP_GENERATE_SWAP
}
Modified: pkg/Rcpp/inst/include/Rcpp/vector/traits.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/traits.h 2010-06-17 08:22:44 UTC (rev 1559)
+++ pkg/Rcpp/inst/include/Rcpp/vector/traits.h 2010-06-17 09:25:43 UTC (rev 1560)
@@ -24,59 +24,7 @@
namespace traits{
- template <int RTYPE> struct r_vector_element_converter{
- typedef typename ::Rcpp::internal::element_converter<RTYPE> type ;
- } ;
- template<> struct r_vector_element_converter<STRSXP>{
- typedef ::Rcpp::internal::string_element_converter<STRSXP> type ;
- } ;
- template<> struct r_vector_element_converter<VECSXP>{
- typedef ::Rcpp::internal::generic_element_converter<VECSXP> type ;
- } ;
- template<> struct r_vector_element_converter<EXPRSXP>{
- typedef ::Rcpp::internal::generic_element_converter<EXPRSXP> type ;
- } ;
-
- template <int RTYPE>
- struct r_vector_name_proxy{
- typedef typename ::Rcpp::internal::simple_name_proxy<RTYPE> type ;
- } ;
- template<> struct r_vector_name_proxy<STRSXP>{
- typedef ::Rcpp::internal::string_name_proxy<STRSXP> type ;
- } ;
- template<> struct r_vector_name_proxy<VECSXP>{
- typedef ::Rcpp::internal::generic_name_proxy<VECSXP> type ;
- } ;
- template<> struct r_vector_name_proxy<EXPRSXP>{
- typedef ::Rcpp::internal::generic_name_proxy<EXPRSXP> type ;
- } ;
-
template <int RTYPE>
- struct r_vector_proxy{
- typedef typename storage_type<RTYPE>::type& type ;
- } ;
- template<> struct r_vector_proxy<STRSXP> {
- typedef ::Rcpp::internal::string_proxy<STRSXP> type ;
- } ;
- template<> struct r_vector_proxy<EXPRSXP> {
- typedef ::Rcpp::internal::generic_proxy<EXPRSXP> type ;
- } ;
- template<> struct r_vector_proxy<VECSXP> {
- typedef ::Rcpp::internal::generic_proxy<VECSXP> type ;
- } ;
-
- template <int RTYPE>
- struct r_vector_iterator {
- typedef typename storage_type<RTYPE>::type* type ;
- };
- template <int RTYPE> struct proxy_based_iterator{
- typedef ::Rcpp::internal::Proxy_Iterator< typename r_vector_proxy<RTYPE>::type > type ;
- } ;
- template<> struct r_vector_iterator<VECSXP> : proxy_based_iterator<VECSXP>{} ;
- template<> struct r_vector_iterator<EXPRSXP> : proxy_based_iterator<EXPRSXP>{} ;
- template<> struct r_vector_iterator<STRSXP> : proxy_based_iterator<STRSXP>{} ;
-
- template <int RTYPE>
class r_vector_cache{
public:
typedef typename ::Rcpp::Vector<RTYPE> VECTOR ;
@@ -127,17 +75,7 @@
public:
r_vector_cache() : proxy_cache<STRSXP>(){} ;
} ;
-
- template<int RTYPE> struct init_type {
- typedef typename storage_type<RTYPE>::type type ;
- } ;
- template<> struct init_type<STRSXP>{
- typedef const char* type ;
- } ;
- template<> struct init_type<LGLSXP>{
- typedef bool type ;
- } ;
-
+
} // traits
#endif
Modified: pkg/Rcpp/inst/include/RcppCommon.h
===================================================================
--- pkg/Rcpp/inst/include/RcppCommon.h 2010-06-17 08:22:44 UTC (rev 1559)
+++ pkg/Rcpp/inst/include/RcppCommon.h 2010-06-17 09:25:43 UTC (rev 1560)
@@ -225,6 +225,7 @@
#include <Rcpp/traits/wrap_type_traits.h>
#include <Rcpp/traits/is_na.h>
#include <Rcpp/traits/is_trivial.h>
+#include <Rcpp/traits/init_type.h>
#include <Rcpp/traits/is_const.h>
#include <Rcpp/traits/is_reference.h>
More information about the Rcpp-commits
mailing list