Commit 6938bbd6 authored by Samuel Debionne's avatar Samuel Debionne Committed by Alejandro Homs Puron
Browse files

[IO] Refactor errinfo

parent 2aac3367
// Copyright (C) 2020 Samuel Debionne, ESRF.
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#pragma once
#include <filesystem>
namespace
boost
{
template <class Tag, class T> class error_info;
typedef error_info<struct errinfo_filesystem_path_, std::filesystem::path> errinfo_filesystem_path;
}
......@@ -8,8 +8,6 @@
#include <filesystem>
#include <boost/exception/errinfo_errno.hpp>
#include <boost/exception/errinfo_file_name.hpp>
#include <boost/gil/extension/dynamic_image/dynamic_image_all.hpp>
#include <hdf5.h>
......@@ -22,16 +20,6 @@
#include <lima/io/h5/params.hpp>
#include <lima/io/h5/nexus.hpp>
namespace boost
{
template <class Tag, class T>
class error_info;
typedef error_info<struct errinfo_filesystem_path_, std::filesystem::path> errinfo_filesystem_path;
typedef error_info<struct errinfo_h5_path_, lima::io::h5::path> errinfo_h5_path;
typedef error_info<struct errinfo_frame_idx_, hsize_t> errinfo_frame_idx;
} // namespace boost
namespace lima
{
namespace io::h5
......@@ -118,7 +106,7 @@ namespace io::h5
{
if (frame_idx >= m_frame_slice.count)
LIMA_THROW_EXCEPTION(lima::hdf5_error("Frame number out of bound")
<< boost::errinfo_frame_idx(frame_idx));
<< boost::errinfo_h5_idx(frame_idx));
else if (v.dimensions() != m_frame_dims)
LIMA_THROW_EXCEPTION(lima::hdf5_error("Frame dimensions mismatch"));
......
......@@ -10,13 +10,13 @@
#include <string>
#include <type_traits>
#include <boost/exception/errinfo_errno.hpp>
#include <boost/utility/base_from_member.hpp>
#include <lima/exceptions.hpp>
#include <lima/utils/lengthof.hpp>
#include <lima/io/h5/wrapper/base.hpp>
#include <lima/io/h5/wrapper/errinfo.hpp>
#include <lima/io/h5/wrapper/link.hpp>
namespace lima
......
// Copyright (C) 2020 Samuel Debionne, ESRF.
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#pragma once
#include <sstream>
#include <boost/exception/errinfo_errno.hpp>
#include <boost/exception/errinfo_file_name.hpp>
#include <boost/exception/errinfo_filesystem_path.hpp>
#include <lima/io/h5/wrapper/path.hpp>
namespace boost
{
using errinfo_h5_idx = error_info<struct errinfo_h5_idx_, hsize_t>;
using errinfo_h5_path = error_info<struct errinfo_h5_path_, lima::io::h5::path>;
using errinfo_h5_stack = error_info<struct errinfo_h5_stack_, std::string>;
} // namespace boost
......@@ -12,8 +12,6 @@
#include <optional>
#include <filesystem>
#include <boost/exception/errinfo_errno.hpp>
#include <boost/exception/errinfo_file_name.hpp>
#include <boost/gil.hpp>
#include <boost/gil/io/dynamic_io_new.hpp>
......@@ -38,16 +36,6 @@
#include <lima/io/h5/nexus.hpp>
#include <lima/io/h5/params.hpp>
namespace boost
{
template <class Tag, class T>
class error_info;
typedef error_info<struct errinfo_filesystem_path_, std::filesystem::path> errinfo_filesystem_path;
typedef error_info<struct errinfo_frame_idx_, hsize_t> errinfo_frame_idx;
} // namespace boost
namespace lima
{
namespace io
......@@ -291,7 +279,7 @@ namespace io
{
if (frame_idx >= m_nb_frames)
LIMA_THROW_EXCEPTION(lima::hdf5_error("Frame number out of bound")
<< boost::errinfo_frame_idx(frame_idx));
<< boost::errinfo_h5_idx(frame_idx));
hsize_t offset[] = {frame_idx, 0U, 0U};
uint32_t filter_mask = 0;
......@@ -635,7 +623,7 @@ namespace io
// The dimension of the frame_idx dataset is (nb_frames + 1)
if (frame_idx > m_nb_frames)
LIMA_THROW_EXCEPTION(lima::hdf5_error("Frame number out of bound")
<< boost::errinfo_frame_idx(frame_idx));
<< boost::errinfo_h5_idx(frame_idx));
hsize_t dims[] = {1};
auto mem_space = dataspace::create_simple(1, dims);
......@@ -716,7 +704,7 @@ namespace io
{
if (frame_idx >= m_nb_frames)
LIMA_THROW_EXCEPTION(lima::hdf5_error("Frame number out of bound")
<< boost::errinfo_frame_idx(frame_idx));
<< boost::errinfo_h5_idx(frame_idx));
hsize_t dims[] = {m_nb_bins};
auto mem_space = dataspace::create_simple(1, dims);
......@@ -735,7 +723,7 @@ namespace io
{
if (frame_idx >= m_nb_frames)
LIMA_THROW_EXCEPTION(lima::hdf5_error("Frame number out of bound")
<< boost::errinfo_frame_idx(frame_idx));
<< boost::errinfo_h5_idx(frame_idx));
hsize_t dims[] = {m_nb_bins};
auto mem_space = dataspace::create_simple(1, dims);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment