File tree Expand file tree Collapse file tree 10 files changed +226
-2
lines changed
Expand file tree Collapse file tree 10 files changed +226
-2
lines changed Original file line number Diff line number Diff line change 1+ 2013-10-14 Romain Francois <romain@r-enthusiasts.com>
2+
3+ * inst/include/Rcpp/protection/protection.h: added Shield/Shelter/Armor
4+ * DESCRIPTION: bump to version 0.10.5.3
5+
162013-10-12 Dirk Eddelbuettel <edd@debian.org>
27
38 * DESCRIPTION (Depends): Rolled Depends: on R to "R (>= 3.0.0)" as
Original file line number Diff line number Diff line change 11Package: Rcpp
22Title: Seamless R and C++ Integration
3- Version: 0.10.5.2
3+ Version: 0.10.5.3
44Date: $Date$
55Author: Dirk Eddelbuettel and Romain Francois, with contributions
66 by Douglas Bates, John Chambers and JJ Allaire
Original file line number Diff line number Diff line change 3030#include < Rcpp/api/meat/Reference.h>
3131#include < Rcpp/api/meat/is.h>
3232#include < Rcpp/api/meat/export.h>
33+ #include < Rcpp/api/meat/protection.h>
3334#include < Rcpp/api/meat/wrap.h>
3435
3536#endif
Original file line number Diff line number Diff line change 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_protection_meat_H
19+ #define Rcpp_protection_meat_H
20+
21+ namespace Rcpp {
22+
23+ template <typename T>
24+ template <typename U>
25+ Armor<T>::Armor( U x ) : data() {
26+ init ( wrap (x) ) ;
27+ }
28+
29+ template <typename T>
30+ template <typename U>
31+ inline Armor<T>& Armor<T>::operator =( U x ){
32+ REPROTECT (data = wrap (x), index) ;
33+ return *this ;
34+ }
35+
36+ template <typename T>
37+ template <typename U>
38+ inline Shield<T>::operator U () const {
39+ return as<U>(t) ;
40+ }
41+ }
42+
43+ #endif
Original file line number Diff line number Diff line change 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_protection_Armor_H
19+ #define Rcpp_protection_Armor_H
20+
21+ namespace Rcpp {
22+
23+ template <typename T>
24+ class Armor {
25+ public:
26+
27+ Armor () : data(){
28+ init (R_NilValue) ;
29+ }
30+
31+ template <typename U> Armor ( U x );
32+
33+ inline operator SEXP (){
34+ return data ;
35+ }
36+
37+ template <typename U>
38+ inline Armor& operator =( U x ) ;
39+
40+ ~Armor (){
41+ UNPROTECT (1 ) ;
42+ }
43+
44+ private:
45+ void init (SEXP x){
46+ PROTECT_WITH_INDEX ( data = x, &index ) ;
47+ }
48+
49+ SEXP data ;
50+ PROTECT_INDEX index ;
51+
52+ // not defined on purpose
53+ Armor (const Armor&) ;
54+ Armor& operator =(const Armor&) ;
55+ } ;
56+ }
57+
58+ #endif
Original file line number Diff line number Diff line change 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_protection_Shelter_H
19+ #define Rcpp_protection_Shelter_H
20+
21+ namespace Rcpp {
22+
23+ template <class T >
24+ class Shelter {
25+ public:
26+ Shelter () : nprotected(0 ){}
27+
28+ inline SEXP operator ()(SEXP x){
29+ nprotected++;
30+ return PROTECT (x) ;
31+ }
32+
33+ ~Shelter (){
34+ UNPROTECT (nprotected) ;
35+ nprotected = 0 ;
36+ }
37+
38+ private:
39+ int nprotected ;
40+
41+ // not defined on purpose
42+ Shelter (const Shelter&) ;
43+ Shelter& operator =(const Shelter&) ;
44+ } ;
45+ }
46+
47+ #endif
Original file line number Diff line number Diff line change 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_protection_Shield_H
19+ #define Rcpp_protection_Shield_H
20+
21+ namespace Rcpp {
22+
23+ template <typename T>
24+ class Shield {
25+ public:
26+ Shield ( SEXP t_) : t(PROTECT(t_)){}
27+ ~Shield (){
28+ UNPROTECT (1 ) ;
29+ }
30+
31+ template <typename U>
32+ inline operator U () const ;
33+
34+ private:
35+ // not defined on purpose
36+ Shield ( const Shield& ) ;
37+ Shield& operator =( const Shield& ) ;
38+
39+ SEXP t ;
40+ } ;
41+
42+ }
43+
44+ #endif
Original file line number Diff line number Diff line change 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_protection_protection_H
19+ #define Rcpp_protection_protection_H
20+
21+ #include <Rcpp/protection/Shield.h>
22+ #include <Rcpp/protection/Shelter.h>
23+ #include <Rcpp/protection/Armor.h>
24+
25+ #endif
Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ class Vector :
8888 update_vector ();
8989 }
9090 Vector ( const char * st ) : RObject( internal::vector_from_string<RTYPE>(st) ){
91- RCPP_DEBUG_2 ( " Vector<%d>( const char* = %s )" , RTYPE, st. c_str () )
91+ RCPP_DEBUG_2 ( " Vector<%d>( const char* = %s )" , RTYPE, st )
9292 update_vector ();
9393 }
9494
Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ namespace Rcpp{
8282#include < Rcpp/sprintf.h>
8383
8484
85+ #include < Rcpp/protection/protection.h>
8586#include < Rcpp/lang.h>
8687#include < Rcpp/complex.h>
8788#include < Rcpp/barrier.h>
You can’t perform that action at this time.
0 commit comments