#1785 HdfSerializer read-only option

This commit is contained in:
aothms
2021-11-28 19:33:45 +00:00
parent 2708133493
commit 6eab9fb593
4 changed files with 883 additions and 7 deletions
+8 -6
View File
@@ -52,20 +52,22 @@ herr_t print_stack(hid_t /*estack*/, void*) {
return 0;
}
HdfSerializer::HdfSerializer(const std::string& hdf_filename, const SerializerSettings& settings)
HdfSerializer::HdfSerializer(const std::string& hdf_filename, const SerializerSettings& settings, bool read_only)
: GeometrySerializer(settings)
, hdf_filename(hdf_filename)
, settings_(settings)
{
H5E_auto2_t fn = &print_stack;
H5::Exception::setAutoPrint(fn, nullptr);
try {
file = H5::H5File(hdf_filename, H5F_ACC_RDWR | H5F_ACC_CREAT);
} catch (H5::Exception&) {
file = H5::H5File(hdf_filename, H5F_ACC_TRUNC);
file = H5::H5File(hdf_filename, read_only
? H5F_ACC_RDONLY
: (H5F_ACC_RDWR | H5F_ACC_CREAT));
} catch (H5::Exception& e) {
throw IfcParse::IfcException(e.getDetailMsg());
}
str_type = H5::StrType(H5::PredType::C_S1, H5T_VARIABLE);
#ifdef USE_BINARY