Skip to content

Commit 8efdc85

Browse files
added a templated DataFrame ctor
1 parent 1fb9b02 commit 8efdc85

File tree

6 files changed

+38
-3
lines changed

6 files changed

+38
-3
lines changed

inst/include/Rcpp/DataFrame.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ namespace Rcpp{
4444
set_sexp(other) ;
4545
}
4646

47+
template <typename T>
48+
DataFrame_Impl( const T& obj ) ;
49+
4750
DataFrame_Impl& operator=( DataFrame_Impl& other){
4851
if( *this != other) set_sexp(other) ;
4952
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright (C) 2013 Romain Francois
2+
//
3+
// This file is part of Rcpp.
4+
//
5+
// Rcpp is free software: you can redistribute it and/or modify it
6+
// under the terms of the GNU General Public License as published by
7+
// the Free Software Foundation, either version 2 of the License, or
8+
// (at your option) any later version.
9+
//
10+
// Rcpp is distributed in the hope that it will be useful, but
11+
// WITHOUT ANY WARRANTY; without even the implied warranty of
12+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
// GNU General Public License for more details.
14+
//
15+
// You should have received a copy of the GNU General Public License
16+
// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
17+
18+
#ifndef Rcpp_api_meat_DataFrame_h
19+
#define Rcpp_api_meat_DataFrame_h
20+
21+
namespace Rcpp{
22+
23+
template <template <class> class StoragePolicy>
24+
template <class T>
25+
DataFrame_Impl<StoragePolicy>::DataFrame_Impl( const T& obj){
26+
set_sexp( wrap(obj) ) ;
27+
}
28+
29+
}
30+
31+
#endif

inst/include/Rcpp/api/meat/meat.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <Rcpp/api/meat/NamesProxy.h>
3131
#include <Rcpp/api/meat/SlotProxy.h>
3232

33+
#include <Rcpp/api/meat/DataFrame.h>
3334
#include <Rcpp/api/meat/S4.h>
3435
#include <Rcpp/api/meat/Environment.h>
3536

inst/unitTests/RcppTestA/src/rcpp_hello_world.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ SEXP hello_world_ex(){
1212
try{
1313
throw std::range_error( "boom" ) ;
1414
} catch( std::exception& __ex__ ){
15-
forward_exception_to_r( __ex__ ) ;
15+
Rcpp::forward_exception_to_r( __ex__ ) ;
1616
}
1717
return R_NilValue ;
1818
}

src/Module.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ SEXP class__newInstance(SEXP args){
146146
// relies on being set in .onLoad()
147147
SEXP rcpp_dummy_pointer = R_NilValue;
148148

149-
#define CHECK_DUMMY_OBJ(p) if(p == rcpp_dummy_pointer) forward_exception_to_r( Rcpp::not_initialized())
149+
#define CHECK_DUMMY_OBJ(p) if(p == rcpp_dummy_pointer) Rcpp::forward_exception_to_r( Rcpp::not_initialized())
150150

151151

152152
SEXP class__dummyInstance(SEXP args) {

vignettes/Rcpp-introduction.Rnw

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ RcppExport SEXP fun( SEXP x ) {
811811
throw std::range_error("too big");
812812
return Rcpp::wrap( dx * dx);
813813
} catch( std::exception& __ex__ ) {
814-
forward_exception_to_r( __ex__ );
814+
Rcpp::forward_exception_to_r( __ex__ );
815815
} catch(...) {
816816
::Rf_error( "c++ exception (unknown reason)" );
817817
}

0 commit comments

Comments
 (0)