<br><div class="gmail_quote">Hello<br><div> <br>First thanks Dirk for the quick reply and the hint; Mr. John Chamber's implementation is great! gone through the documentation and followed his instructions. Worked well. Only one way though -- as you pointed out.<br>
</div><div> <br>I was able to get the fields from the extended class; if someone could point into the direction how to get/execute methods of a Reference Class then it may be doable??<br></div><div> <br> ..... c++ class ......<br>
void set_reference( SEXP xptr_){<br> Rcpp::Reference ref(xptr_);<br> ref.field("some_field")); // get the field data<br> <br>// ------- this is not implemented, any hints? -------- <br>
ref.method("some_method")( x, y); // this would be nice to have<br> }<br>...... end .......<br></div><div> <br>setRcppClass("World",<br> module="yada",<br> fields = list( some_field = "character"),<br>
methods = list(<br> initialize = function(){<br> some_field <<- "field value set" <br> callSuper() # call constructor<br> set_reference( .self ) # pass 'this'<br>
}<br></div><div class="h5"> ),saveAs="genWorld" <br>)<br><br><div class="gmail_quote">On Thu, Feb 28, 2013 at 8:15 AM, Dirk Eddelbuettel <span dir="ltr"><<a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
On 28 February 2013 at 04:44, Steven Varga wrote:<br>
| I am trying to create an abstract pattern using R reference objects in C++;<br>
| anyone knows if this is possible/not possible? Where to look?<br>
<br>
</div>I am not sure you can. The best (only ?) relevant documentation might be John<br>
Chamber's example of 'Rcpp Classes' (see help(setRcppClass) in R once Rcpp is<br>
loaded).<br>
<br>
And as I recall, he is pretty explicit that you can take a C++ class and<br>
"extend" it for prototyping from the R side, but that you cannot access those<br>
extended parts from C++ as only R sees it. I think you are hitting a similar<br>
constraint here.<br>
<br>
It would be nice if this worked but I am not quite sure that it can.<br>
<span><font color="#888888"><br>
Dirk<br>
<br>
--<br>
Dirk Eddelbuettel | <a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a> | <a href="http://dirk.eddelbuettel.com" target="_blank">http://dirk.eddelbuettel.com</a><br>
</font></span></blockquote></div><br>
</div></div><br>