// [[Rcpp::export]] bool WriteAttribute(XPtr<Attribute> attribute, SEXP mat, char datatype, NumericVector count) { try { size_t stsize = -1; DataType dsettype = attribute->getDataType(); if (!H5Tis_variable_str(dsettype.getId())) { stsize = dsettype.getSize(); } DTYPE dtype = GetTypechar(datatype); const void *buf = ConvertBuffer(mat, dtype, stsize); attribute->write(GetDataType(dtype, stsize), buf); return TRUE; } catch(Exception& error) { string msg = error.getDetailMsg() + " in " + error.getFuncName(); throw Rcpp::exception(msg.c_str()); } }