コード例 #1
0
ファイル: Attribute.cpp プロジェクト: cran/h5
// [[Rcpp::export]]
char GetAttributeType(XPtr<Attribute> attribute) {
  try {
    DataType dtype = attribute->getDataType();
    return GetTypechar(dtype);
  } catch(Exception& error) {
    string msg = error.getDetailMsg() + " in " + error.getFuncName();
    throw Rcpp::exception(msg.c_str());
  }
}
コード例 #2
0
ファイル: Attribute.cpp プロジェクト: cran/h5
// [[Rcpp::export]]
SEXP ReadAttribute(XPtr<Attribute> attribute, NumericVector count) {
  try {
    DataType dtype = attribute->getDataType();

    NumericVector count_rev = clone<NumericVector>(count);
    std::reverse(count_rev.begin(), count_rev.end());

    SEXP data = AllocateRData(dtype, count);
    data = ReadRDataAttribute(dtype, data, attribute);
    return data;
  } catch(Exception& error) {
    string msg = error.getDetailMsg() + " in " + error.getFuncName();
    throw Rcpp::exception(msg.c_str());
  }
}
コード例 #3
0
ファイル: Attribute.cpp プロジェクト: cran/h5
// [[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());
  }
}