Rcpp Version 1.0.14
Loading...
Searching...
No Matches
const_generic_proxy.h
Go to the documentation of this file.
1
// const_generic_proxy.h: Rcpp R/C++ interface class library --
2
//
3
// Copyright (C) 2013 - 2018 Romain Francois
4
//
5
// This file is part of Rcpp.
6
//
7
// Rcpp is free software: you can redistribute it and/or modify it
8
// under the terms of the GNU General Public License as published by
9
// the Free Software Foundation, either version 2 of the License, or
10
// (at your option) any later version.
11
//
12
// Rcpp is distributed in the hope that it will be useful, but
13
// WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License for more details.
16
//
17
// You should have received a copy of the GNU General Public License
18
// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
19
20
#ifndef Rcpp__vector__const_generic_proxy_h
21
#define Rcpp__vector__const_generic_proxy_h
22
23
namespace
Rcpp
{
24
namespace
internal{
25
26
template
<
int
RTYPE,
template
<
class
>
class
StoragePolicy>
27
class
const_generic_proxy
:
public
GenericProxy
< const_generic_proxy<RTYPE, StoragePolicy> > {
28
public
:
29
typedef
typename ::Rcpp::Vector<RTYPE, StoragePolicy>
VECTOR
;
30
31
const_generic_proxy
():
parent
(0),
index
(-1){}
32
33
const_generic_proxy
(
const
const_generic_proxy
&
other
) :
34
parent
(
other
.
parent
),
index
(
other
.
index
){} ;
35
36
const_generic_proxy
(
const
VECTOR
& v,
R_xlen_t
i ) :
parent
(&v),
index
(i){} ;
37
38
operator
SEXP
()
const
{
39
return
get
() ;
40
}
41
42
template
<
typename
U>
operator
U
()
const
{
43
return ::Rcpp::as<U>(
get
()) ;
44
}
45
46
// helping the compiler (not sure why it can't help itself)
47
operator
bool
()
const
{ return ::Rcpp::as<bool>(
get
()) ; }
48
operator
int
()
const
{ return ::Rcpp::as<int>(
get
()) ; }
49
50
inline
void
move
(
R_xlen_t
n) {
index
+= n ; }
51
52
const
VECTOR
*
parent
;
53
R_xlen_t
index
;
54
55
private
:
56
57
inline
SEXP
get
()
const
{
58
return
VECTOR_ELT
(*
parent
,
index
);
59
}
60
61
} ;
62
63
}
64
}
65
66
#endif
Rcpp::Vector
Definition
Vector.h:35
Rcpp::internal::const_generic_proxy
Definition
const_generic_proxy.h:27
Rcpp::internal::const_generic_proxy::parent
const VECTOR * parent
Definition
const_generic_proxy.h:52
Rcpp::internal::const_generic_proxy::const_generic_proxy
const_generic_proxy(const const_generic_proxy &other)
Definition
const_generic_proxy.h:33
Rcpp::internal::const_generic_proxy::VECTOR
::Rcpp::Vector< RTYPE, StoragePolicy > VECTOR
Definition
const_generic_proxy.h:29
Rcpp::internal::const_generic_proxy::index
R_xlen_t index
Definition
const_generic_proxy.h:53
Rcpp::internal::const_generic_proxy::const_generic_proxy
const_generic_proxy()
Definition
const_generic_proxy.h:31
Rcpp::internal::const_generic_proxy::move
void move(R_xlen_t n)
Definition
const_generic_proxy.h:50
Rcpp::internal::const_generic_proxy::get
SEXP get() const
Definition
const_generic_proxy.h:57
Rcpp::internal::const_generic_proxy::const_generic_proxy
const_generic_proxy(const VECTOR &v, R_xlen_t i)
Definition
const_generic_proxy.h:36
Rcpp::internal::as
T as(SEXP x, ::Rcpp::traits::r_type_primitive_tag)
Definition
as.h:43
Rcpp
Rcpp API.
Definition
algo.h:28
Rcpp::GenericProxy
Definition
GenericProxy.h:24
inst
include
Rcpp
vector
const_generic_proxy.h
Generated on Sun Jan 12 2025 11:21:43 for Rcpp Version 1.0.14 by
1.9.8