Rcpp Version 0.12.12
class.h
Go to the documentation of this file.
1 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2 //
3 // class.h: Rcpp R/C++ interface class library -- Rcpp modules
4 //
5 // Copyright (C) 2012 - 2013 Dirk Eddelbuettel and Romain Francois
6 //
7 // This file is part of Rcpp.
8 //
9 // Rcpp is free software: you can redistribute it and/or modify it
10 // under the terms of the GNU General Public License as published by
11 // the Free Software Foundation, either version 2 of the License, or
12 // (at your option) any later version.
13 //
14 // Rcpp is distributed in the hope that it will be useful, but
15 // WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
21 
22 #ifndef Rcpp_Module_CLASS_h
23 #define Rcpp_Module_CLASS_h
24 
25  template <typename Class>
26  class class_ : public class_Base {
27  public:
28  typedef class_<Class> self ;
29  typedef CppMethod<Class> method_class ;
30 
31  typedef SignedMethod<Class> signed_method_class ;
32  typedef std::vector<signed_method_class*> vec_signed_method ;
33  typedef std::map<std::string,vec_signed_method*> map_vec_signed_method ;
34  typedef std::pair<std::string,vec_signed_method*> vec_signed_method_pair ;
35 
36  typedef std::map<std::string,method_class*> METHOD_MAP ;
37  typedef std::pair<const std::string,method_class*> PAIR ;
38 
40  typedef CppFinalizer<Class> finalizer_class ;
41 
42  typedef Constructor_Base<Class> constructor_class ;
43  typedef SignedConstructor<Class> signed_constructor_class ;
44  typedef std::vector<signed_constructor_class*> vec_signed_constructor ;
45 
46  typedef Factory_Base<Class> factory_class ;
47  typedef SignedFactory<Class> signed_factory_class ;
48  typedef std::vector<signed_factory_class*> vec_signed_factory ;
49 
50  typedef CppProperty<Class> prop_class ;
51  typedef std::map<std::string,prop_class*> PROPERTY_MAP ;
52  typedef std::pair<const std::string,prop_class*> PROP_PAIR ;
53 
54  class_( const char* name_, const char* doc = 0) :
55  class_Base(name_, doc),
56  vec_methods(),
57  properties(),
59  specials(0),
60  constructors(),
61  factories(),
62  class_pointer(0),
63  typeinfo_name("")
64  {
66  }
67 
68  private:
69 
70  self* get_instance() {
71 
72  // check if we already have it
73  if( class_pointer ) {
74  RCPP_DEBUG_MODULE_2( "class_<%s>::get_instance(). [cached] class_pointer = <%p>\n", DEMANGLE(Class), class_pointer ) ;
75  return class_pointer ;
76  }
77 
78  // check if it exists in the module
79  Module* module = getCurrentScope() ;
80  if( module->has_class(name) ){
81  RCPP_DEBUG_MODULE_2( "class_<%s>::get_instance(). [from module] class_pointer = class_pointer\n", DEMANGLE(Class), class_pointer ) ;
82  class_pointer = dynamic_cast<self*>( module->get_class_pointer(name) ) ;
83  } else {
84  class_pointer = new self ;
85  class_pointer->name = name ;
86  class_pointer->docstring = docstring ;
88  class_pointer->typeinfo_name = typeid(Class).name() ;
89  module->AddClass( name.c_str(), class_pointer ) ;
90  RCPP_DEBUG_MODULE_2( "class_<%s>::get_instance(). [freshly created] class_pointer = class_pointer\n", DEMANGLE(Class), class_pointer ) ;
91 
92  }
93  return class_pointer ;
94  }
95 
96  public:
97 
98  ~class_(){}
99 
100  self& AddConstructor( constructor_class* ctor, ValidConstructor valid, const char* docstring = 0 ){
101  class_pointer->constructors.push_back( new signed_constructor_class( ctor, valid, docstring ) );
102  return *this ;
103  }
104 
105  self& AddFactory( factory_class* fact, ValidConstructor valid, const char* docstring = 0 ){
106  class_pointer->factories.push_back( new signed_factory_class( fact, valid, docstring ) ) ;
107  return *this ;
108  }
109 
110  self& default_constructor( const char* docstring= 0, ValidConstructor valid = &yes_arity<0> ){
111  return constructor( docstring, valid ) ;
112  }
113 
114 #include <Rcpp/module/Module_generated_class_constructor.h>
115 #include <Rcpp/module/Module_generated_class_factory.h>
116 
117  public:
118 
119  std::string get_typeinfo_name(){
120  return typeinfo_name ;
121  }
122 
123  SEXP newInstance( SEXP* args, int nargs ){
124  BEGIN_RCPP
125  signed_constructor_class* p ;
126  int n = constructors.size() ;
127  for( int i=0; i<n; i++ ){
128  p = constructors[i];
129  bool ok = (p->valid)(args, nargs) ;
130  if( ok ){
131  Class* ptr = p->ctor->get_new( args, nargs ) ;
132  return XP( ptr, true ) ;
133  }
134  }
135 
136  signed_factory_class* pfact ;
137  n = factories.size() ;
138  for( int i=0; i<n; i++){
139  pfact = factories[i] ;
140  bool ok = (pfact->valid)(args, nargs) ;
141  if( ok ){
142  Class* ptr = pfact->fact->get_new( args, nargs ) ;
143  return XP( ptr, true ) ;
144  }
145  }
146 
147  throw std::range_error( "no valid constructor available for the argument list" ) ;
148  END_RCPP
149  }
150 
152  int n = constructors.size() ;
153  signed_constructor_class* p ;
154  for( int i=0; i<n; i++ ){
155  p = constructors[i];
156  if( p->nargs() == 0 ) return true ;
157  }
158  n = factories.size() ;
159  signed_factory_class* pfact ;
160  for( int i=0; i<n; i++ ){
161  pfact = factories[i];
162  if( pfact->nargs() == 0 ) return true ;
163  }
164  return false ;
165  }
166 
167  SEXP invoke( SEXP method_xp, SEXP object, SEXP *args, int nargs ){
168  BEGIN_RCPP
169 
170  vec_signed_method* mets = reinterpret_cast< vec_signed_method* >( EXTPTR_PTR( method_xp ) ) ;
171  typename vec_signed_method::iterator it = mets->begin() ;
172  int n = mets->size() ;
173  method_class* m = 0 ;
174  bool ok = false ;
175  for( int i=0; i<n; i++, ++it ){
176  if( ( (*it)->valid )( args, nargs) ){
177  m = (*it)->method ;
178  ok = true ;
179  break ;
180  }
181  }
182  if( !ok ){
183  throw std::range_error( "could not find valid method" ) ;
184  }
185  if( m->is_void() ){
186  m->operator()( XP(object), args );
187  return Rcpp::List::create( true ) ;
188  } else {
189  return Rcpp::List::create( false, m->operator()( XP(object), args ) ) ;
190  }
191  END_RCPP
192  }
193 
194  SEXP invoke_void( SEXP method_xp, SEXP object, SEXP *args, int nargs ){
195  BEGIN_RCPP
196 
197  vec_signed_method* mets = reinterpret_cast< vec_signed_method* >( EXTPTR_PTR( method_xp ) ) ;
198  typename vec_signed_method::iterator it = mets->begin() ;
199  int n = mets->size() ;
200  method_class* m = 0 ;
201  bool ok = false ;
202  for( int i=0; i<n; i++, ++it ){
203  if( ( (*it)->valid )( args, nargs) ){
204  m = (*it)->method ;
205  ok = true ;
206  break ;
207  }
208  }
209  if( !ok ){
210  throw std::range_error( "could not find valid method" ) ;
211  }
212  m->operator()( XP(object), args );
213  END_RCPP
214  }
215 
216  SEXP invoke_notvoid( SEXP method_xp, SEXP object, SEXP *args, int nargs ){
217  BEGIN_RCPP
218 
219  vec_signed_method* mets = reinterpret_cast< vec_signed_method* >( EXTPTR_PTR( method_xp ) ) ;
220  typename vec_signed_method::iterator it = mets->begin() ;
221  int n = mets->size() ;
222  method_class* m = 0 ;
223  bool ok = false ;
224  for( int i=0; i<n; i++, ++it ){
225  if( ( (*it)->valid )( args, nargs) ){
226  m = (*it)->method ;
227  ok = true ;
228  break ;
229  }
230  }
231  if( !ok ){
232  throw std::range_error( "could not find valid method" ) ;
233  }
234  return m->operator()( XP(object), args ) ;
235  END_RCPP
236  }
237 
238 
239  self& AddMethod( const char* name_, method_class* m, ValidMethod valid = &yes, const char* docstring = 0){
240  RCPP_DEBUG_MODULE_1( "AddMethod( %s, method_class* m, ValidMethod valid = &yes, const char* docstring = 0", name_ )
241  self* ptr = get_instance() ;
242  typename map_vec_signed_method::iterator it = ptr->vec_methods.find( name_ ) ;
243  if( it == ptr->vec_methods.end() ){
244  it = ptr->vec_methods.insert( vec_signed_method_pair( name_, new vec_signed_method() ) ).first ;
245  }
246  (it->second)->push_back( new signed_method_class(m, valid, docstring ) ) ;
247  if( *name_ == '[' ) ptr->specials++ ;
248  return *this ;
249  }
250 
251  self& AddProperty( const char* name_, prop_class* p){
252  get_instance()->properties.insert( PROP_PAIR( name_, p ) ) ;
253  return *this ;
254  }
255 
256 #include <Rcpp/module/Module_generated_method.h>
257 #include <Rcpp/module/Module_generated_Pointer_method.h>
258 
259  bool has_method( const std::string& m){
260  return vec_methods.find(m) != vec_methods.end() ;
261  }
262  bool has_property( const std::string& m){
263  return properties.find(m) != properties.end() ;
264  }
265  bool property_is_readonly( const std::string& p) {
266  typename PROPERTY_MAP::iterator it = properties.find( p ) ;
267  if( it == properties.end() ) throw std::range_error( "no such property" ) ;
268  return it->second->is_readonly() ;
269  }
270  std::string property_class(const std::string& p) {
271  typename PROPERTY_MAP::iterator it = properties.find( p ) ;
272  if( it == properties.end() ) throw std::range_error( "no such property" ) ;
273  return it->second->get_class() ;
274  }
275 
277  int n = 0 ;
278  int s = vec_methods.size() ;
279  typename map_vec_signed_method::iterator it = vec_methods.begin( ) ;
280  for( int i=0; i<s; i++, ++it){
281  n += (it->second)->size() ;
282  }
283  Rcpp::CharacterVector out(n) ;
284  it = vec_methods.begin() ;
285  int k = 0 ;
286  for( int i=0; i<s; i++, ++it){
287  n = (it->second)->size() ;
288  std::string name = it->first ;
289  for( int j=0; j<n; j++, k++){
290  out[k] = name ;
291  }
292  }
293  return out ;
294  }
295 
297  int n = 0 ;
298  int s = vec_methods.size() ;
299  typename map_vec_signed_method::iterator it = vec_methods.begin( ) ;
300  for( int i=0; i<s; i++, ++it){
301  n += (it->second)->size() ;
302  }
303  Rcpp::CharacterVector mnames(n) ;
304  Rcpp::IntegerVector res(n) ;
305  it = vec_methods.begin() ;
306  int k = 0 ;
307  for( int i=0; i<s; i++, ++it){
308  n = (it->second)->size() ;
309  std::string name = it->first ;
310  typename vec_signed_method::iterator m_it = (it->second)->begin() ;
311  for( int j=0; j<n; j++, k++, ++m_it){
312  mnames[k] = name ;
313  res[k] = (*m_it)->nargs() ;
314  }
315  }
316  res.names( ) = mnames ;
317  return res ;
318  }
319 
321  int n = 0 ;
322  int s = vec_methods.size() ;
323  typename map_vec_signed_method::iterator it = vec_methods.begin( ) ;
324  for( int i=0; i<s; i++, ++it){
325  n += (it->second)->size() ;
326  }
327  Rcpp::CharacterVector mnames(n) ;
328  Rcpp::LogicalVector res(n) ;
329  it = vec_methods.begin() ;
330  int k = 0 ;
331  for( int i=0; i<s; i++, ++it){
332  n = (it->second)->size() ;
333  std::string name = it->first ;
334  typename vec_signed_method::iterator m_it = (it->second)->begin() ;
335  for( int j=0; j<n; j++, k++, ++m_it){
336  mnames[k] = name ;
337  res[k] = (*m_it)->is_void() ;
338  }
339  }
340  res.names( ) = mnames ;
341  return res ;
342  }
343 
344 
346  int n = properties.size() ;
347  Rcpp::CharacterVector out(n) ;
348  typename PROPERTY_MAP::iterator it = properties.begin( ) ;
349  for( int i=0; i<n; i++, ++it){
350  out[i] = it->first ;
351  }
352  return out ;
353  }
354 
356  int n = properties.size() ;
357  Rcpp::CharacterVector pnames(n) ;
358  Rcpp::List out(n) ;
359  typename PROPERTY_MAP::iterator it = properties.begin( ) ;
360  for( int i=0; i<n; i++, ++it){
361  pnames[i] = it->first ;
362  out[i] = it->second->get_class() ;
363  }
364  out.names() = pnames ;
365  return out ;
366  }
367 
369  int n = vec_methods.size() - specials ;
370  int ntotal = n + properties.size() ;
371  Rcpp::CharacterVector out(ntotal) ;
372  typename map_vec_signed_method::iterator it = vec_methods.begin( ) ;
373  std::string buffer ;
374  int i=0 ;
375  for( ; i<n; ++it){
376  buffer = it->first ;
377  if( buffer[0] == '[' ) continue ;
378  // if( (it->second)->nargs() == 0){
379  // buffer += "() " ;
380  // } else {
381  // buffer += "( " ;
382  // }
383  buffer += "( " ;
384  out[i] = buffer ;
385  i++ ;
386  }
387  typename PROPERTY_MAP::iterator prop_it = properties.begin();
388  for( ; i<ntotal; i++, ++prop_it){
389  out[i] = prop_it->first ;
390  }
391  return out ;
392  }
393 
394  SEXP getProperty( SEXP field_xp , SEXP object) {
395  BEGIN_RCPP
396  prop_class* prop = reinterpret_cast< prop_class* >( EXTPTR_PTR( field_xp ) ) ;
397  return prop->get( XP(object) );
398  END_RCPP
399  }
400 
401  void setProperty( SEXP field_xp, SEXP object, SEXP value) {
402  BEGIN_RCPP
403  prop_class* prop = reinterpret_cast< prop_class* >( EXTPTR_PTR( field_xp ) ) ;
404  return prop->set( XP(object), value );
406  }
407 
408 
409  Rcpp::List fields( const XP_Class& class_xp ){
410  int n = properties.size() ;
411  Rcpp::CharacterVector pnames(n) ;
412  Rcpp::List out(n) ;
413  typename PROPERTY_MAP::iterator it = properties.begin( ) ;
414  for( int i=0; i<n; i++, ++it){
415  pnames[i] = it->first ;
416  out[i] = S4_field<Class>( it->second, class_xp ) ;
417  }
418  out.names() = pnames ;
419  return out ;
420  }
421 
422  Rcpp::List getMethods( const XP_Class& class_xp, std::string& buffer){
423  RCPP_DEBUG_MODULE( "Rcpp::List getMethods( const XP_Class& class_xp, std::string& buffer" )
424  #if RCPP_DEBUG_LEVEL > 0
425  Rf_PrintValue( class_xp ) ;
426  #endif
427  int n = vec_methods.size() ;
428  Rcpp::CharacterVector mnames(n) ;
429  Rcpp::List res(n) ;
430  typename map_vec_signed_method::iterator it = vec_methods.begin( ) ;
431  vec_signed_method* v;
432  for( int i=0; i<n; i++, ++it){
433  mnames[i] = it->first ;
434  v = it->second ;
435  res[i] = S4_CppOverloadedMethods<Class>( v , class_xp, it->first.c_str(), buffer ) ;
436  }
437  res.names() = mnames ;
438  return res ;
439  }
440 
441  Rcpp::List getConstructors( const XP_Class& class_xp, std::string& buffer){
442  int n = constructors.size() ;
443  Rcpp::List out(n) ;
444  typename vec_signed_constructor::iterator it = constructors.begin( ) ;
445  for( int i=0; i<n; i++, ++it){
446  out[i] = S4_CppConstructor<Class>( *it , class_xp, name, buffer ) ;
447  }
448  return out ;
449  }
450 
452 
454 
455  self& finalizer( void (*f)(Class*) ){
456  SetFinalizer( new FunctionFinalizer<Class>( f ) ) ;
457  return *this ;
458  }
459 
460  virtual void run_finalizer( SEXP object ){
461  finalizer_pointer->run( XP(object) ) ;
462  }
463 
464  void SetFinalizer( finalizer_class* f ){
465  self* ptr = get_instance() ;
466  if( ptr->finalizer_pointer ) delete ptr->finalizer_pointer ;
467  ptr->finalizer_pointer = f ;
468  }
469 
470  map_vec_signed_method vec_methods ;
471  PROPERTY_MAP properties ;
472 
473  finalizer_class* finalizer_pointer ;
474  int specials ;
475  vec_signed_constructor constructors ;
476  vec_signed_factory factories ;
478  std::string typeinfo_name ;
479 
480 
481  class_( ) : class_Base(), vec_methods(), properties(), specials(0), constructors(), factories() {};
482 
483 
484  public:
485 
486  template <typename PARENT>
487  self& derives( const char* parent ){
488  typedef class_<PARENT> parent_class_ ;
489  typedef typename parent_class_::signed_method_class parent_signed_method_class ;
490  typedef typename parent_class_::method_class parent_method_class ;
491 
492  Module* scope = getCurrentScope() ;
493  parent_class_* parent_class_pointer = reinterpret_cast< parent_class_* > ( scope->get_class_pointer( parent ) );
494 
495  // importing methods
496  typename parent_class_::map_vec_signed_method::iterator parent_vec_methods_iterator = parent_class_pointer->vec_methods.begin() ;
497  typename parent_class_::map_vec_signed_method::iterator parent_vec_methods_end = parent_class_pointer->vec_methods.end() ;
498  std::string method_name ;
499  for( ; parent_vec_methods_iterator != parent_vec_methods_end; parent_vec_methods_iterator++){
500  method_name = parent_vec_methods_iterator->first ;
501 
502  typedef typename parent_class_::vec_signed_method parent_vec_signed_method ;
503  parent_vec_signed_method* p_methods = parent_vec_methods_iterator->second ;
504  typename parent_vec_signed_method::iterator methods_it = p_methods->begin() ;
505  typename parent_vec_signed_method::iterator methods_end = p_methods->end() ;
506 
507  for( ; methods_it != methods_end; methods_it++){
508  parent_signed_method_class* signed_method = *methods_it ;
509  parent_method_class* parent_method = signed_method->method ;
510 
511  CppMethod<Class>* method = new CppInheritedMethod<Class,PARENT>( parent_method ) ;
512 
513  AddMethod( method_name.c_str(), method, signed_method->valid , signed_method->docstring.c_str() ) ;
514  }
515  }
516 
517 
518  // importing properties
519  typedef typename parent_class_::PROPERTY_MAP parent_PROPERTY_MAP ;
520  typedef typename parent_PROPERTY_MAP::iterator parent_PROPERTY_MAP_iterator ;
521 
522  parent_PROPERTY_MAP_iterator parent_property_it = parent_class_pointer->properties.begin() ;
523  parent_PROPERTY_MAP_iterator parent_property_end = parent_class_pointer->properties.end() ;
524  for( ; parent_property_it != parent_property_end; parent_property_it++){
525  AddProperty(
526  parent_property_it->first.c_str(),
527  new CppInheritedProperty<Class,PARENT>( parent_property_it->second )
528  ) ;
529  }
530 
531  std::string buffer( "Rcpp_" ) ; buffer += parent ;
532  get_instance()->parents.push_back( buffer.c_str() ) ;
533  return *this ;
534  }
535 
536 
537  } ;
538 
539 #endif
CppProperty< Class > prop_class
Definition: class.h:50
bool has_property(const std::string &m)
Definition: class.h:262
std::string property_class(const std::string &p)
Definition: class.h:270
SignedFactory< Class > signed_factory_class
Definition: class.h:47
Rcpp::CharacterVector method_names()
Definition: class.h:276
SEXP invoke_void(SEXP method_xp, SEXP object, SEXP *args, int nargs)
Definition: class.h:194
vec_signed_constructor constructors
Definition: class.h:475
#define RCPP_DEBUG_MODULE_1(fmt, MSG)
Definition: debug.h:102
self & finalizer(void(*f)(Class *))
Definition: class.h:455
bool has_method(const std::string &m)
Definition: class.h:259
std::map< std::string, vec_signed_method * > map_vec_signed_method
Definition: class.h:33
PROPERTY_MAP properties
Definition: class.h:471
std::pair< const std::string, prop_class * > PROP_PAIR
Definition: class.h:52
#define RCPP_DEBUG_MODULE_2(fmt, M1, M2)
Definition: debug.h:103
Rcpp::XPtr< Class > XP
Definition: class.h:39
Rcpp::List getMethods(const XP_Class &class_xp, std::string &buffer)
Definition: class.h:422
#define DEMANGLE(__TYPE__)
Definition: exceptions.h:315
std::pair< std::string, vec_signed_method * > vec_signed_method_pair
Definition: class.h:34
std::string typeinfo_name
Definition: class.h:478
vec_signed_factory factories
Definition: class.h:476
Rcpp::IntegerVector methods_arity()
Definition: class.h:296
NamesProxy names()
Definition: NamesProxy.h:80
self & default_constructor(const char *docstring=0, ValidConstructor valid=&yes_arity< 0 >)
Definition: class.h:110
Rcpp::CharacterVector property_names()
Definition: class.h:345
void SetFinalizer(finalizer_class *f)
Definition: class.h:464
~class_()
Definition: class.h:98
Rcpp::List getConstructors(const XP_Class &class_xp, std::string &buffer)
Definition: class.h:441
#define BEGIN_RCPP
Definition: macros.h:30
Factory_Base< Class > factory_class
Definition: class.h:46
class_()
Definition: class.h:481
SEXP invoke(SEXP method_xp, SEXP object, SEXP *args, int nargs)
Definition: class.h:167
class_< Class > self
Definition: class.h:28
bool(* ValidMethod)(SEXP *, int)
Definition: Module.h:140
CppFinalizer< Class > finalizer_class
Definition: class.h:40
self & AddFactory(factory_class *fact, ValidConstructor valid, const char *docstring=0)
Definition: class.h:105
self & AddProperty(const char *name_, prop_class *p)
Definition: class.h:251
map_vec_signed_method vec_methods
Definition: class.h:470
Definition: class.h:26
static Vector create()
Definition: Vector.h:1117
SEXP invoke_notvoid(SEXP method_xp, SEXP object, SEXP *args, int nargs)
Definition: class.h:216
#define RCPP_DEBUG_MODULE(MSG)
Definition: debug.h:101
CppMethod< Class > method_class
Definition: class.h:29
int specials
Definition: class.h:474
Rcpp::CharacterVector complete()
Definition: class.h:368
SignedConstructor< Class > signed_constructor_class
Definition: class.h:43
#define END_RCPP
Definition: macros.h:67
std::string get_typeinfo_name()
Definition: class.h:119
self * get_instance()
Definition: class.h:70
Rcpp::List property_classes()
Definition: class.h:355
std::map< std::string, prop_class * > PROPERTY_MAP
Definition: class.h:51
virtual void run_finalizer(SEXP object)
Definition: class.h:460
SignedMethod< Class > signed_method_class
Definition: class.h:31
self & AddMethod(const char *name_, method_class *m, ValidMethod valid=&yes, const char *docstring=0)
Definition: class.h:239
#define VOID_END_RCPP
Definition: macros.h:39
SEXP getProperty(SEXP field_xp, SEXP object)
Definition: class.h:394
bool has_default_constructor()
Definition: class.h:151
attribute_hidden Rcpp::Module * getCurrentScope()
Definition: routines.h:212
std::pair< const std::string, method_class * > PAIR
Definition: class.h:37
class_(const char *name_, const char *doc=0)
Definition: class.h:54
StretchyList_Impl & push_back(const T &obj)
Definition: StretchyList.h:58
std::vector< signed_constructor_class * > vec_signed_constructor
Definition: class.h:44
self * class_pointer
Definition: class.h:477
finalizer_class * finalizer_pointer
Definition: class.h:473
std::vector< signed_method_class * > vec_signed_method
Definition: class.h:32
std::map< std::string, method_class * > METHOD_MAP
Definition: class.h:36
std::vector< signed_factory_class * > vec_signed_factory
Definition: class.h:48
void setProperty(SEXP field_xp, SEXP object, SEXP value)
Definition: class.h:401
self & derives(const char *parent)
Definition: class.h:487
bool(* ValidConstructor)(SEXP *, int)
Definition: Module.h:139
Rcpp::LogicalVector methods_voidness()
Definition: class.h:320
Environment_Impl parent() const
Definition: Environment.h:387
Rcpp::List fields(const XP_Class &class_xp)
Definition: class.h:409
bool property_is_readonly(const std::string &p)
Definition: class.h:265
Constructor_Base< Class > constructor_class
Definition: class.h:42
SEXP newInstance(SEXP *args, int nargs)
Definition: class.h:123
self & AddConstructor(constructor_class *ctor, ValidConstructor valid, const char *docstring=0)
Definition: class.h:100