<div dir="ltr">I'm sure it's possible to do from the R side, however, the requirement is to hide this from the end user and set the reference objects name to the declared name from the R environment. If I view the environment in RStudio, there is much more information available. ls() only returns a list of objects by their declared name. I'm wondering how to get more details about elements in the environment.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 23, 2023 at 6:03 PM Dirk Eddelbuettel <<a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
On 22 March 2023 at 13:31, Matthew Supernaw - NOAA Federal wrote:<br>
| I'm trying to get an instance of a reference class (vonBertalanffyInterface)<br>
| from the R environment with the following code:<br>
| <br>
| void SetName(vonBertalanffyInterface& v) {<br>
| <br>
| Rcpp::Environment env = Rcpp::Environment::global_env();<br>
| Rcpp::List l = Rcpp::as<Rcpp::List>(<a href="http://env.ls" rel="noreferrer" target="_blank">env.ls</a>(true));<br>
| <br>
| for (int i = 0; i < l.size(); i++) {<br>
| std::cout << typeid (l[i]).name() << std::endl;<br>
| <br>
| if(&v == l[i].get()){<br>
| <a href="http://v.name" rel="noreferrer" target="_blank">v.name</a> Rcpp::as<std::string>(l[i]);<br>
| }<br>
| }<br>
| }<br>
| <br>
| The problem is that elements in the list are of type <br>
| N4Rcpp8internal13generic_proxyILi19ENS_15PreserveStorageEEE.<br>
| <br>
| I'm assuming that PreserveStorage is a wrapper class. Is there a way to<br>
| retrieve the reference class from the PreserveStorage object?<br>
<br>
Interesting question. Can you do it in plain R (once you created the object) ?<br>
<br>
Dirk<br>
<br>
-- <br>
<a href="http://dirk.eddelbuettel.com" rel="noreferrer" target="_blank">dirk.eddelbuettel.com</a> | @eddelbuettel | <a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a><br>
</blockquote></div><br clear="all"><div><br></div><span>-- </span><br><div dir="ltr"><div dir="ltr"><div>Matthew Supernaw<br><i><font color="#666666">Scientific Software Developer</font></i></div><div><span style="line-height:16px;font-family:arial,sans-serif"><em><font color="#666666">National Oceanic and Atmospheric Administration</font></em></span></div><div><i><font face="arial, sans-serif" color="#666666">Office Of Science and Technology</font></i></div><div><font color="#666666"><i><font face="arial, sans-serif">NOAA Fisheries | </font></i><span style="font-family:Arial;font-size:13.3333px;white-space:pre-wrap">U.S. Department of Commerce</span></font></div><div><font color="#666666">Phone 248 - 396 - 7797</font><br><br></div><br></div></div>