Rcpp Version 1.0.14
Loading...
Searching...
No Matches
Module.h
Go to the documentation of this file.
1
2// Module.h: Rcpp R/C++ interface class library -- Rcpp modules
3//
4// Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois
5//
6// This file is part of Rcpp.
7//
8// Rcpp is free software: you can redistribute it and/or modify it
9// under the terms of the GNU General Public License as published by
10// the Free Software Foundation, either version 2 of the License, or
11// (at your option) any later version.
12//
13// Rcpp is distributed in the hope that it will be useful, but
14// WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License
19// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
20
21#ifndef Rcpp_Module_h
22#define Rcpp_Module_h
23
24#include <Rcpp/config.h>
25#include <Rcpp/internal/call.h>
26
27namespace Rcpp{
28
29 namespace internal{
30
31 template <typename FROM, typename TO>
48
49
50 }
51
52 class CppClass ;
53 class CppObject ;
54
55 template <typename T>
56 class result {
57 public:
58 result( T* ptr_ ) : ptr(ptr_){}
59 operator T*(){ return ptr ; }
60 private:
61 T* ptr;
62 } ;
63
64 template <typename T>
65 class object {
66 public:
67 typedef T object_type ;
68 object( T* ptr_ ) : ptr(ptr_){}
69 operator T*(){ return ptr ; }
70 T* operator->(){ return ptr ; }
71 T& operator&(){ return *ptr ; }
72 T* ptr ;
73 } ;
74
75 namespace internal {
76 template <typename Class>
78 Rcpp::XPtr<Class> xp( ptr, true ) ;
79 Function maker = Environment::Rcpp_namespace()[ "cpp_object_maker"] ;
80 return maker( typeid(Class).name() , xp ) ;
81 }
82 }
83
84}
85
88
89#if defined(HAS_VARIADIC_TEMPLATES)
90namespace Rcpp {
91 template <typename RESULT_TYPE, typename... T>
92 inline void signature(std::string& s, const char* name) {
93 s.clear();
94 s += get_return_type<RESULT_TYPE>() + " " + name + "(";
95 int n = sizeof...(T);
96 int i = 0;
97 // Using initializer list as c++11 implementation of a fold expression
98 (void)std::initializer_list<int>{
99 (s += get_return_type<T>(), s += (++i == n ? "" : ", "), 0)... };
100 s += ")";
101 }
102
103 template <typename RESULT_TYPE, typename... T>
104 class CppFunctionN : public CppFunction {
105 public:
106 CppFunctionN(RESULT_TYPE (*fun)(T...), const char* docstring = 0) : CppFunction(docstring), ptr_fun(fun) {}
107
108 SEXP operator()(SEXP* args) {
110 return call<decltype(ptr_fun), RESULT_TYPE, T...>(ptr_fun, args);
112 }
113
114 inline int nargs() { return sizeof...(T); }
115 inline bool is_void() { return std::is_void<RESULT_TYPE>::value; }
116 inline void signature(std::string& s, const char* name) { Rcpp::signature<RESULT_TYPE, T...>(s, name); }
117 inline DL_FUNC get_function_ptr() { return (DL_FUNC)ptr_fun; }
118
119 private:
120 RESULT_TYPE (*ptr_fun)(T...);
121 };
122
123 template <typename RESULT_TYPE, typename... T>
124 class CppFunction_WithFormalsN : public CppFunctionN<RESULT_TYPE, T...> {
125 public:
126 CppFunction_WithFormalsN(RESULT_TYPE (*fun)(T...), Rcpp::List formals_, const char* docstring = 0) :
127 CppFunctionN<RESULT_TYPE, T...>(fun, docstring), formals(formals_) {}
128
129 SEXP get_formals() { return formals; }
130
131 private:
133 };
134}
135#else
136 #include <Rcpp/module/Module_generated_get_signature.h>
137 // templates CppFunction0, ..., CppFunction65
138 #include <Rcpp/module/Module_generated_CppFunction.h>
139#endif
141#include <Rcpp/module/Module.h>
142
143namespace Rcpp{
144
145 template <typename Class>
146 class CppMethod {
147 public:
149
151 virtual SEXP operator()(Class* /*object*/, SEXP* /*args*/) { return R_NilValue ; }
152 virtual ~CppMethod(){}
153 virtual int nargs(){ return 0 ; }
154 virtual bool is_void(){ return false ; }
155 virtual bool is_const(){ return false ; }
156 virtual void signature(std::string& s, const char* name ){ s = name ; }
157 } ;
158
159 template <typename Class, typename Parent>
160 class CppInheritedMethod : public CppMethod<Class> {
161 public:
164
168
170 return (*parent_method_pointer)( (Parent*)object, args ) ;
171 }
172 inline int nargs(){ return parent_method_pointer->nargs() ; }
173 inline bool is_void(){ return parent_method_pointer->is_void() ; }
174 inline bool is_const(){ return parent_method_pointer->is_const() ; }
175 inline void signature(std::string& s, const char* name){ return parent_method_pointer->signature(s, name) ; }
176
177 private:
179 } ;
180#if defined(HAS_VARIADIC_TEMPLATES)
181 template <typename... T>
182 inline void ctor_signature(std::string& s, const std::string& classname) {
183 s.assign(classname);
184 s += "(";
185 int n = sizeof...(T);
186 int i = 0;
187 // Using initializer list as c++11 implementation of a fold expression
188 (void)std::initializer_list<int>{
189 (s += get_return_type<T>(), s += (++i == n ? "" : ", "), 0)... };
190 s += ")";
191 }
192 template <typename Class>
193 class Constructor_Base {
194 public:
195 virtual Class* get_new( SEXP* args, int nargs ) = 0 ;
196 virtual int nargs() = 0 ;
197 virtual void signature(std::string& s, const std::string& class_name) = 0 ;
198 } ;
199
200 template <typename Class, typename... T>
201 class Constructor: public Constructor_Base<Class> {
202 public:
203 virtual Class* get_new( SEXP* args, int nargs ){
204 return get_new_impl(args, nargs, traits::make_index_sequence<sizeof...(T)>());
205 }
206 virtual int nargs(){ return sizeof...(T) ; }
207 virtual void signature(std::string& s, const std::string& class_name ){
208 ctor_signature<T...>(s, class_name) ;
209 }
210
211 private:
212 template <int... Is>
213 Class* get_new_impl(SEXP* args, int nargs, traits::index_sequence<Is...>) {
214 return new Class( as<T>(args[Is])... ) ;
215 }
216 };
217
218 template <typename Class>
219 class Factory_Base {
220 public:
221 virtual Class* get_new( SEXP* args, int nargs ) = 0 ;
222 virtual int nargs() = 0 ;
223 virtual void signature(std::string& s, const std::string& class_name) = 0 ;
224 } ;
225
226 template <typename Class, typename... T>
227 class Factory : public Factory_Base<Class> {
228 public:
229 Factory( Class* (*fun)(T...) ) : ptr_fun(fun){}
230 virtual Class* get_new( SEXP* args, int nargs ){
231 return get_new( args, traits::make_index_sequence<sizeof...(T)>() ) ;
232 }
233 virtual int nargs(){ return sizeof...(T) ; }
234 virtual void signature(std::string& s, const std::string& class_name ){
235 ctor_signature<T...>(s, class_name) ;
236 }
237 private:
238 template<int... I>
239 Class* get_new( SEXP* args, traits::index_sequence<I...> ){
240 return ptr_fun( bare_as<T>(args[I])... ) ;
241 }
242 Class* (*ptr_fun)(T...) ;
243 } ;
244
245 inline bool yes( SEXP* /*args*/, int /* nargs */ ){
246 return true ;
247 }
248
249 template<int n>
250 bool yes_arity( SEXP* /* args */ , int nargs){
251 return nargs == n ;
252 }
253
254#else
255#include <Rcpp/module/Module_generated_ctor_signature.h>
256#include <Rcpp/module/Module_generated_Constructor.h>
257#include <Rcpp/module/Module_generated_Factory.h>
258#include <Rcpp/module/Module_generated_class_signature.h>
259#endif
260
262 typedef bool (*ValidMethod)(SEXP*,int) ;
263
264 template <typename Class>
266 public:
267
273
276 std::string docstring ;
277
278 inline int nargs(){ return ctor->nargs() ; }
279 inline void signature(std::string& buffer, const std::string& class_name){
280 ctor->signature(buffer, class_name) ;
281 }
282 } ;
283
284 template <typename Class>
286 public:
287
291 const char* doc
292 ) : fact(fact_), valid(valid_), docstring(doc == 0 ? "" : doc){}
293
296 std::string docstring ;
297
298 inline int nargs(){ return fact->nargs() ; }
299 inline void signature(std::string& buffer, const std::string& class_name){
300 fact->signature(buffer, class_name) ;
301 }
302 } ;
303
304
305 template <typename Class>
307 public:
309 SignedMethod( METHOD* m, ValidMethod valid_, const char* doc ) : method(m), valid(valid_), docstring(doc == 0 ? "" : doc) {}
310
313 std::string docstring ;
314
315 inline int nargs(){ return method->nargs() ; }
316 inline bool is_void(){ return method->is_void() ; }
317 inline bool is_const(){ return method->is_const() ; }
318 inline void signature(std::string& s, const char* name){
319 method->signature(s, name);
320 }
321
322 } ;
323
324 template <typename Class>
327 public:
329 typedef Reference::Storage Storage ;
330
331 S4_CppConstructor( SignedConstructor<Class>* m, const XP_Class& class_xp, const std::string& class_name, std::string& buffer ) : Reference( "C++Constructor" ){
332 RCPP_DEBUG( "S4_CppConstructor( SignedConstructor<Class>* m, SEXP class_xp, const std::string& class_name, std::string& buffer" ) ;
333 field( "pointer" ) = Rcpp::XPtr< SignedConstructor<Class> >( m, false ) ;
334 field( "class_pointer" ) = class_xp ;
335 field( "nargs" ) = m->nargs() ;
336 m->signature( buffer, class_name ) ;
337 field( "signature" ) = buffer ;
338 field( "docstring" ) = m->docstring ;
339 }
340
342
343 } ;
344
345 template <typename Class>
348 public:
351 typedef std::vector<signed_method_class*> vec_signed_method ;
352
353 S4_CppOverloadedMethods( vec_signed_method* m, const XP_Class& class_xp, const char* name, std::string& buffer ) : Reference( "C++OverloadedMethods" ){
354 int n = static_cast<int>(m->size()) ;
357 Rcpp::IntegerVector nargs(n) ;
359 for( int i=0; i<n; i++){
360 met = m->at(i) ;
361 nargs[i] = met->nargs() ;
362 voidness[i] = met->is_void() ;
363 constness[i] = met->is_const() ;
364 docstrings[i] = met->docstring ;
365 met->signature(buffer, name) ;
366 signatures[i] = buffer ;
367 }
368
369 field( "pointer" ) = Rcpp::XPtr< vec_signed_method >( m, false ) ;
370 field( "class_pointer" ) = class_xp ;
371 field( "size" ) = n ;
372 field( "void" ) = voidness ;
373 field( "const" ) = constness ;
374 field( "docstrings" ) = docstrings ;
375 field( "signatures" ) = signatures ;
376 field( "nargs" ) = nargs ;
377
378 }
379
381
382 } ;
383
384#if defined(HAS_VARIADIC_TEMPLATES)
385 template <bool IsConst,typename Class, typename RESULT_TYPE, typename... T>
386 class CppMethodImplN : public CppMethod<Class> {
387 public:
388 typedef typename std::conditional<IsConst, RESULT_TYPE (Class::*)(T...) const,
389 RESULT_TYPE (Class::*)(T...)>::type Method;
390 typedef CppMethod<Class> method_class;
392
393 CppMethodImplN(Method m) : method_class(), met(m) {}
394 SEXP operator()(Class* object, SEXP* args) {
395 // Can't pass pointer to member function directly to `call()`, so wrap it in a lambda
396 auto f = [&object, this](T... cpp_args) -> CLEANED_RESULT_TYPE {
397 return (object->*met)(cpp_args...);
398 };
399 return call<decltype(f), CLEANED_RESULT_TYPE, T...>(f, args);
400 }
401 inline int nargs() { return sizeof...(T); }
402 inline bool is_void() { return std::is_void<RESULT_TYPE>::value; }
403 inline bool is_const() { return IsConst; }
404 inline void signature(std::string& s, const char* name) { Rcpp::signature<RESULT_TYPE,T...>(s, name); }
405 private:
406 Method met;
407 };
408
409 template <typename Class, typename RESULT_TYPE, typename... T>
410 using CppMethodN = CppMethodImplN<false, Class, RESULT_TYPE, T...>;
411
412 template <typename Class, typename RESULT_TYPE, typename... T>
413 using const_CppMethodN = CppMethodImplN<true, Class, RESULT_TYPE, T...>;
414
415 template <bool IsConst, typename Class, typename RESULT_TYPE, typename... T>
416 class Pointer_CppMethodImplN : public CppMethod<Class> {
417 public:
418 typedef typename std::conditional<IsConst, RESULT_TYPE (*)(const Class*, T...),
419 RESULT_TYPE (*)(Class*, T...)>::type Method;
420 typedef CppMethod<Class> method_class;
422
423 Pointer_CppMethodImplN(Method m) : method_class(), met(m) {}
424 SEXP operator()(Class* object, SEXP* args) {
425 // Need to have `object` as the first argument to the function, so wrap it in a lambda
426 auto f = [&object, this](T... cpp_args) -> CLEANED_RESULT_TYPE {
427 return met(object, cpp_args...);
428 };
429 return call<decltype(f), CLEANED_RESULT_TYPE, T...>(f, args);
430 }
431 inline int nargs() { return sizeof...(T); }
432 inline bool is_void() { return std::is_void<RESULT_TYPE>::value; }
433 inline bool is_const() { return IsConst; }
434 inline void signature(std::string& s, const char* name) { Rcpp::signature<RESULT_TYPE,T...>(s, name); }
435 private:
436 Method met;
437 };
438
439 template <typename Class, typename RESULT_TYPE, typename... T>
441
442 template <typename Class, typename RESULT_TYPE, typename... T>
444#else
445 #include <Rcpp/module/Module_generated_CppMethod.h>
446 #include <Rcpp/module/Module_generated_Pointer_CppMethod.h>
447#endif
448
449 template <typename Class>
451 public:
453
454 CppProperty(const char* doc = 0) : docstring( doc == 0 ? "" : doc ) {} ;
455 virtual ~CppProperty(){} ;
456 virtual SEXP get(Class* ) { throw std::range_error("cannot retrieve property"); }
457 virtual void set(Class*, SEXP) { throw std::range_error("cannot set property"); }
458 virtual bool is_readonly(){ return false; }
459 virtual std::string get_class(){ return ""; }
460
461 std::string docstring ;
462 } ;
463
464 template <typename Class, typename Parent>
465 class CppInheritedProperty : public CppProperty<Class> {
466 public:
468
473
474 SEXP get( Class* obj ){ return parent_property->get( (Parent*)obj ) ; }
475 void set( Class* obj, SEXP s) { parent_property->set( (Parent*)obj, s ) ; }
477 std::string get_class(){ return parent_property->get_class() ; }
478
479 private:
481 } ;
482
483 template <typename Class>
485 public:
487 virtual void run(Class* ){} ;
488 } ;
489
490 template <typename Class>
491 class FunctionFinalizer : public CppFinalizer<Class> {
492 public:
493 typedef void (*Pointer)(Class*) ;
495
496 virtual void run(Class* object){
497 finalizer( object ) ;
498 }
499
500 private:
502 } ;
503
504 template <typename Class>
505 class S4_field : public Rcpp::Reference {
507 public:
510 RCPP_DEBUG( "S4_field( CppProperty<Class>* p, const XP_Class& class_xp )" )
511 field( "read_only" ) = p->is_readonly() ;
512 field( "cpp_class" ) = p->get_class();
513 field( "pointer" ) = Rcpp::XPtr< CppProperty<Class> >( p, false ) ;
514 field( "class_pointer" ) = class_xp ;
515 field( "docstring" ) = p->docstring ;
516 }
517
519
520 } ;
521
523
524#include <Rcpp/module/class.h>
525
526 template <typename Enum, typename Parent>
527 class enum_ {
528 public:
530
531 enum_( const char* name_ ) :
532 name(name_), values(), parent_typeinfo_name( typeid(Parent).name() ){
533 }
535 Rcpp::Module* module = getCurrentScope() ;
536 module->add_enum( parent_typeinfo_name, name, values ) ;
537 }
538
539 self& value( const char* name_, Enum value_ ){
540 values.insert( PAIR( name_, static_cast<int>( value_ ) ) ) ;
541 return *this ;
542 }
543
544 private:
545
546 std::string name ;
547 typedef std::map< std::string, int > MAP ;
548 typedef MAP::value_type PAIR ;
551
552 } ;
553}
554
555#if defined(HAS_VARIADIC_TEMPLATES)
556namespace Rcpp {
557 template <typename RESULT_TYPE, typename... T>
558 void function(const char* name_, RESULT_TYPE (*fun)(T... t), const char* docstring = 0) {
560 if (scope) {
561 scope->Add(name_, new CppFunctionN<RESULT_TYPE, T...>(fun, docstring));
562 }
563 }
564
565 template <typename RESULT_TYPE, typename... T>
566 void function(const char* name_, RESULT_TYPE (*fun)(T... t), Rcpp::List formals, const char* docstring = 0) {
568 if (scope) {
569 scope->Add(name_, new CppFunction_WithFormalsN<RESULT_TYPE, T...>(fun, formals, docstring));
570 }
571 }
572}
573#else
574 // function factories
575 #include <Rcpp/module/Module_generated_function.h>
576#endif
577
578namespace Rcpp {
579
580 template <typename FROM, typename TO>
581 void converter( const char* from, const char* to, TO (*fun)(FROM), const char* docstring = 0 ){
583 function( fun_name.c_str(), fun, docstring ) ;
584 }
585
586 class CppClass : public S4{
587 typedef S4 Base;
588 public:
591 CppClass( SEXP x) : S4(x){};
592
593 CppClass( Module* p, class_Base* cl, std::string& buffer ) : S4("C++Class") {
594 XP_Class clxp( cl, false, R_NilValue, R_NilValue ) ;
595 slot( "module" ) = XP( p, false ) ;
596 slot( "pointer" ) = clxp ;
597
598 buffer = "Rcpp_" ;
599 buffer += cl->name ;
600 slot( ".Data" ) = buffer ;
601
602 slot( "fields" ) = cl->fields( clxp ) ;
603
604 slot( "methods" ) = cl->getMethods( clxp, buffer ) ;
605 slot( "constructors") = cl->getConstructors( clxp, buffer ) ;
606 slot( "docstring" ) = cl->docstring ;
607 slot( "typeid" ) = cl->get_typeinfo_name() ;
608 slot( "enums" ) = cl->enums ;
609 slot( "parents" ) = cl->parents ;
610 }
611
613
614 } ;
615
616 class CppObject : public S4{
617 typedef S4 Base;
618 public:
620 CppObject( Module* p, class_Base* clazz, SEXP xp ) : S4("C++Object") {
621 slot( "module" ) = XP( p, false ) ;
622 slot( "cppclass" ) = Rcpp::XPtr<class_Base>( clazz, false ) ;
623 slot( "pointer" ) = xp ;
624 }
626 } ;
627
628}
629
630#define RCPP_MODULE_BOOT(name) _rcpp_module_boot_##name
631
632#define RCPP_MODULE(name) \
633 void _rcpp_module_##name##_init() ; \
634 static Rcpp::Module _rcpp_module_##name( # name ) ; \
635 extern "C" SEXP _rcpp_module_boot_##name(){ \
636 ::setCurrentScope( & _rcpp_module_##name ) ; \
637 _rcpp_module_##name##_init( ) ; \
638 Rcpp::XPtr<Rcpp::Module> mod_xp(& _rcpp_module_##name , false); \
639 ::setCurrentScope( 0 ) ; \
640 return mod_xp ; \
641 } \
642 void _rcpp_module_##name##_init()
643
644// silly little dance to suppress a 'defined but not used variable' warning
645#ifdef __GNUC__
646#define VARIABLE_IS_NOT_USED __attribute__ ((unused))
647#else
648#define VARIABLE_IS_NOT_USED
649#endif
650
651// static variable to hold Rf_install symbol to prevent it from being gc'ed
653
654// helper macro to cache the result of Rf_install("Module"): once
655// it is allocated and in the symbol table it is safe from gc
656#define GET_MODULE_SYM ( moduleSym == NULL ? moduleSym = Rf_install("Module") : moduleSym )
657
658// this macro is called by code wanting to load a module -- see RInside's rinside_module_sample0.cpp
659#define LOAD_RCPP_MODULE(NAME) \
660 Shield<SEXP> __load_module_call__( Rf_lang2( GET_MODULE_SYM, _rcpp_module_boot_##NAME() ) ); \
661 Rcpp_fast_eval( __load_module_call__, R_GlobalEnv );
662
663#endif
#define VARIABLE_IS_NOT_USED
Definition Module.h:648
static VARIABLE_IS_NOT_USED SEXP moduleSym
Definition Module.h:652
self & field(const char *name_, T Class::*ptr, const char *docstring=0)
CppClass(SEXP x)
Definition Module.h:591
Rcpp::XPtr< Rcpp::Module > XP
Definition Module.h:590
CppClass(Module *p, class_Base *cl, std::string &buffer)
Definition Module.h:593
XPtr< class_Base > XP_Class
Definition Module.h:589
virtual void run(Class *)
Definition Module.h:487
CppInheritedMethod(ParentMethod *parent_method_pointer_)
Definition Module.h:165
ParentMethod * parent_method_pointer
Definition Module.h:178
Rcpp::XPtr< Class > XP
Definition Module.h:162
SEXP operator()(Class *object, SEXP *args)
Definition Module.h:169
CppMethod< Parent > ParentMethod
Definition Module.h:163
void signature(std::string &s, const char *name)
Definition Module.h:175
CppProperty< Class > Base
Definition Module.h:467
void set(Class *obj, SEXP s)
Definition Module.h:475
CppInheritedProperty(CppProperty< Parent > *parent_property_)
Definition Module.h:469
std::string get_class()
Definition Module.h:477
SEXP get(Class *obj)
Definition Module.h:474
CppProperty< Parent > * parent_property
Definition Module.h:480
virtual ~CppMethod()
Definition Module.h:152
virtual bool is_void()
Definition Module.h:154
virtual bool is_const()
Definition Module.h:155
Rcpp::XPtr< Class > XP
Definition Module.h:148
virtual void signature(std::string &s, const char *name)
Definition Module.h:156
virtual int nargs()
Definition Module.h:153
virtual SEXP operator()(Class *, SEXP *)
Definition Module.h:151
CppObject(Module *p, class_Base *clazz, SEXP xp)
Definition Module.h:620
Rcpp::XPtr< Rcpp::Module > XP
Definition Module.h:619
CppProperty(const char *doc=0)
Definition Module.h:454
virtual SEXP get(Class *)
Definition Module.h:456
Rcpp::XPtr< Class > XP
Definition Module.h:452
virtual ~CppProperty()
Definition Module.h:455
virtual bool is_readonly()
Definition Module.h:458
virtual std::string get_class()
Definition Module.h:459
virtual void set(Class *, SEXP)
Definition Module.h:457
std::string docstring
Definition Module.h:461
FunctionFinalizer(Pointer p)
Definition Module.h:494
void(* Pointer)(Class *)
Definition Module.h:493
virtual void run(Class *object)
Definition Module.h:496
Reference::Storage Storage
Definition Module.h:329
XPtr< class_Base > XP_Class
Definition Module.h:328
S4_CppConstructor(SignedConstructor< Class > *m, const XP_Class &class_xp, const std::string &class_name, std::string &buffer)
Definition Module.h:331
S4_CppOverloadedMethods(vec_signed_method *m, const XP_Class &class_xp, const char *name, std::string &buffer)
Definition Module.h:353
std::vector< signed_method_class * > vec_signed_method
Definition Module.h:351
SignedMethod< Class > signed_method_class
Definition Module.h:350
Rcpp::XPtr< class_Base > XP_Class
Definition Module.h:349
XPtr< class_Base > XP_Class
Definition Module.h:508
S4_field(CppProperty< Class > *p, const XP_Class &class_xp)
Definition Module.h:509
Rcpp::Reference Base
Definition Module.h:506
void signature(std::string &buffer, const std::string &class_name)
Definition Module.h:279
Constructor_Base< Class > * ctor
Definition Module.h:274
SignedConstructor(Constructor_Base< Class > *ctor_, ValidConstructor valid_, const char *doc)
Definition Module.h:268
std::string docstring
Definition Module.h:276
ValidConstructor valid
Definition Module.h:275
void signature(std::string &buffer, const std::string &class_name)
Definition Module.h:299
std::string docstring
Definition Module.h:296
SignedFactory(Factory_Base< Class > *fact_, ValidConstructor valid_, const char *doc)
Definition Module.h:288
ValidConstructor valid
Definition Module.h:295
Factory_Base< Class > * fact
Definition Module.h:294
METHOD * method
Definition Module.h:311
void signature(std::string &s, const char *name)
Definition Module.h:318
ValidMethod valid
Definition Module.h:312
SignedMethod(METHOD *m, ValidMethod valid_, const char *doc)
Definition Module.h:309
CppMethod< Class > METHOD
Definition Module.h:308
std::string docstring
Definition Module.h:313
self & value(const char *name_, Enum value_)
Definition Module.h:539
MAP::value_type PAIR
Definition Module.h:548
std::map< std::string, int > MAP
Definition Module.h:547
std::string name
Definition Module.h:546
enum_(const char *name_)
Definition Module.h:531
MAP values
Definition Module.h:549
std::string parent_typeinfo_name
Definition Module.h:550
enum_< Enum, Parent > self
Definition Module.h:529
T object_type
Definition Module.h:67
T & operator&()
Definition Module.h:71
T * operator->()
Definition Module.h:70
object(T *ptr_)
Definition Module.h:68
result(T *ptr_)
Definition Module.h:58
#define RCPP_DEBUG(MSG)
Definition debug.h:43
#define RCPP_CTOR_ASSIGN_WITH_BASE(__CLASS__)
Definition interface.h:38
#define END_RCPP
Definition macros.h:99
#define BEGIN_RCPP
Definition macros.h:49
T as(SEXP x, ::Rcpp::traits::r_type_primitive_tag)
Definition as.h:43
SEXP make_new_object(Class *ptr)
Definition Module.h:77
std::string get_converter_name(const char *from, const char *to)
Definition Module.h:32
Rcpp API.
Definition algo.h:28
Function_Impl< PreserveStorage > Function
Definition Function.h:131
bool(* ValidConstructor)(SEXP *, int)
Definition Module.h:261
void converter(const char *from, const char *to, TO(*fun)(FROM), const char *docstring=0)
Definition Module.h:581
bool(* ValidMethod)(SEXP *, int)
Definition Module.h:262
T as(SEXP x)
Definition as.h:151
Reference_Impl< PreserveStorage > Reference
Definition Reference.h:71
S4_Impl< PreserveStorage > S4
Definition S4.h:77
attribute_hidden Rcpp::Module * getCurrentScope()
Definition routines.h:270
remove_const< typenameremove_reference< T >::type >::type type