Skip to content

Commit 0314ee3

Browse files
committed
Fix optional string conversion and export typo
1 parent 78c84cf commit 0314ee3

File tree

3 files changed

+33
-26
lines changed

3 files changed

+33
-26
lines changed

R/RcppExports.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,6 +1261,10 @@ libtiledb_profile_save <- function(profile) {
12611261
invisible(.Call(`_tiledb_libtiledb_profile_save`, profile))
12621262
}
12631263

1264+
libtiledb_profile_dump <- function(profile) {
1265+
.Call(`_tiledb_libtiledb_profile_dump`, profile)
1266+
}
1267+
12641268
vecbuf_to_shmem <- function(dir, name, buf, sz, numvar) {
12651269
invisible(.Call(`_tiledb_vecbuf_to_shmem`, dir, name, buf, sz, numvar))
12661270
}

src/RcppExports.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3758,6 +3758,17 @@ BEGIN_RCPP
37583758
return R_NilValue;
37593759
END_RCPP
37603760
}
3761+
// libtiledb_profile_dump
3762+
std::string libtiledb_profile_dump(XPtr<tiledb::Profile> profile);
3763+
RcppExport SEXP _tiledb_libtiledb_profile_dump(SEXP profileSEXP) {
3764+
BEGIN_RCPP
3765+
Rcpp::RObject rcpp_result_gen;
3766+
Rcpp::RNGScope rcpp_rngScope_gen;
3767+
Rcpp::traits::input_parameter< XPtr<tiledb::Profile> >::type profile(profileSEXP);
3768+
rcpp_result_gen = Rcpp::wrap(libtiledb_profile_dump(profile));
3769+
return rcpp_result_gen;
3770+
END_RCPP
3771+
}
37613772
// vecbuf_to_shmem
37623773
void vecbuf_to_shmem(std::string dir, std::string name, XPtr<query_buf_t> buf, int sz, int numvar);
37633774
RcppExport SEXP _tiledb_vecbuf_to_shmem(SEXP dirSEXP, SEXP nameSEXP, SEXP bufSEXP, SEXP szSEXP, SEXP numvarSEXP) {
@@ -4146,6 +4157,7 @@ static const R_CallMethodDef CallEntries[] = {
41464157
{"_tiledb_libtiledb_profile_set_param", (DL_FUNC) &_tiledb_libtiledb_profile_set_param, 3},
41474158
{"_tiledb_libtiledb_profile_get_param", (DL_FUNC) &_tiledb_libtiledb_profile_get_param, 2},
41484159
{"_tiledb_libtiledb_profile_save", (DL_FUNC) &_tiledb_libtiledb_profile_save, 1},
4160+
{"_tiledb_libtiledb_profile_dump", (DL_FUNC) &_tiledb_libtiledb_profile_dump, 1},
41494161
{"_tiledb_vecbuf_to_shmem", (DL_FUNC) &_tiledb_vecbuf_to_shmem, 5},
41504162
{"_tiledb_vlcbuf_to_shmem", (DL_FUNC) &_tiledb_vlcbuf_to_shmem, 4},
41514163
{"_tiledb_querybuf_from_shmem", (DL_FUNC) &_tiledb_querybuf_from_shmem, 2},

src/libtiledb.cpp

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5932,43 +5932,33 @@ bool libtiledb_current_domain_is_empty(XPtr<tiledb::CurrentDomain> cd) {
59325932
* Profile (2.29.0 or later)
59335933
*/
59345934

5935+
std::optional<std::string> as_optional_string(Nullable<CharacterVector> param) {
5936+
if (param.isNull()) {
5937+
return std::nullopt;
5938+
}
5939+
CharacterVector tmp(param);
5940+
return std::string(tmp[0]);
5941+
}
5942+
59355943

59365944
// [[Rcpp::export]]
59375945
XPtr<tiledb::Profile> libtiledb_profile_new(Nullable<CharacterVector> name = R_NilValue, Nullable<CharacterVector> dir = R_NilValue) {
5938-
std::optional<std::string> name_ = std::nullopt;
5939-
std::optional<std::string> dir_ = std::nullopt;
5940-
if (name.isNotNull()) {
5941-
name_ = as<std::string>(name);
5942-
}
5943-
if (name.isNotNull()) {
5944-
dir_ = as<std::string>(dir);
5945-
}
5946-
return make_xptr<tiledb::Profile>(new tiledb::Profile(name_, dir_));
5946+
auto name_ = as_optional_string(name);
5947+
auto dir_ = as_optional_string(dir);
5948+
return make_xptr<tiledb::Profile>(new tiledb::Profile(name_, dir_));
59475949
}
59485950

59495951
// [[Rcpp::export]]
59505952
XPtr<tiledb::Profile> libtiledb_profile_load(Nullable<CharacterVector> name = R_NilValue, Nullable<CharacterVector> dir = R_NilValue) {
5951-
std::optional<std::string> name_ = std::nullopt;
5952-
std::optional<std::string> dir_ = std::nullopt;
5953-
if (name.isNotNull()) {
5954-
name_ = as<std::string>(name);
5955-
}
5956-
if (name.isNotNull()) {
5957-
dir_ = as<std::string>(dir);
5958-
}
5953+
auto name_ = as_optional_string(name);
5954+
auto dir_ = as_optional_string(dir);
59595955
return make_xptr<tiledb::Profile>(new tiledb::Profile(tiledb::Profile::load(name_, dir_)));
59605956
}
59615957

59625958
// [[Rcpp:export]]
59635959
void libtiledb_profile_remove(Nullable<CharacterVector> name = R_NilValue, Nullable<CharacterVector> dir = R_NilValue) {
5964-
std::optional<std::string> name_ = std::nullopt;
5965-
std::optional<std::string> dir_ = std::nullopt;
5966-
if (name.isNotNull()) {
5967-
name_ = as<std::string>(name);
5968-
}
5969-
if (name.isNotNull()) {
5970-
dir_ = as<std::string>(dir);
5971-
}
5960+
auto name_ = as_optional_string(name);
5961+
auto dir_ = as_optional_string(dir);
59725962
return tiledb::Profile::remove(name_, dir_);
59735963
}
59745964

@@ -6001,7 +5991,8 @@ void libtiledb_profile_save(XPtr<tiledb::Profile> profile) {
60015991
return profile->save();
60025992
}
60035993

6004-
// [[Rcpp:export]]
5994+
// [[Rcpp::export]]
60055995
std::string libtiledb_profile_dump(XPtr<tiledb::Profile> profile) {
60065996
return profile->dump();
60075997
}
5998+

0 commit comments

Comments
 (0)