Warning, /include/Geant4/toolx/hdf5/header is written in an unsupported language. File is not indexed.
0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003
0004 #ifndef toolx_hdf5_header
0005 #define toolx_hdf5_header
0006
0007 #include "tools"
0008 #include "T_tools"
0009
0010 namespace toolx {
0011 namespace hdf5 {
0012
0013 inline bool write_header(hid_t a_file,int a_version = 1) {
0014 hid_t header = toolx_H5Gcreate(a_file,"header",0);
0015 if(header<0) return false;
0016 if(!write_atb(header,"writer","exlib")) {::H5Gclose(header);return false;}
0017 if(!write_scalar_atb<int>(header,"data_schema_version",a_version)) {::H5Gclose(header);return false;}
0018 ::H5Gclose(header);
0019 return true;
0020 }
0021
0022 inline bool read_header(hid_t a_file,std::string& a_writer,int& a_data_schema_version) {
0023 hid_t header = toolx_H5Gopen(a_file,"header");
0024 if(header<0) {a_writer.clear();a_data_schema_version=0;return false;}
0025 if(!read_atb(header,"writer",a_writer)) {::H5Gclose(header);a_writer.clear();a_data_schema_version=0;return false;}
0026 if(!read_atb(header,"data_schema_version",a_data_schema_version)) {
0027 ::H5Gclose(header);
0028 a_writer.clear();a_data_schema_version=0;
0029 return false;
0030 }
0031 ::H5Gclose(header);
0032 return true;
0033 }
0034
0035 }}
0036
0037 #endif