示例#1
0
文件: extras.cpp 项目: kozo2/ecell4
std::string load_version_information(const H5::CommonFG& root)
{
    using namespace H5;
    char buf[32];
    const DataSet dataset(DataSet(root.openDataSet("version")));
    dataset.read(buf, dataset.getDataType());
    return std::string(buf);
}
示例#2
0
std::string hdfutil::ReadString (const H5::CommonFG& group, const std::string & dsname) {
    const H5::DataSet & dataset = group.openDataSet(dsname);
	try {
        H5::DataType type = dataset.getDataType();
        std::string retval;
        retval.resize(type.getSize());
		dataset.read(&retval[0], dataset.getStrType());
        return retval;
	} catch (H5::Exception e) {
        std::string error = "Unable to ReadString.";// + dsname;
        throw std::runtime_error(error.c_str());
	}
}