MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / get_instance

Method get_instance

inst/include/Rcpp/module/class.h:69–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67 private:
68
69 self* get_instance() {
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 ;
86 class_pointer->finalizer_pointer = new finalizer_class ;
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

Callers

nothing calls this directly

Calls 4

getCurrentScopeFunction · 0.85
has_classMethod · 0.80
get_class_pointerMethod · 0.80
AddClassMethod · 0.80

Tested by

no test coverage detected