Rcpp Version 1.0.14
Loading...
Searching...
No Matches
ProtectedProxy.h
Go to the documentation of this file.
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_ProtectedProxy_h
19#define Rcpp_ProtectedProxy_h
20
21namespace Rcpp{
22
23 template <typename T> T as(SEXP x);
24
25 template <class XPtrClass>
27 public:
28
29 class ProtectedProxy : public GenericProxy<ProtectedProxy> {
30 public:
32
33 template <typename U>
36 return *this;
37 }
38
39 template <typename U>
40 operator U() const {
41 return as<U>( get() );
42 }
43
44 operator SEXP() const{
45 return get() ;
46 }
47
48 private:
50
51 inline SEXP get() const {
53 }
54
55 inline void set( SEXP x){
57 }
58
59 } ;
60
61 class const_ProtectedProxy : public GenericProxy<const_ProtectedProxy>{
62 public:
64
65 template <typename U>
66 operator U() const {
67 return as<U>( get() );
68 }
69
70 operator SEXP() const{
71 return get() ;
72 }
73
74 private:
75 const XPtrClass& xp ;
76
77 inline SEXP get() const {
79 }
80
81 } ;
82
84 return ProtectedProxy( static_cast<XPtrClass&>(*this) ) ;
85 }
86
88 return const_ProtectedProxy( static_cast<const XPtrClass&>(*this) ) ;
89 }
90
91
92 } ;
93
94}
95
96#endif
ProtectedProxy & operator=(const U &u)
const_ProtectedProxy prot() const
Rcpp API.
Definition algo.h:28
T as(SEXP x)
Definition as.h:151
SEXP wrap(const Date &date)
Definition Date.h:38