// [[Rcpp::export]] XPtr<Attribute> CreateAttribute_H5File(XPtr<H5File> loc, string attributename, char datatype, NumericVector dimensions, int size) { try { vector<hsize_t> dims(dimensions.begin(), dimensions.end()); DataSpace dataspace (dimensions.length(), &dims[0]); if(size > 0) { // Adjust for null-termination character size += 1; } DataType dtype = GetDataType(GetTypechar(datatype), size); Attribute attr = loc->createAttribute(attributename, dtype, dataspace, H5P_DEFAULT); return XPtr<Attribute>(new Attribute(attr)); } catch (Exception& error) { throw Rcpp::exception("Creation of Attribute failed. Maybe attribute with same name is already existing at location."); } }