Rcpp Version 1.0.14
Loading...
Searching...
No Matches
class.h
Go to the documentation of this file.
1
2// class.h: Rcpp R/C++ interface class library -- Rcpp modules
3//
4// Copyright (C) 2012 - 2013 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_CLASS_h
22#define Rcpp_Module_CLASS_h
23
24 template <typename Class>
25 class class_ : public class_Base {
26 public:
28 typedef CppMethod<Class> method_class ;
29
30 typedef SignedMethod<Class> signed_method_class ;
31 typedef std::vector<signed_method_class*> vec_signed_method ;
32 typedef std::map<std::string,vec_signed_method*> map_vec_signed_method ;
33 typedef std::pair<std::string,vec_signed_method*> vec_signed_method_pair ;
34
35 typedef std::map<std::string,method_class*> METHOD_MAP ;
36 typedef std::pair<const std::string,method_class*> PAIR ;
37
39 typedef CppFinalizer<Class> finalizer_class ;
40
41 typedef Constructor_Base<Class> constructor_class ;
42 typedef SignedConstructor<Class> signed_constructor_class ;
43 typedef std::vector<signed_constructor_class*> vec_signed_constructor ;
44
45 typedef Factory_Base<Class> factory_class ;
46 typedef SignedFactory<Class> signed_factory_class ;
47 typedef std::vector<signed_factory_class*> vec_signed_factory ;
48
49 typedef CppProperty<Class> prop_class ;
50 typedef std::map<std::string,prop_class*> PROPERTY_MAP ;
51 typedef std::pair<const std::string,prop_class*> PROP_PAIR ;
52
53 class_( const char* name_, const char* doc = 0) :
54 class_Base(name_, doc),
56 properties(),
58 specials(0),
60 factories(),
63 {
65 }
66
67 private:
68
70
71 // check if we already have it
72 if( class_pointer ) {
73 RCPP_DEBUG_MODULE_2( "class_<%s>::get_instance(). [cached] class_pointer = <%p>\n", DEMANGLE(Class), class_pointer ) ;
74 return class_pointer ;
75 }
76
77 // check if it exists in the module
78 Module* module = getCurrentScope() ;
79 if( module->has_class(name) ){
80 RCPP_DEBUG_MODULE_2( "class_<%s>::get_instance(). [from module] class_pointer = class_pointer\n", DEMANGLE(Class), class_pointer ) ;
81 class_pointer = dynamic_cast<self*>( module->get_class_pointer(name) ) ;
82 } else {
83 class_pointer = new self ;
84 class_pointer->name = name ;
85 class_pointer->docstring = docstring ;
87 class_pointer->typeinfo_name = typeid(Class).name() ;
88 module->AddClass( name.c_str(), class_pointer ) ;
89 RCPP_DEBUG_MODULE_2( "class_<%s>::get_instance(). [freshly created] class_pointer = class_pointer\n", DEMANGLE(Class), class_pointer ) ;
90
91 }
92 return class_pointer ;
93 }
94
95 public:
96
98
99 self& AddConstructor( constructor_class* ctor, ValidConstructor valid, const char* docstring = 0 ){
100 class_pointer->constructors.push_back( new signed_constructor_class( ctor, valid, docstring ) );
101 return *this ;
102 }
103
104 self& AddFactory( factory_class* fact, ValidConstructor valid, const char* docstring = 0 ){
105 class_pointer->factories.push_back( new signed_factory_class( fact, valid, docstring ) ) ;
106 return *this ;
107 }
108
109 self& default_constructor( const char* docstring= 0, ValidConstructor valid = &yes_arity<0> ){
110 return constructor( docstring, valid ) ;
111 }
112
113#if defined(HAS_VARIADIC_TEMPLATES)
114 template <typename... T>
115 self& constructor( const char* docstring = 0, ValidConstructor valid = &yes_arity<sizeof...(T)> ){
116 AddConstructor( new Constructor<Class,T...> , valid, docstring ) ;
117 return *this ;
118 }
119 template <typename... T>
120 self& factory( Class* (*fun)(T...), const char* docstring = 0, ValidConstructor valid = &yes_arity<sizeof...(T)> ){
121 AddFactory( new Factory<Class,T...>(fun) , valid, docstring ) ;
122 return *this ;
123 }
124#else
125 #include <Rcpp/module/Module_generated_class_constructor.h>
126 #include <Rcpp/module/Module_generated_class_factory.h>
127#endif
128
129 public:
130
131 std::string get_typeinfo_name(){
132 return typeinfo_name ;
133 }
134
135 SEXP newInstance( SEXP* args, int nargs ){
138 size_t n = constructors.size() ;
139 for( size_t i=0; i<n; i++ ){
140 p = constructors[i];
141 bool ok = (p->valid)(args, nargs) ;
142 if( ok ){
143 Class* ptr = p->ctor->get_new( args, nargs ) ;
144 return XP( ptr, true ) ;
145 }
146 }
147
148 signed_factory_class* pfact ;
149 n = factories.size() ;
150 for( size_t i=0; i<n; i++){
151 pfact = factories[i] ;
152 bool ok = (pfact->valid)(args, nargs) ;
153 if( ok ){
154 Class* ptr = pfact->fact->get_new( args, nargs ) ;
155 return XP( ptr, true ) ;
156 }
157 }
158
159 throw std::range_error( "no valid constructor available for the argument list" ) ;
161 }
162
164 size_t n = constructors.size() ;
166 for( size_t i=0; i<n; i++ ){
167 p = constructors[i];
168 if( p->nargs() == 0 ) return true ;
169 }
170 n = factories.size() ;
171 signed_factory_class* pfact ;
172 for( size_t i=0; i<n; i++ ){
173 pfact = factories[i];
174 if( pfact->nargs() == 0 ) return true ;
175 }
176 return false ;
177 }
178
179 SEXP invoke( SEXP method_xp, SEXP object, SEXP *args, int nargs ){
181
182 vec_signed_method* mets = reinterpret_cast< vec_signed_method* >( R_ExternalPtrAddr( method_xp ) ) ;
183 typename vec_signed_method::iterator it = mets->begin() ;
184 size_t n = mets->size() ;
185 method_class* m = 0 ;
186 bool ok = false ;
187 for( size_t i=0; i<n; i++, ++it ){
188 if( ( (*it)->valid )( args, nargs) ){
189 m = (*it)->method ;
190 ok = true ;
191 break ;
192 }
193 }
194 if( !ok ){
195 throw std::range_error( "could not find valid method" ) ;
196 }
197 if( m->is_void() ){
198 m->operator()( XP(object), args );
199 return Rcpp::List::create( true ) ;
200 } else {
201 return Rcpp::List::create( false, m->operator()( XP(object), args ) ) ;
202 }
204 }
205
206 SEXP invoke_void( SEXP method_xp, SEXP object, SEXP *args, int nargs ){
208
209 vec_signed_method* mets = reinterpret_cast< vec_signed_method* >( R_ExternalPtrAddr( method_xp ) ) ;
210 typename vec_signed_method::iterator it = mets->begin() ;
211 size_t n = mets->size() ;
212 method_class* m = 0 ;
213 bool ok = false ;
214 for( size_t i=0; i<n; i++, ++it ){
215 if( ( (*it)->valid )( args, nargs) ){
216 m = (*it)->method ;
217 ok = true ;
218 break ;
219 }
220 }
221 if( !ok ){
222 throw std::range_error( "could not find valid method" ) ;
223 }
224 m->operator()( XP(object), args );
226 }
227
228 SEXP invoke_notvoid( SEXP method_xp, SEXP object, SEXP *args, int nargs ){
230
231 vec_signed_method* mets = reinterpret_cast< vec_signed_method* >( R_ExternalPtrAddr( method_xp ) ) ;
232 typename vec_signed_method::iterator it = mets->begin() ;
233 size_t n = mets->size() ;
234 method_class* m = 0 ;
235 bool ok = false ;
236 for( size_t i=0; i<n; i++, ++it ){
237 if( ( (*it)->valid )( args, nargs) ){
238 m = (*it)->method ;
239 ok = true ;
240 break ;
241 }
242 }
243 if( !ok ){
244 throw std::range_error( "could not find valid method" ) ;
245 }
246 return m->operator()( XP(object), args ) ;
248 }
249
250
251 self& AddMethod( const char* name_, method_class* m, ValidMethod valid = &yes, const char* docstring = 0){
252 RCPP_DEBUG_MODULE_1( "AddMethod( %s, method_class* m, ValidMethod valid = &yes, const char* docstring = 0", name_ )
253 self* ptr = get_instance() ;
254 typename map_vec_signed_method::iterator it = ptr->vec_methods.find( name_ ) ;
255 if( it == ptr->vec_methods.end() ){
256 it = ptr->vec_methods.insert( vec_signed_method_pair( name_, new vec_signed_method() ) ).first ;
257 }
258 (it->second)->push_back( new signed_method_class(m, valid, docstring ) ) ;
259 if( *name_ == '[' ) ptr->specials++ ;
260 return *this ;
261 }
262
263 self& AddProperty( const char* name_, prop_class* p){
264 get_instance()->properties.insert( PROP_PAIR( name_, p ) ) ;
265 return *this ;
266 }
267
268#if defined(HAS_VARIADIC_TEMPLATES)
269 template <typename RESULT_TYPE, typename... T>
270 self& method(const char* name_, RESULT_TYPE (Class::*fun)(T...),
271 const char* docstring = 0, ValidMethod valid = &yes_arity<sizeof...(T)>) {
272 AddMethod( name_, new CppMethodN<Class,RESULT_TYPE,T...>(fun), valid, docstring);
273 return *this;
274 }
275 template <typename RESULT_TYPE, typename... T>
276 self& method(const char* name_, RESULT_TYPE (Class::*fun)(T...) const,
277 const char* docstring = 0, ValidMethod valid = &yes_arity<sizeof...(T)>) {
278 AddMethod( name_, new const_CppMethodN<Class,RESULT_TYPE,T...>(fun), valid, docstring);
279 return *this;
280 }
281 template <typename RESULT_TYPE, typename... T>
282 self& nonconst_method(const char* name_, RESULT_TYPE (Class::*fun)(T...),
283 const char* docstring = 0, ValidMethod valid = &yes_arity<sizeof...(T)>) {
284 AddMethod( name_, new CppMethodN<Class,RESULT_TYPE,T...>(fun), valid, docstring);
285 return *this;
286 }
287 template <typename RESULT_TYPE, typename... T>
288 self& const_method(const char* name_, RESULT_TYPE (Class::*fun)(T...) const,
289 const char* docstring = 0, ValidMethod valid = &yes_arity<sizeof...(T)>) {
290 AddMethod( name_, new const_CppMethodN<Class,RESULT_TYPE,T...>(fun), valid, docstring);
291 return *this;
292 }
293 template <typename RESULT_TYPE, typename... T>
294 self& method(const char* name_, RESULT_TYPE (*fun)(Class*, T...),
295 const char* docstring = 0, ValidMethod valid = &yes_arity<sizeof...(T)>) {
296 AddMethod( name_, new Pointer_CppMethodN<Class,RESULT_TYPE,T...>(fun), valid, docstring);
297 return *this;
298 }
299 template <typename RESULT_TYPE, typename... T>
300 self& const_method(const char* name_, RESULT_TYPE (*fun)(const Class*, T...),
301 const char* docstring = 0, ValidMethod valid = &yes_arity<sizeof...(T)>) {
302 AddMethod( name_, new Const_Pointer_CppMethodN<Class,RESULT_TYPE,T...>(fun), valid, docstring);
303 return *this;
304 }
305#else
306 #include <Rcpp/module/Module_generated_method.h>
307 #include <Rcpp/module/Module_generated_Pointer_method.h>
308#endif
309
310 bool has_method( const std::string& m){
311 return vec_methods.find(m) != vec_methods.end() ;
312 }
313 bool has_property( const std::string& m){
314 return properties.find(m) != properties.end() ;
315 }
316 bool property_is_readonly( const std::string& p) {
317 typename PROPERTY_MAP::iterator it = properties.find( p ) ;
318 if( it == properties.end() ) throw std::range_error( "no such property" ) ;
319 return it->second->is_readonly() ;
320 }
321 std::string property_class(const std::string& p) {
322 typename PROPERTY_MAP::iterator it = properties.find( p ) ;
323 if( it == properties.end() ) throw std::range_error( "no such property" ) ;
324 return it->second->get_class() ;
325 }
326
328 size_t n = 0 ;
329 size_t s = vec_methods.size() ;
330 typename map_vec_signed_method::iterator it = vec_methods.begin( ) ;
331 for( size_t i=0; i<s; i++, ++it){
332 n += (it->second)->size() ;
333 }
334 Rcpp::CharacterVector out(n) ;
335 it = vec_methods.begin() ;
336 size_t k = 0 ;
337 for( size_t i=0; i<s; i++, ++it){
338 n = (it->second)->size() ;
339 std::string name = it->first ;
340 for( size_t j=0; j<n; j++, k++){
341 out[k] = name ;
342 }
343 }
344 return out ;
345 }
346
348 size_t n = 0 ;
349 size_t s = vec_methods.size() ;
350 typename map_vec_signed_method::iterator it = vec_methods.begin( ) ;
351 for( size_t i=0; i<s; i++, ++it){
352 n += (it->second)->size() ;
353 }
354 Rcpp::CharacterVector mnames(n) ;
355 Rcpp::IntegerVector res(n) ;
356 it = vec_methods.begin() ;
357 size_t k = 0 ;
358 for( size_t i=0; i<s; i++, ++it){
359 n = (it->second)->size() ;
360 std::string name = it->first ;
361 typename vec_signed_method::iterator m_it = (it->second)->begin() ;
362 for( size_t j=0; j<n; j++, k++, ++m_it){
363 mnames[k] = name ;
364 res[k] = (*m_it)->nargs() ;
365 }
366 }
367 res.names( ) = mnames ;
368 return res ;
369 }
370
372 size_t n = 0 ;
373 size_t s = vec_methods.size() ;
374 typename map_vec_signed_method::iterator it = vec_methods.begin( ) ;
375 for( size_t i=0; i<s; i++, ++it){
376 n += (it->second)->size() ;
377 }
378 Rcpp::CharacterVector mnames(n) ;
379 Rcpp::LogicalVector res(n) ;
380 it = vec_methods.begin() ;
381 size_t k = 0 ;
382 for( size_t i=0; i<s; i++, ++it){
383 n = (it->second)->size() ;
384 std::string name = it->first ;
385 typename vec_signed_method::iterator m_it = (it->second)->begin() ;
386 for( size_t j=0; j<n; j++, k++, ++m_it){
387 mnames[k] = name ;
388 res[k] = (*m_it)->is_void() ;
389 }
390 }
391 res.names( ) = mnames ;
392 return res ;
393 }
394
395
397 size_t n = properties.size() ;
398 Rcpp::CharacterVector out(n) ;
399 typename PROPERTY_MAP::iterator it = properties.begin( ) ;
400 for( size_t i=0; i<n; i++, ++it){
401 out[i] = it->first ;
402 }
403 return out ;
404 }
405
407 size_t n = properties.size() ;
408 Rcpp::CharacterVector pnames(n) ;
409 Rcpp::List out(n) ;
410 typename PROPERTY_MAP::iterator it = properties.begin( ) ;
411 for( size_t i=0; i<n; i++, ++it){
412 pnames[i] = it->first ;
413 out[i] = it->second->get_class() ;
414 }
415 out.names() = pnames ;
416 return out ;
417 }
418
420 size_t n = vec_methods.size() - specials ;
421 size_t ntotal = n + properties.size() ;
422 Rcpp::CharacterVector out(ntotal) ;
423 typename map_vec_signed_method::iterator it = vec_methods.begin( ) ;
424 std::string buffer ;
425 size_t i=0 ;
426 for( ; i<n; ++it){
427 buffer = it->first ;
428 if( buffer[0] == '[' ) continue ;
429 // if( (it->second)->nargs() == 0){
430 // buffer += "() " ;
431 // } else {
432 // buffer += "( " ;
433 // }
434 buffer += "( " ;
435 out[i] = buffer ;
436 i++ ;
437 }
438 typename PROPERTY_MAP::iterator prop_it = properties.begin();
439 for( ; i<ntotal; i++, ++prop_it){
440 out[i] = prop_it->first ;
441 }
442 return out ;
443 }
444
445 SEXP getProperty( SEXP field_xp , SEXP object) {
447 prop_class* prop = reinterpret_cast< prop_class* >( R_ExternalPtrAddr( field_xp ) ) ;
448 return prop->get( XP(object) );
450 }
451
452 void setProperty( SEXP field_xp, SEXP object, SEXP value) {
454 prop_class* prop = reinterpret_cast< prop_class* >( R_ExternalPtrAddr( field_xp ) ) ;
455 return prop->set( XP(object), value );
457 }
458
459
460 Rcpp::List fields( const XP_Class& class_xp ){
461 size_t n = properties.size() ;
462 Rcpp::CharacterVector pnames(n) ;
463 Rcpp::List out(n) ;
464 typename PROPERTY_MAP::iterator it = properties.begin( ) ;
465 for( size_t i=0; i<n; i++, ++it){
466 pnames[i] = it->first ;
467 out[i] = S4_field<Class>( it->second, class_xp ) ;
468 }
469 out.names() = pnames ;
470 return out ;
471 }
472
473 Rcpp::List getMethods( const XP_Class& class_xp, std::string& buffer){
474 RCPP_DEBUG_MODULE( "Rcpp::List getMethods( const XP_Class& class_xp, std::string& buffer" )
475 #if RCPP_DEBUG_LEVEL > 0
476 Rf_PrintValue( class_xp ) ;
477 #endif
478 size_t n = vec_methods.size() ;
479 Rcpp::CharacterVector mnames(n) ;
480 Rcpp::List res(n) ;
481 typename map_vec_signed_method::iterator it = vec_methods.begin( ) ;
483 for( size_t i=0; i<n; i++, ++it){
484 mnames[i] = it->first ;
485 v = it->second ;
486 res[i] = S4_CppOverloadedMethods<Class>( v , class_xp, it->first.c_str(), buffer ) ;
487 }
488 res.names() = mnames ;
489 return res ;
490 }
491
492 Rcpp::List getConstructors( const XP_Class& class_xp, std::string& buffer){
493 size_t n = constructors.size() ;
494 Rcpp::List out(n) ;
495 typename vec_signed_constructor::iterator it = constructors.begin( ) ;
496 for( size_t i=0; i<n; i++, ++it){
497 out[i] = S4_CppConstructor<Class>( *it , class_xp, name, buffer ) ;
498 }
499 return out ;
500 }
501
503
505
506 self& finalizer( void (*f)(Class*) ){
507 SetFinalizer( new FunctionFinalizer<Class>( f ) ) ;
508 return *this ;
509 }
510
511 virtual void run_finalizer( SEXP object ){
512 finalizer_pointer->run( XP(object) ) ;
513 }
514
516 self* ptr = get_instance() ;
517 if( ptr->finalizer_pointer ) delete ptr->finalizer_pointer ;
518 ptr->finalizer_pointer = f ;
519 }
520
523
529 std::string typeinfo_name ;
530
531
532 class_( ) : class_Base(), vec_methods(), properties(), specials(0), constructors(), factories() {};
533
534
535 public:
536
537 template <typename PARENT>
538 self& derives( const char* parent ){
539 typedef class_<PARENT> parent_class_ ;
540 typedef typename parent_class_::signed_method_class parent_signed_method_class ;
541 typedef typename parent_class_::method_class parent_method_class ;
542
543 Module* scope = getCurrentScope() ;
544 parent_class_* parent_class_pointer = reinterpret_cast< parent_class_* > ( scope->get_class_pointer( parent ) );
545
546 // importing methods
547 typename parent_class_::map_vec_signed_method::iterator parent_vec_methods_iterator = parent_class_pointer->vec_methods.begin() ;
548 typename parent_class_::map_vec_signed_method::iterator parent_vec_methods_end = parent_class_pointer->vec_methods.end() ;
549 std::string method_name ;
550 for( ; parent_vec_methods_iterator != parent_vec_methods_end; parent_vec_methods_iterator++){
551 method_name = parent_vec_methods_iterator->first ;
552
553 typedef typename parent_class_::vec_signed_method parent_vec_signed_method ;
554 parent_vec_signed_method* p_methods = parent_vec_methods_iterator->second ;
555 typename parent_vec_signed_method::iterator methods_it = p_methods->begin() ;
556 typename parent_vec_signed_method::iterator methods_end = p_methods->end() ;
557
558 for( ; methods_it != methods_end; methods_it++){
559 parent_signed_method_class* signed_method = *methods_it ;
560 parent_method_class* parent_method = signed_method->method ;
561
562 CppMethod<Class>* method = new CppInheritedMethod<Class,PARENT>( parent_method ) ;
563
564 AddMethod( method_name.c_str(), method, signed_method->valid , signed_method->docstring.c_str() ) ;
565 }
566 }
567
568
569 // importing properties
570 typedef typename parent_class_::PROPERTY_MAP parent_PROPERTY_MAP ;
571 typedef typename parent_PROPERTY_MAP::iterator parent_PROPERTY_MAP_iterator ;
572
573 parent_PROPERTY_MAP_iterator parent_property_it = parent_class_pointer->properties.begin() ;
574 parent_PROPERTY_MAP_iterator parent_property_end = parent_class_pointer->properties.end() ;
575 for( ; parent_property_it != parent_property_end; parent_property_it++){
577 parent_property_it->first.c_str(),
578 new CppInheritedProperty<Class,PARENT>( parent_property_it->second )
579 ) ;
580 }
581
582 std::string buffer( "Rcpp_" ) ; buffer += parent ;
583 get_instance()->parents.push_back( buffer.c_str() ) ;
584 return *this ;
585 }
586
587
588 } ;
589
590#endif
R_xlen_t size() const
Definition Vector.h:275
iterator begin()
Definition Vector.h:333
static Vector create()
Definition Vector.h:1121
Definition class.h:25
void SetFinalizer(finalizer_class *f)
Definition class.h:515
SignedMethod< Class > signed_method_class
Definition class.h:30
std::map< std::string, prop_class * > PROPERTY_MAP
Definition class.h:50
self & AddConstructor(constructor_class *ctor, ValidConstructor valid, const char *docstring=0)
Definition class.h:99
vec_signed_constructor constructors
Definition class.h:526
SEXP invoke_notvoid(SEXP method_xp, SEXP object, SEXP *args, int nargs)
Definition class.h:228
SignedFactory< Class > signed_factory_class
Definition class.h:46
CppFinalizer< Class > finalizer_class
Definition class.h:39
Factory_Base< Class > factory_class
Definition class.h:45
bool has_method(const std::string &m)
Definition class.h:310
std::map< std::string, method_class * > METHOD_MAP
Definition class.h:35
class_< Class > self
Definition class.h:27
Rcpp::List property_classes()
Definition class.h:406
class_()
Definition class.h:532
std::map< std::string, vec_signed_method * > map_vec_signed_method
Definition class.h:32
void setProperty(SEXP field_xp, SEXP object, SEXP value)
Definition class.h:452
std::vector< signed_method_class * > vec_signed_method
Definition class.h:31
self * class_pointer
Definition class.h:528
self & finalizer(void(*f)(Class *))
Definition class.h:506
Rcpp::List getConstructors(const XP_Class &class_xp, std::string &buffer)
Definition class.h:492
CppMethod< Class > method_class
Definition class.h:28
virtual void run_finalizer(SEXP object)
Definition class.h:511
self & default_constructor(const char *docstring=0, ValidConstructor valid=&yes_arity< 0 >)
Definition class.h:109
~class_()
Definition class.h:97
Rcpp::List fields(const XP_Class &class_xp)
Definition class.h:460
class_(const char *name_, const char *doc=0)
Definition class.h:53
std::pair< const std::string, method_class * > PAIR
Definition class.h:36
std::string property_class(const std::string &p)
Definition class.h:321
std::pair< std::string, vec_signed_method * > vec_signed_method_pair
Definition class.h:33
Constructor_Base< Class > constructor_class
Definition class.h:41
self & AddFactory(factory_class *fact, ValidConstructor valid, const char *docstring=0)
Definition class.h:104
Rcpp::CharacterVector property_names()
Definition class.h:396
self & derives(const char *parent)
Definition class.h:538
finalizer_class * finalizer_pointer
Definition class.h:524
SEXP invoke(SEXP method_xp, SEXP object, SEXP *args, int nargs)
Definition class.h:179
std::string typeinfo_name
Definition class.h:529
Rcpp::CharacterVector complete()
Definition class.h:419
PROPERTY_MAP properties
Definition class.h:522
Rcpp::LogicalVector methods_voidness()
Definition class.h:371
Rcpp::CharacterVector method_names()
Definition class.h:327
vec_signed_factory factories
Definition class.h:527
SEXP newInstance(SEXP *args, int nargs)
Definition class.h:135
SEXP invoke_void(SEXP method_xp, SEXP object, SEXP *args, int nargs)
Definition class.h:206
std::string get_typeinfo_name()
Definition class.h:131
int specials
Definition class.h:525
Rcpp::List getMethods(const XP_Class &class_xp, std::string &buffer)
Definition class.h:473
std::pair< const std::string, prop_class * > PROP_PAIR
Definition class.h:51
self & AddProperty(const char *name_, prop_class *p)
Definition class.h:263
SEXP getProperty(SEXP field_xp, SEXP object)
Definition class.h:445
bool property_is_readonly(const std::string &p)
Definition class.h:316
bool has_property(const std::string &m)
Definition class.h:313
CppProperty< Class > prop_class
Definition class.h:49
map_vec_signed_method vec_methods
Definition class.h:521
self & AddMethod(const char *name_, method_class *m, ValidMethod valid=&yes, const char *docstring=0)
Definition class.h:251
self * get_instance()
Definition class.h:69
SignedConstructor< Class > signed_constructor_class
Definition class.h:42
std::vector< signed_constructor_class * > vec_signed_constructor
Definition class.h:43
std::vector< signed_factory_class * > vec_signed_factory
Definition class.h:47
Rcpp::XPtr< Class > XP
Definition class.h:38
Rcpp::IntegerVector methods_arity()
Definition class.h:347
bool has_default_constructor()
Definition class.h:163
#define RCPP_DEBUG_MODULE_1(fmt, MSG)
Definition debug.h:102
#define RCPP_DEBUG_MODULE(MSG)
Definition debug.h:101
#define RCPP_DEBUG_MODULE_2(fmt, M1, M2)
Definition debug.h:103
#define DEMANGLE(__TYPE__)
Definition exceptions.h:382
#define END_RCPP
Definition macros.h:99
#define VOID_END_RCPP
Definition macros.h:60
#define BEGIN_RCPP
Definition macros.h:49
bool(* ValidMethod)(SEXP *, int)
Definition Module.h:262
attribute_hidden Rcpp::Module * getCurrentScope()
Definition routines.h:270