/** A wrapper for h5cpp calls
 */

#ifndef WIRECELLPYTORCH_H5CPPSERVICE
#define WIRECELLPYTORCH_H5CPPSERVICE

#include "WireCellIface/IConfigurable.h"
#include "WireCellUtil/IComponent.h"
#include "WireCellUtil/Logging.h"

#include <h5cpp/all>

namespace WireCell {
namespace Hio {

///
h5::fd_t create(const std::string &path, unsigned flags,
                const h5::fcpl_t &fcpl = h5::default_fcpl,
                const h5::fapl_t &fapl = h5::default_fapl);
///
template <class T, class... args_t>
h5::ds_t write(const h5::fd_t &fd, const std::string &dataset_path,
               const T *ptr, args_t &&... args);

///
h5::fd_t open(const std::string &path, unsigned flags,
              const h5::fapl_t &fapl = h5::default_fapl);

/// read: pointer
template <class T, class... args_t>
void read(const h5::fd_t &fd, const std::string &dataset_path, T *ptr,
          args_t &&... args);

/// read: object
template <class T, class... args_t> // dispatch to above
T read(const h5::fd_t &fd, const std::string &dataset_path, args_t &&... args);
}; // namespace Hio
} // namespace WireCell

#endif // WIRECELLPYTORCH_IH5CPPSERVICE