[Rcpp-devel] Question about modules

Romain Francois romain at r-enthusiasts.com
Thu Jan 9 19:09:58 CET 2014


not really.  the std::is_enum trait in C++11 is going to help, but not that much. 

Romain

Le 9 janv. 2014 à 19:02, Tim Keitt <tkeitt at utexas.edu> a écrit :

> Thanks. Got it working. Looks very promising.
> 
> Any progress/work-arounds for enums? I have a ton to deal with.
> 
> THK
> 
> 
> On Thu, Jan 9, 2014 at 11:31 AM, Romain Francois <romain at r-enthusiasts.com> wrote:
> Hi, 
> 
> The module docs is probably the one in the worst shape. I think the current recommendation is to have this in one of your .R files: 
> 
> loadModule( "yourmodule", TRUE )
> 
> which triggers a load action for when the package is loaded. 
> 
> Romain
> 
> Le 9 janv. 2014 à 17:45, Tim Keitt <tkeitt at utexas.edu> a écrit :
> 
>> OK. Not quite as automatic as I thought.
>> 
>> Its now loading the class using 'loadRcppModules' in '.onLoad'.
>> 
>> Still a little lost. I'll have to re-read the modules docs. Not sure how to use the class. The factory did not get exposed. Do I have to expose it separately eg using attributes?
>> 
>> THK
>> 
>> 
>> On Thu, Jan 9, 2014 at 10:20 AM, Tim Keitt <tkeitt at utexas.edu> wrote:
>> Thanks. That at least compiles. (If anyone is curious, through trial-and-error it appears .factory is not a template and takes a single argument, the factory function pointer.)
>> 
>> However I am not seeing any of my functions exported to the package. How would the factory be called from R? I sort of understood that exporting in packages was automatic. Do I have to manually create the module in R?
>> 
>> THK
>> 
>> 
>> On Thu, Jan 9, 2014 at 4:40 AM, Romain Francois <romain at r-enthusiasts.com> wrote:
>> Hello, 
>> 
>> You can use .factory instead of .constructor in that case. 
>> 
>> Romain
>> 
>> Le 9 janv. 2014 à 03:16, Tim Keitt <tkeitt at utexas.edu> a écrit :
>> 
>>> I did a little experiment with RCPP_MODULE trying to wrap a class from another library. The class in question has a protected default constructor and uses a non-member factory function for instantiation.
>>> 
>>> In short I did not get it to work. I am assuming that if you do not include a .constuctor statement, then the class does not get wrapped in the module. Is that correct?
>>> 
>>> THK
>>> 
>>> -- 
>>> http://www.keittlab.org/
>>> _______________________________________________
>>> Rcpp-devel mailing list
>>> Rcpp-devel at lists.r-forge.r-project.org
>>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
>> 
>> 
>> 
>> 
>> -- 
>> http://www.keittlab.org/
>> 
>> 
>> 
>> -- 
>> http://www.keittlab.org/
> 
> 
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
> 
> 
> 
> -- 
> http://www.keittlab.org/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20140109/0e56beea/attachment.html>


More information about the Rcpp-devel mailing list