Rcpp Version 1.0.14
Loading...
Searching...
No Matches
export.h
Go to the documentation of this file.
1// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2//
3// export.h: Rcpp R/C++ interface class library -- export implementations
4//
5// Copyright (C) 2013 Dirk Eddelbuettel and Romain Francois
6//
7// This file is part of Rcpp.
8//
9// Rcpp is free software: you can redistribute it and/or modify it
10// under the terms of the GNU General Public License as published by
11// the Free Software Foundation, either version 2 of the License, or
12// (at your option) any later version.
13//
14// Rcpp is distributed in the hope that it will be useful, but
15// WITHOUT ANY WARRANTY; without even the implied warranty of
16// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17// GNU General Public License for more details.
18//
19// You should have received a copy of the GNU General Public License
20// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
21
22#ifndef Rcpp_api_meat_export_h
23#define Rcpp_api_meat_export_h
24
25namespace Rcpp{
26namespace internal{
27
28 template <typename InputIterator, typename value_type>
35
36
37} // namespace internal
38
39 namespace traits{
40
41 template < template <class, class> class ContainerTemplate, typename T > class ContainerExporter {
42 public:
45
48
50 if( TYPEOF(object) == RTYPE ){
51 T* start = Rcpp::internal::r_vector_start<RTYPE>(object) ;
52 return Container( start, start + Rf_xlength(object) ) ;
53 }
54 Container vec( ::Rf_xlength(object) );
55 ::Rcpp::internal::export_range( object, vec.begin() ) ;
56 return vec ;
57 }
58
59 private:
61 } ;
62 template < template<class,class> class Container > struct container_exporter< Container, int >{
64 } ;
65 template < template<class,class> class Container > struct container_exporter< Container, double >{
67 } ;
68
69 }
70} // namespace Rcpp
71
72#endif
static const int RTYPE
Definition export.h:44
ContainerTemplate< T, std::allocator< T > > Container
Definition export.h:43
T as(SEXP x, ::Rcpp::traits::r_type_primitive_tag)
Definition as.h:43
void export_range__dispatch(SEXP x, InputIterator first, ::Rcpp::traits::r_type_generic_tag)
Definition export.h:29
Rcpp API.
Definition algo.h:28
T as(SEXP x)
Definition as.h:151
ContainerExporter< Container, double > type
Definition export.h:66
ContainerExporter< Container, int > type
Definition export.h:63