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

Class class_

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

Source from the content-addressed store, hash-verified

23
24 template <typename Class>
25 class class_ : public class_Base {
26 public:
27 typedef class_<Class> self ;
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
38 typedef Rcpp::XPtr<Class> XP ;
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),
55 vec_methods(),
56 properties(),
57 finalizer_pointer(0),
58 specials(0),
59 constructors(),
60 factories(),
61 class_pointer(0),
62 typeinfo_name("")
63 {
64 class_pointer = get_instance() ;
65 }
66
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 {

Callers

nothing calls this directly

Calls 6

getCurrentScopeFunction · 0.85
get_class_pointerMethod · 0.80
push_backMethod · 0.45
endMethod · 0.45
insertMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected