24#include <Rcpp/internal/Exporter.h>
31 if (::Rf_length(x) != 1) {
32 const char* fmt =
"Expecting a single value: [extent=%i].";
33 throw ::Rcpp::not_compatible(fmt, ::Rf_length(x));
37 typedef typename ::Rcpp::traits::storage_type<RTYPE>::type STORAGE;
38 T res = caster<STORAGE,T>(*r_vector_start<RTYPE>(y));
47 if (TYPEOF(x) == CHARSXP)
return CHAR(x);
48 if (! ::Rf_isString(x) || Rf_length(x) != 1) {
49 const char* fmt =
"Expecting a single string value: "
50 "[type=%s; extent=%i].";
51 throw ::Rcpp::not_compatible(fmt,
52 Rf_type2char(TYPEOF(x)),
62 return std::wstring(y, y+strlen(y));
74 if (! ::Rf_isString(x)) {
75 const char* fmt =
"Expecting a single string value: "
76 "[type=%s; extent=%i].";
77 throw ::Rcpp::not_compatible(fmt,
78 Rf_type2char(TYPEOF(x)),
86 ::Rcpp::traits::Exporter<T> exporter(x);
88 return exporter.get();
124 return const_cast<T
>(*obj);
150 template <
typename T> T
as(SEXP x) {
158 template <
typename T>
163 template<>
inline SEXP
as(SEXP x) {
return x; }
#define RCPP_DEBUG_1(fmt, MSG)
#define DEMANGLE(__TYPE__)
internal implementation details
T as(SEXP x, ::Rcpp::traits::r_type_primitive_tag)
const char * check_single_string(SEXP x)
void * as_module_object_internal(SEXP obj)
object< T > as_module_object(SEXP x)
T as_string(SEXP x, Rcpp::traits::true_type)
integral_constant< bool, true > true_type
integral_constant< bool, false > false_type
traits::remove_const_and_reference< T >::type bare_as(SEXP x)
integral_constant< bool, _V > type
r_type_generic_tag r_category
remove_const< typenameremove_reference< T >::type >::type type