@@ -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]]
59375945XPtr<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]]
59505952XPtr<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]]
59635959void 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]]
60055995std::string libtiledb_profile_dump (XPtr<tiledb::Profile> profile) {
60065996 return profile->dump ();
60075997}
5998+
0 commit comments