22 #ifndef Rcpp__macros_xp_h
23 #define Rcpp__macros_xp_h
25 #define RCPP_XP_FIELD_GET(__NAME__,__CLASS__,__FIELD__) \
26 extern "C" SEXP RCPP_PP_CAT(__NAME__,__rcpp_info__)(){ \
28 Rcpp::List info = Rcpp::List::create( \
29 _["class"] = #__CLASS__ , \
30 _["field"] = #__FIELD__ \
32 info.attr( "class" ) = "rcppxpfieldgetinfo" ; \
35 extern "C" SEXP __NAME__( SEXP xp ){ \
37 SEXP res = R_NilValue ; \
38 ::Rcpp::XPtr< __CLASS__ > ptr(xp) ; \
39 res = ::Rcpp::wrap( ptr->__FIELD__ ) ; \
44 #define RCPP_XP_FIELD_SET(__NAME__,__CLASS__,__FIELD__) \
45 extern "C" SEXP RCPP_PP_CAT(__NAME__,__rcpp_info__)(){ \
47 Rcpp::List info = Rcpp::List::create( \
48 _["class"] = #__CLASS__ , \
49 _["field"] = #__FIELD__ \
51 info.attr( "class" ) = "rcppxpfieldsetinfo" ; \
54 extern "C" SEXP __NAME__( SEXP xp, SEXP value ){ \
56 ::Rcpp::XPtr< __CLASS__ > ptr(xp) ; \
57 ptr->__FIELD__ = ::Rcpp::internal::converter(value) ; \
61 #define RCPP_XP_FIELD(__PREFIX__,__CLASS__,__FIELD__) \
62 RCPP_XP_FIELD_GET( RCPP_PP_CAT(__PREFIX__,_get), __CLASS__, __FIELD__ ) \
63 RCPP_XP_FIELD_SET( RCPP_PP_CAT(__PREFIX__,_set), __CLASS__, __FIELD__ )