Re: [Rcpp-devel] Rcpp-modules trouble on windows

2015-10-27 Thread Dmitriy Selivanov
Finally I caught this issue. My bad - I used `.property` instead of `.method` in RCPP_MODULE macro for function call (forgot to adjust it when changed underlying c++ code). 2015-10-22 11:01 GMT+03:00 Dmitriy Selivanov : > Hi, mailing list! > I have issue with Rcpp modules on *windows only* (don

[Rcpp-devel] Rcpp-modules trouble on windows

2015-10-22 Thread Dmitriy Selivanov
Hi, mailing list! I have issue with Rcpp modules on *windows only* (don't have any problems on linux and osx ). Don't really sure, whether it rcpp-modules related. Problem is following - when I try to get class to global environment - R crashes (actually freezes - cpu core load 100% and nothing h

Re: [Rcpp-devel] Rcpp modules and S3 dispatch on rbind/cbind

2015-01-14 Thread Dirk Eddelbuettel
On 14 January 2015 at 15:00, Louis Aslett wrote: | Sorry hit send prematurely | | Just for the list record I think I've figured this out. It turns out | that there is an S4 approach to this now, whereby one actually sets Sweet, and well done. I had meant to reply and suggest something li

Re: [Rcpp-devel] Rcpp modules and S3 dispatch on rbind/cbind

2015-01-14 Thread Louis Aslett
Sorry hit send prematurely Just for the list record I think I've figured this out. It turns out that there is an S4 approach to this now, whereby one actually sets appropriate methods for the rbind2 and cbind2 functions in the methods package and then call: methods:::bind_activation(on = TR

Re: [Rcpp-devel] Rcpp modules and S3 dispatch on rbind/cbind

2015-01-14 Thread Louis Aslett
Just for the list record I think I've figured this out. It turns out that there is an S4 approach to this now, whereby one actually sets appropriate methods for the rbind2 and cbind2 functions in the methods package and then call: On 12 January 2015 at 13:44, Louis Aslett wrote: > I've encounte

[Rcpp-devel] Rcpp modules and S3 dispatch on rbind/cbind

2015-01-12 Thread Louis Aslett
I've encountered a problem when trying to perform S3 method dispatch for rbind() with an Rcpp module I've written. Obviously Rcpp modules are S4, but as per many Google-able discussions, rbind/cbind can't support S4 method dispatch due to the first argument being a dot-dot-dot one, so S3 on the fi

Re: [Rcpp-devel] Rcpp modules and return_value_policy for exposed C++ member functions

2014-11-10 Thread Dirk Eddelbuettel
On 10 November 2014 at 16:51, Claymore Marshall wrote: | Thank you for the feedback Dirk.  Fair enough. | | I think the issue I have is similar to this (I want to set  StoragePolicy = | false for the XPtr), so I sort of have a work around going: http:// | lists.r-forge.r-project.org/pipermail/rcp

Re: [Rcpp-devel] Rcpp modules and return_value_policy for exposed C++ member functions

2014-11-10 Thread Claymore Marshall
Thank you for the feedback Dirk. Fair enough. I think the issue I have is similar to this (I want to set StoragePolicy = false for the XPtr), so I sort of have a work around going: *http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2013-February/005273.html

Re: [Rcpp-devel] Rcpp modules and return_value_policy for exposed C++ member functions

2014-11-10 Thread Dirk Eddelbuettel
On 10 November 2014 at 13:16, Claymore Marshall wrote: | I want to expose to R several C++ classes from a library with Rcpp modules.  | I'm trying to imitate a similar set of Python modules that were made for the | same library. | | In Boost.Python, with .def it is possible to specify the return_

[Rcpp-devel] Rcpp modules and return_value_policy for exposed C++ member functions

2014-11-10 Thread Claymore Marshall
I want to expose to R several C++ classes from a library with Rcpp modules. I'm trying to imitate a similar set of Python modules that were made for the same library. In Boost.Python, with .def it is possible to specify the return_value_policy. Is it also possible to do this in a straight forwar

Re: [Rcpp-devel] [Rcpp Modules] Static functions

2013-05-09 Thread Romain Francois
This is not supported currently. It might be in the future when someone finds time or funding. One thing that could be done is to create a simple wrapper function around it and expose this with the module. You wont get the associarion with the class though. double wrapper_myFunction(){ r

[Rcpp-devel] [Rcpp Modules] Static functions

2013-05-09 Thread Julien Duvanel
Hello, First of all, thanks for all the Rcpp*. It's very helpful. I have a small question, and I can't (unfortunately) find the answer over the internet. I'm trying to do this : class Foo { public: double static myFunction(); }; And then, use the RCPP_MODULE : RCPP_MODULE(mod_Foo) { class_(

Re: [Rcpp-devel] Rcpp modules and parsing an object back and forth between R & C++

2013-02-24 Thread JJ Allaire
> Unfortunately, at the moment modules and attributes don't play together. > The attributes feature used to be built on top of modules, but this caused > issues on windows. > > One thing we could perhaps negociate with JJ is recognition of the export > attribute on module. Something like : > > // [

Re: [Rcpp-devel] Rcpp modules and parsing an object back and forth between R & C++

2013-02-20 Thread Hadley Wickham
>> Until that happens, is it possible to write my own as and wrap methods? >> > > Sure. > > For as, You can get a Simple* using this: > > Simple* obj = as_module_object(x) ; > > For the details, see as.h, this will call this: > > template object as_module_object(SEXP x){ > retu

Re: [Rcpp-devel] Rcpp modules and parsing an object back and forth between R & C++

2013-02-20 Thread Romain Francois
Le 19/02/13 18:19, Hadley Wickham a écrit : Unfortunately, at the moment modules and attributes don't play together. The attributes feature used to be built on top of modules, but this caused issues on windows. One thing we could perhaps negociate with JJ is recognition of the export attribute o

Re: [Rcpp-devel] Rcpp modules and parsing an object back and forth between R & C++

2013-02-19 Thread Hadley Wickham
> Dirk has an example in the Rcpp gallery -- > http://gallery.rcpp.org/articles/custom-as-and-wrap-example/. Not sure if > you've seen it already, but it might help. Yeah, I've seen it - the problem in my case is understand the structure of the generate ref class so I can automatically generate fr

Re: [Rcpp-devel] Rcpp modules and parsing an object back and forth between R & C++

2013-02-19 Thread Kevin Ushey
Hi Hadley, Dirk has an example in the Rcpp gallery -- http://gallery.rcpp.org/articles/custom-as-and-wrap-example/. Not sure if you've seen it already, but it might help. -Kevin On Tue, Feb 19, 2013 at 9:19 AM, Hadley Wickham wrote: > > Unfortunately, at the moment modules and attributes don't

Re: [Rcpp-devel] Rcpp modules and parsing an object back and forth between R & C++

2013-02-19 Thread Hadley Wickham
> Unfortunately, at the moment modules and attributes don't play together. The > attributes feature used to be built on top of modules, but this caused > issues on windows. > > One thing we could perhaps negociate with JJ is recognition of the export > attribute on module. Something like : > > // [

Re: [Rcpp-devel] Rcpp modules and parsing an object back and forth between R & C++

2013-02-19 Thread Romain Francois
Le 19/02/13 17:21, Hadley Wickham a écrit : Hi all, I'd like to have a simple C++ object that I can work with in either C++ or R. I can create the class, and expose it to R with modules (https://gist.github.com/hadley/4987110), but I don't know how to write the SEXP constructor or SEXP() operat

[Rcpp-devel] Rcpp modules and parsing an object back and forth between R & C++

2013-02-19 Thread Hadley Wickham
Hi all, I'd like to have a simple C++ object that I can work with in either C++ or R. I can create the class, and expose it to R with modules (https://gist.github.com/hadley/4987110), but I don't know how to write the SEXP constructor or SEXP() operator to make it easy to move it back and worth b

[Rcpp-devel] Rcpp modules documentation

2012-05-24 Thread Dirk Eddelbuettel
There had been a number of posts over the last few weeks (months?) where folks were struggling with getting Rcpp modules going based on the examples in the vignette. I just spent a few hours cleaning things up. The gist of it is -- this always worked, but I often forgot to point out that lo

Re: [Rcpp-devel] Rcpp modules: Derived class - exposing method from base class?

2011-07-08 Thread Romain Francois
Le 08/07/11 14:22, Jonas Rauch a écrit : Hi Romain, glad to hear that! Although I solved my original problem with the workaround described, I would be happy to do some testing when you have a solution. Noted :-) On Fri, Jul 8, 2011 at 2:00 PM, Romain Francois mailto:[email protected]>

Re: [Rcpp-devel] Rcpp modules: Derived class - exposing method from base class?

2011-07-08 Thread Jonas Rauch
Hi Romain, glad to hear that! Although I solved my original problem with the workaround described, I would be happy to do some testing when you have a solution. On Fri, Jul 8, 2011 at 2:00 PM, Romain Francois wrote: > Le 07/07/11 15:18, Romain Francois a écrit : > > Le 15/06/11 14:57, Douglas B

Re: [Rcpp-devel] Rcpp modules: Derived class - exposing method from base class?

2011-07-08 Thread Romain Francois
Le 07/07/11 15:18, Romain Francois a écrit : Le 15/06/11 14:57, Douglas Bates a écrit : On Wed, Jun 15, 2011 at 6:38 AM, Jonas Rauch wrote: Hey again, just to clarify: The final solution was to implement all methods of the derived class that are to be exposed to R and to call the method of the

Re: [Rcpp-devel] Rcpp modules: Derived class - exposing method from base class?

2011-07-07 Thread Romain Francois
Le 15/06/11 14:57, Douglas Bates a écrit : On Wed, Jun 15, 2011 at 6:38 AM, Jonas Rauch wrote: Hey again, just to clarify: The final solution was to implement all methods of the derived class that are to be exposed to R and to call the method of the base class explicitly: class Bar : public F

Re: [Rcpp-devel] Rcpp modules: Derived class - exposing method from base class?

2011-06-15 Thread Douglas Bates
On Wed, Jun 15, 2011 at 6:38 AM, Jonas Rauch wrote: > Hey again, > > just to clarify: The final solution was to implement all methods of the > derived class that are to be exposed to R and to call the method of the base > class explicitly: > > class Bar : public Foo { >     ... >     void doSometh

Re: [Rcpp-devel] Rcpp modules: Derived class - exposing method from base class?

2011-06-15 Thread Jonas Rauch
Hey again, just to clarify: The final solution was to implement all methods of the derived class that are to be exposed to R and to call the method of the base class explicitly: class Bar : public Foo { ... void doSomething() { Foo::doSomething() } }; Of course that is not very elegant b

[Rcpp-devel] Rcpp modules: Classes as arguments

2011-06-14 Thread Jonas Rauch
On a related note to the question on derived classes I sent yesterday, here is another interesting idea. Assume I have classes class Foo { ... }; class Bar { ... //pass Foo pointer as parameter void myMethod(Foo* X) { ... } //or Foo reference void myMethod2(Fo

Re: [Rcpp-devel] Rcpp modules: Derived class - exposing method from base class?

2011-06-14 Thread Jonas Rauch
Actually, having just the declaration like this compiled fine but and ended up in an unresolved symbol when loading the library. class Bar : public Foo { ... void doSomething(); void Action() { [some code here] } }; I actually had to implement doSomething and explicitly

Re: [Rcpp-devel] Rcpp modules: Derived class - exposing method from base class?

2011-06-14 Thread Dirk Eddelbuettel
Hi Jonas, On 14 June 2011 at 19:06, Jonas Rauch wrote: | I am trying to write an R interface to a library that uses derived classes in | the following manner: | | class Foo { |     ... |     virtual void Action() = 0; |     void doSomething() { |     Action(); |     [do complicated stuff

[Rcpp-devel] Rcpp modules: Derived class - exposing method from base class?

2011-06-14 Thread Jonas Rauch
Hello everyone. I am trying to write an R interface to a library that uses derived classes in the following manner: class Foo { ... virtual void Action() = 0; void doSomething() { Action(); [do complicated stuff] } ... }; class Bar : public Foo { ... v

Re: [Rcpp-devel] Rcpp Modules - Failed to initialize module pointer

2011-04-09 Thread schattenpflanze
Is there a way to load/initialize the module in such a way that > library(testmod) > yada immediately yields the full description above? Aha, it seems that setting the (yet undocumented) option 'mustStart' to 'TRUE' in the Module command inside .onLoad() does the trick :-). Best regards, Pete

Re: [Rcpp-devel] Rcpp Modules - Failed to initialize module pointer

2011-04-09 Thread schattenpflanze
OK, I think I got it. After restarting with a clean workspace, the message changed to > yada Uninitialized module named "yada" from package "testmod", which is probably due to some kind of lazy loading. I can then directly call > yada$foo(2,3) [1] 6 > yada Rcpp module 'yada' 6 functions:

[Rcpp-devel] Rcpp Modules - Failed to initialize module pointer

2011-04-09 Thread schattenpflanze
Hello, I would like to use the very nice Rcpp (0.9.3) Module feature to expose C++ functions to R. As a starting point, I tried to get the "testmod" package, created with Rcpp.package.skeleton( "testmod", module = TRUE ) to run. I can compile and install the package without errors on R 2.14.

Re: [Rcpp-devel] Rcpp modules : help with the design

2010-06-04 Thread Romain Francois
Le 31/05/10 20:07, Romain Francois a écrit : Thanks John, Le 31/05/10 18:23, John Chambers a écrit : Just a couple of comments. 1. class names One result of creating an S4 class with the same name as the C++ class is that you may be hiding another S4 class of that name. Always possible in any

Re: [Rcpp-devel] Rcpp modules : help with the design

2010-05-31 Thread Romain Francois
Thanks John, Le 31/05/10 18:23, John Chambers a écrit : Just a couple of comments. 1. class names One result of creating an S4 class with the same name as the C++ class is that you may be hiding another S4 class of that name. Always possible in any application, but when dealing with an inter-sy

Re: [Rcpp-devel] Rcpp modules : help with the design

2010-05-29 Thread Romain Francois
Le 29/05/10 09:10, Romain Francois a écrit : Hello, Currently, when exposing a c++ class to R through a Rcpp module, e.g: class World { public: World() : msg("hello"){} void set(std::string msg) { this->msg = msg; } std::string greet() { return msg; } private: std::string msg; }; void clearW

[Rcpp-devel] Rcpp modules : help with the design

2010-05-29 Thread Romain Francois
Hello, Currently, when exposing a c++ class to R through a Rcpp module, e.g: class World { public: World() : msg("hello"){} void set(std::string msg) { this->msg = msg; } std::string greet() { return msg; } private: std::string msg; }; void clearWorld( World* w){ w->set

Re: [Rcpp-devel] Rcpp modules take 3, now with a vignette

2010-05-27 Thread Davor Cubranic
That's pretty cool. It's good to know it should be doable -- I'll give it a whack, once (if) I graduate to that level of expertise with template meta-programming and R internals. Davor On 2010-05-27, at 12:36 PM, Romain Francois wrote: > Davor, > > Rcpp modules currently does not handle enum

Re: [Rcpp-devel] Rcpp modules take 3, now with a vignette

2010-05-27 Thread Romain Francois
Davor, Rcpp modules currently does not handle enum types, but Boost.Python does, so I suppose we could have similar syntax. http://www.boost.org/doc/libs/1_43_0/libs/python/doc/v2/enum.html This is not high on my priority list, but if you want to prepare some patch, I'll look into it. Roma

Re: [Rcpp-devel] Rcpp modules take 3, now with a vignette

2010-05-27 Thread Davor Cubranic
Hi Romain, Can you tell me if this mechanism can somehow be used for passing enum-type arguments from R to Rcpp? I'm currently using strings or integers, and hope there can be an easier way to keep the two sides of the code from getting out of sync. Davor On 2010-05-27, at 2:35 AM, Romain Fr

[Rcpp-devel] Rcpp modules take 3, now with a vignette

2010-05-27 Thread Romain Francois
Hello, I've made a quick (5 pages) vignette about the current feature set of Rcpp modules. I've pushed the current version here: http://addictedtor.free.fr/misc/rcpp/Rcpp-modules.pdf The vignette is essentially a compilation of my last two emails about modules. Romain. BTW: The c++ code is

Re: [Rcpp-devel] Rcpp modules take 2, exposing C++ classes to R

2010-05-26 Thread Romain Francois
Here is a self contained example, that uses both svn version of Rcpp and svn version of inline (for getDynLib) : require( Rcpp ) require( methods ) code <- '' inc <- ' class World { public: World() : msg("hello"){} void set(std::string msg) { this->msg = msg; } std::string greet

[Rcpp-devel] Rcpp modules take 2, exposing C++ classes to R

2010-05-26 Thread Romain Francois
Hello, On top of exposing C++ functions (see http://permalink.gmane.org/gmane.comp.lang.r.rcpp/354), I've added some code to expose c++ classes to the R level. This is also inspired from boost.python (although much less comprehensive). Consider this simple c++ class : class World { public:

Re: [Rcpp-devel] Rcpp modules

2010-05-20 Thread Dirk Eddelbuettel
On 20 May 2010 at 09:49, Romain Francois wrote: | Le 20/05/10 09:33, Dirk Eddelbuettel a écrit : | > | > On 19 May 2010 at 15:07, Romain Francois wrote: | > | One thing perhaps I'd like opinions about is the use if the name | > | "function" in : | > | | > | RCPP_MODULE(yada){ | > | using namespa

Re: [Rcpp-devel] Rcpp modules

2010-05-20 Thread Romain Francois
Le 20/05/10 09:33, Dirk Eddelbuettel a écrit : On 19 May 2010 at 15:07, Romain Francois wrote: | One thing perhaps I'd like opinions about is the use if the name | "function" in : | | RCPP_MODULE(yada){ | using namespace Rcpp ; | function( "hello" ,&hello ) ; | } | | Boost.Python use

Re: [Rcpp-devel] Rcpp modules

2010-05-20 Thread Dirk Eddelbuettel
On 19 May 2010 at 15:07, Romain Francois wrote: | One thing perhaps I'd like opinions about is the use if the name | "function" in : | | RCPP_MODULE(yada){ | using namespace Rcpp ; | function( "hello" , &hello ) ; | } | | Boost.Python uses "def" but this is too pythonic for me. OTOH

Re: [Rcpp-devel] Rcpp modules

2010-05-19 Thread Romain Francois
One thing perhaps I'd like opinions about is the use if the name "function" in : RCPP_MODULE(yada){ using namespace Rcpp ; function( "hello" , &hello ) ; } Boost.Python uses "def" but this is too pythonic for me. OTOH, having both Rcpp::Function (the class that deals with R fun

[Rcpp-devel] Rcpp modules

2010-05-19 Thread Romain Francois
Hello, I've been looking at Boost.Python lately and thought we might be able to port some of the ideas to Rcpp too. I commited (rev 1281) some code to Rcpp that introduces the notion of Rcpp modules (wording might change later). A module is a collection of C++ functions that : - take 0 or m