Re: [Rcpp-devel] Locating an Instance of a Reference Class in the Environment

2023-03-24 Thread Matthew Supernaw - NOAA Federal
of objects by their declared name. I'm wondering how to get more details about elements in the environment. On Thu, Mar 23, 2023 at 6:03 PM Dirk Eddelbuettel wrote: > > On 22 March 2023 at 13:31, Matthew Supernaw - NOAA Federal wrote: > | I'm trying to get an instance of a refere

Re: [Rcpp-devel] Locating an Instance of a Reference Class in the Environment

2023-03-24 Thread Matthew Supernaw - NOAA Federal
> Rcpp code it needs to, which is why your objection seems inappropriate to > me. > > On March 24, 2023 10:43:34 AM PDT, Dirk Eddelbuettel > wrote: > > > >On 24 March 2023 at 13:08, Matthew Supernaw - NOAA Federal wrote: > >| I'm sure it's possible to do fr

[Rcpp-devel] Locating an Instance of a Reference Class in the Environment

2023-03-22 Thread Matthew Supernaw - NOAA Federal
I'm trying to get an instance of a reference class (vonBertalanffyInterface) from the R environment with the following code: void SetName(vonBertalanffyInterface& v) { Rcpp::Environment env = Rcpp::Environment::global_env(); Rcpp::List l = Rcpp::as(env.ls(true)); for (int i = 0; i <

Re: [Rcpp-devel] Locating an Instance of a Reference Class in the Environment

2023-03-28 Thread Matthew Supernaw - NOAA Federal
ost, but the gist was that anything you have > access to in R can be passed by your R API code to your Rcpp code. Also, > due to R's GC you should usually avoid caching references between calls to > your Rcpp code anyway. > > On March 24, 2023 12:40:43 PM PDT, Matthew Supernaw - NOAA Federal

Re: [Rcpp-devel] Locating an Instance of a Reference Class in the Environment

2023-03-28 Thread Matthew Supernaw - NOAA Federal
Thanks! Working offline would be great! On Tue, Mar 28, 2023 at 11:34 AM Dirk Eddelbuettel wrote: > > Hi Matthew, > > Thanks for circling back! > > On 28 March 2023 at 11:23, Matthew Supernaw - NOAA Federal wrote: > | Hi Dirk, > | Thanks for your attention on this. I was

Re: [Rcpp-devel] Wrapping a c++ class with singleton using RCPP Module

2024-02-21 Thread Matthew Supernaw - NOAA Federal
Looks like I posted too soon. I just noticed the memory address from the "SayHello" function doesn't match. On Wed, Feb 21, 2024 at 10:47 AM Matthew Supernaw - NOAA Federal < matthew.super...@noaa.gov> wrote: > Hi Nikhil, > I'm not exactly sure what you are trying to do,

Re: [Rcpp-devel] Wrapping a c++ class with singleton using RCPP Module

2024-02-21 Thread Matthew Supernaw - NOAA Federal
oWrapper ret(Foo::GetSingleton()); Rcpp::Rcout<<"From \"Foo& GetSingleton()\" -> memory address for singleton is " <("Foo") .constructor() .method("SayHello", ::SayHello); Rcpp::function("GetSingleton", ); } On Wed, Feb 21, 2024 at

Re: [Rcpp-devel] Wrapping a c++ class with singleton using RCPP Module

2024-02-21 Thread Matthew Supernaw - NOAA Federal
Hi Nikhil, I'm not exactly sure what you are trying to do, but I hope this simple example is helpful. Thanks. Matthew #include using namespace Rcpp; class Foo{ public: static Foo* singleton; Foo(){ } void SayHello(){ Rcpp::Rcout << "From \"void SayHello()\" -> "< ";