Skip to content

Missing Rcpp Strings support #10

@FabrizioSandri

Description

@FabrizioSandri

Description

RcppDeepState supports the analysis of functions that contain arguments which type falls in the following list:

  • Rcpp::NumericVector
  • Rcpp::NumericMatrix
  • Rcpp::CharacterVector
  • Rcpp::IntegerVector
  • arma::mat
  • std::double
  • std::string
  • std::int

However I found that if a function contains a Rcpp::String argument, the function will no be analyzed. It will be a good step to implement this lack and add the support for Rcpp::String arguments. RcppDeepState now only accepts std::string arguments, not Rcpp::String.

@tdhock I plan to solve this in a new pull request.

Steps to reproduce

I created a simple Rcpp based package containing the getLen function that calculates the length of a Rcpp::String.

#include <Rcpp.h>
#include <string>

using namespace std;

// [[Rcpp::export]]
int getLen(Rcpp::String arg1){
    return(strlen(arg1.get_cstr()));
}

However, if I attempt to compile this package using RcppDeepState, an error is thrown.
The Rcpp::String argument is not supported, which is the reason for this.

> require("RcppDeepState")
> deepstate_harness_compile_run("/home/fabri/test/testHarness/Rcpp/getLen", verbose=TRUE)
...

We can't test the function - getLen - due to the following datatypes falling out of the allowed ones: String

Error in deepstate_pkg_create(package_path, verbose) : 
  Testharnesses cannot be created for the package - datatypes fall out of specified list!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions