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

Function RCPP_MODULE

inst/tinytest/cpp/Module.cpp:139–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139RCPP_MODULE(demoModule) {
140 function("hello", &hello);
141 function("bar" , &bar );
142 function("foo" , &foo );
143 function("bla" , &bla );
144 function("bla1" , &bla1 );
145 function("bla2" , &bla2 );
146
147 function("test_reference", test_reference);
148 function("test_const_reference", test_const_reference);
149 function("test_const", test_const);
150
151 class_<ModuleTest>("ModuleTest")
152 .constructor<double>()
153 ;
154
155 class_<ModuleWorld>("ModuleWorld")
156 .constructor()
157 .method("greet", &ModuleWorld::greet)
158 .method("set", &ModuleWorld::set)
159 .method("set_ref", &ModuleWorld::set_ref)
160 .method("set_const_ref", &ModuleWorld::set_const_ref)
161 .method("clear", &clearWorld)
162 ;
163
164 class_<ModuleNum>("ModuleNum")
165 .constructor()
166
167 // read and write property
168 .property("x", &ModuleNum::getX, &ModuleNum::setX)
169
170 // read-only property
171 .property("y", &ModuleNum::getY)
172 ;
173
174 class_<ModuleNumber>("ModuleNumber")
175
176 .constructor()
177
178 // read and write data member
179 .field("x", &ModuleNumber::x)
180
181 // read only data member
182 .field_readonly("y", &ModuleNumber::y)
183 ;
184
185 function("Test_get_x_const_ref", Test_get_x_const_ref);
186 function("Test_get_x_ref", Test_get_x_ref);
187 function("Test_get_x_const_pointer", Test_get_x_const_pointer);
188 function("Test_get_x_pointer", Test_get_x_pointer);
189
190
191 class_<ModuleRandomizer>("ModuleRandomizer")
192 // No default: .default_constructor()
193 .constructor<double,double>()
194
195 .method("get" , &ModuleRandomizer::get)
196 ;

Callers

nothing calls this directly

Calls 2

functionFunction · 0.85
fieldMethod · 0.80

Tested by

no test coverage detected