h5cpp icon indicating copy to clipboard operation
h5cpp copied to clipboard

Groups examples doesn't compile, some functions are missing

Open scontini76 opened this issue 2 years ago • 1 comments

From the documentation seems that there should be two functions:

parent ::= fd_t | gr_t;

[open]
h5::gr_t gopen(parent, const std::string& path [, const h5::gapl_t& gapl]);

[create]
h5::gr_t  gcreate(const L& parent, const std::string& path,
	[, h5::lcpl_t lcpl] [, h5::gcpl_t gcpl] [, h5::gapl_t gapl]);

but I can't use them, I don't find them declared anywhere an the groups examples doesn't compile:

groups.cpp:15:21: error: no member named 'gcreate' in namespace 'h5'
                h5::gr_t gr = h5::gcreate(fd, "my-group/sub/path");
                              ~~~~^
groups.cpp:18:7: error: no member named 'gcreate' in namespace 'h5'
                h5::gcreate(fd, "/mygroup", lcpl); // passing lcpl type explicitly
                ~~~~^
groups.cpp:23:8: error: no member named 'gcreate' in namespace 'h5'
                        h5::gcreate(fd, "/mygroup", h5::dont_create_path);
                        ~~~~^
groups.cpp:24:34: error: no member named 'group' in namespace 'h5::error::io'
                }catch (  const h5::error::io::group::create& e){
                                ~~~~~~~~~~~~~~~^
groups.cpp:30:8: error: no member named 'gcreate' in namespace 'h5'
                        h5::gcreate(fd, "/mygroup", h5::dont_create_path);
                        ~~~~^
groups.cpp:37:13: error: no member named 'gopen' in namespace 'h5'; did you mean 'fdopen'?
                auto gr = h5::gopen(fd, "/mygroup");
                          ^~~~~~~~~
                          fdopen

What's wrong?

At the moment I'm using a workaround in my code which is just using the C API:

h5::gr_t root{H5Gopen(fd,"/", H5P_DEFAULT)};

but I'm not sure how good is this:

  • is the group lifespan handled by the h5cpp library?
  • is the use of h5::fd_t in C API calls safe and portable?

Anyway I wish there are a different way to avoid to call the C API directly for common task.

Please let me know if I'm doing something wrong! Thank you!

scontini76 avatar Jan 12 '22 14:01 scontini76

The documentation is for an unreleased version; which has features related to groups and an improved architecture. Less fortunately for the community I've been held up with a related project: H5CLUSTER and as of now I am unable to release the new version of h5cpp. (and unable to accept any modifications, since they are not relevant)

Yes, the mechanism is general, and will manage the passed hid_t: h5::gr_t root{hid hid_t}; it is you responsibility using the correct CAPI call. In fact H5CPP does the following:

Yes, all CAPI calls are safe and portable; it was a design feature not to re-implement what is done -- but to enhance it. In fact H5CPP features a seamless integration with the CAPI with the exception of h5::append internals. h5::append is custom slim code with an order of magnitude better IO than the HDF5 HL append implementation.

  1. RAII
  2. seamless integration with HDF5 C API
  3. tuned compile time generated code from templates
  4. compiler assisted static reflection with LLVM
  5. zero copy linear algebra and std:vector support

If you want to talk we could schedule a meeting, where you cab tell me what you want to do -- and I tell you the how. Let me know.

steven-varga avatar Jan 12 '22 15:01 steven-varga