55 #pragma clang diagnostic push
56 #pragma clang diagnostic ignored "-Wpadded"
57 #pragma clang diagnostic ignored "-Wweak-vtables"
160 #pragma clang diagnostic push
161 #pragma clang diagnostic ignored "-Wdocumentation-deprecated-sync"
165 #pragma clang diagnostic pop
170 void extent(
size_t dim,ssize_t delta_elements)
const;
190 #if (defined(_DOXYGEN_) || H5_VERSION_GE(1,10,0))
269 void read_reshape(T &data,
307 void write_reshape(
const T &data,
340 void write_chunk(
const T &data,
341 std::vector<unsigned long long> offset,
342 std::uint32_t filter_mask = 0,
347 void write_chunk(
const T &data,
348 std::vector<unsigned long long> offset,
349 std::uint32_t filter_mask = 0,
368 void write_chunk(
const T &data,
371 std::vector<unsigned long long> & offset,
372 std::uint32_t filter_mask = 0,
376 #if (defined(_DOXYGEN_) || H5_VERSION_GE(1,10,2))
392 std::vector<unsigned long long> offset,
413 std::vector<unsigned long long> & offset,
483 void write_reshape(
const T &data,
528 void read_reshape(T &data,
573 static Node create_dataset(
const Group &base,
585 void write_variable_length_data(
const T &data,
594 if(H5Dwrite(
static_cast<hid_t
>(*
this),
595 static_cast<hid_t
>(mem_type),
596 static_cast<hid_t
>(mem_space),
597 static_cast<hid_t
>(file_space),
598 static_cast<hid_t
>(dtpl),
601 std::stringstream ss;
602 ss<<
"Failure to write variable length data to dataset ["<<
link().path()<<
"]!";
608 void write_contiguous_data(
const T &data,
615 if(H5Dwrite(
static_cast<hid_t
>(*
this),
616 static_cast<hid_t
>(mem_type),
617 static_cast<hid_t
>(mem_space),
618 static_cast<hid_t
>(file_space),
619 static_cast<hid_t
>(dtpl),
622 std::stringstream ss;
623 ss<<
"Failure to write contiguous data to dataset ["<<
link().path()<<
"]!";
629 void write_variable_length_string_data(
const T &data,
630 const datatype::Datatype &mem_type,
631 const dataspace::Dataspace &mem_space,
632 const datatype::Datatype &,
633 const dataspace::Dataspace &file_space,
634 const property::DatasetTransferList &dtpl)
const
636 using Trait = VarLengthStringTrait<T>;
637 auto buffer = Trait::to_buffer(data);
639 if(H5Dwrite(
static_cast<hid_t
>(*
this),
640 static_cast<hid_t
>(mem_type),
641 static_cast<hid_t
>(mem_space),
642 static_cast<hid_t
>(file_space),
643 static_cast<hid_t
>(dtpl),
644 reinterpret_cast<void*
>(buffer.data()))<0)
646 std::stringstream ss;
647 ss<<
"Failure to write variable length string data to dataset ["<<
link().path()<<
"]!";
653 void write_fixed_length_string_data(
const T &data,
654 const datatype::Datatype &mem_type,
655 const dataspace::Dataspace &mem_space,
656 const datatype::Datatype &,
657 const dataspace::Dataspace &file_space,
658 const property::DatasetTransferList &dtpl)
const
660 using Trait = FixedLengthStringTrait<T>;
661 auto buffer = Trait::to_buffer(data,mem_type,mem_space);
663 if(H5Dwrite(
static_cast<hid_t
>(*
this),
664 static_cast<hid_t
>(mem_type),
665 static_cast<hid_t
>(mem_space),
666 static_cast<hid_t
>(file_space),
667 static_cast<hid_t
>(dtpl),
668 reinterpret_cast<void*
>(buffer.data()))<0)
670 std::stringstream ss;
671 ss<<
"Failure to write fixed length string data to dataset ["<<
link().path()<<
"]!";
682 void read_variable_length_data(T &data,
683 const datatype::Datatype &mem_type,
684 const dataspace::Dataspace &mem_space,
685 const datatype::Datatype &file_type,
686 const dataspace::Dataspace &file_space,
687 const property::DatasetTransferList &dtpl)
const
692 buffer.resize(file_space.selection.size());
696 buffer.resize(signed2unsigned<size_t>(file_space.size()));
699 if(H5Dread(
static_cast<hid_t
>(*
this),
700 static_cast<hid_t
>(mem_type),
701 static_cast<hid_t
>(mem_space),
702 static_cast<hid_t
>(file_space),
703 static_cast<hid_t
>(dtpl),
706 std::stringstream ss;
707 ss<<
"Failure to read variable length data from dataset ["<<
link().path()<<
"]!";
713 if(H5Dvlen_reclaim(
static_cast<hid_t
>(file_type),
714 static_cast<hid_t
>(file_space),
715 static_cast<hid_t
>(dtpl),
723 void read_contiguous_data(T &data,
724 const datatype::Datatype &mem_type,
725 const dataspace::Dataspace &mem_space,
726 const datatype::Datatype &,
727 const dataspace::Dataspace &file_space,
728 const property::DatasetTransferList &dtpl)
const
730 if(H5Dread(
static_cast<hid_t
>(*
this),
731 static_cast<hid_t
>(mem_type),
732 static_cast<hid_t
>(mem_space),
733 static_cast<hid_t
>(file_space),
734 static_cast<hid_t
>(dtpl),
737 std::stringstream ss;
738 ss<<
"Failure to read contiguous data from dataset ["<<
link().path()<<
"]!";
744 void read_variable_length_string_data(T &data,
745 const datatype::Datatype &mem_type,
746 const dataspace::Dataspace &mem_space,
747 const datatype::Datatype &,
748 const dataspace::Dataspace &file_space,
749 const property::DatasetTransferList &dtpl)
const
751 using Trait = VarLengthStringTrait<T>;
752 using size_type =
typename std::vector<T>::size_type;
754 typename Trait::BufferType buffer(
static_cast<size_type
>(mem_space.size()));
757 if(H5Dread(
static_cast<hid_t
>(*
this),
758 static_cast<hid_t
>(mem_type),
759 static_cast<hid_t
>(mem_space),
760 static_cast<hid_t
>(file_space),
761 static_cast<hid_t
>(dtpl),
764 std::stringstream ss;
765 ss<<
"Failure to read variable length string data from dataset ["
766 <<
link().path()<<
"]!";
772 if(buffer.size() > 0)
774 if(H5Dvlen_reclaim(
static_cast<hid_t
>(mem_type),
775 static_cast<hid_t
>(mem_space),
776 static_cast<hid_t
>(dtpl),
779 std::stringstream ss;
780 ss<<
"Error reclaiming memory from variable length string data in "
781 <<
"dataset ["<<
link().path()<<
"]!";
788 void read_fixed_length_string_data(T &data,
789 const datatype::Datatype &mem_type,
790 const dataspace::Dataspace &mem_space,
791 const datatype::Datatype &,
792 const dataspace::Dataspace &file_space,
793 const property::DatasetTransferList &dtpl)
const
795 using Trait = FixedLengthStringTrait<T>;
799 if(file_space.size() > 0)
801 if(H5Dread(
static_cast<hid_t
>(*
this),
802 static_cast<hid_t
>(mem_type),
803 static_cast<hid_t
>(mem_space),
804 static_cast<hid_t
>(file_space),
805 static_cast<hid_t
>(dtpl),
808 std::stringstream ss;
809 ss<<
"Failure to read fixed length string data to dataset ["<<
link().path()<<
"]!";
819 #pragma clang diagnostic pop
830 write_variable_length_data(data,mem_type,mem_space,file_type_,file_space,dtpl);
837 write_variable_length_string_data(data,mem_type,mem_space,file_type_,file_space,dtpl);
841 write_fixed_length_string_data(data,mem_type,mem_space,file_type_,file_space,dtpl);
846 write_contiguous_data(data,mem_type,mem_space,file_type_,file_space,dtpl);
858 file_space.selection.all();
860 write(data,mem_type,mem_space,file_space,dtpl);
866 std::vector<unsigned long long> offset,
867 std::uint32_t filter_mask,
872 write_chunk(data, mem_type_holder.
get(data), mem_space_holder.
get(data), offset, filter_mask, dtpl);
877 std::vector<unsigned long long> offset,
878 std::uint32_t filter_mask,
883 write_chunk(data, mem_type_holder.
get(data), mem_space_holder.
get(data), offset, filter_mask, dtpl);
890 std::vector<unsigned long long> & offset,
891 std::uint32_t filter_mask,
894 size_t databytesize = signed2unsigned<unsigned long long>(mem_space.
size()) * mem_type.
size();
898 #if H5_VERSION_GE(1,10,3)
899 if(H5Dwrite_chunk(
static_cast<hid_t
>(*
this),
900 static_cast<hid_t
>(dtpl),
906 std::stringstream ss;
907 ss<<
"Failure to write chunk data to dataset ["<<
link().
path()<<
"]!";
911 if(H5DOwrite_chunk(
static_cast<hid_t
>(*
this),
912 static_cast<hid_t
>(dtpl),
918 std::stringstream ss;
919 ss<<
"Failure to write chunk data to dataset ["<<
link().
path()<<
"]!";
926 std::stringstream ss;
927 ss<<
"Failure to write non-integer chunk data to dataset ["<<
link().
path()<<
"]!";
932 #if H5_VERSION_GE(1,10,2)
936 std::vector<unsigned long long> offset,
940 return read_chunk(data, mem_type_holder.
get(data), offset, dtpl);
946 std::vector<unsigned long long> & offset,
949 std::uint32_t filter_mask;
952 #if H5_VERSION_GE(1,10,3)
953 if(H5Dread_chunk(
static_cast<hid_t
>(*
this),
954 static_cast<hid_t
>(dtpl),
959 std::stringstream ss;
960 ss<<
"Failure to read chunk data from dataset ["<<
link().
path()<<
"]!";
964 if(H5DOread_chunk(
static_cast<hid_t
>(*
this),
965 static_cast<hid_t
>(dtpl),
970 std::stringstream ss;
971 ss<<
"Failure to read chunk data from dataset ["<<
link().
path()<<
"]!";
978 std::stringstream ss;
979 ss<<
"Failure to read non-integer chunk data from dataset ["<<
link().
path()<<
"]!";
1003 template<
typename T>
1010 file_space.selection.all();
1012 if (file_space.size() == mem_space.
size() &&
1017 if(file_simple_space.
rank() > 1 && mem_simple_space.
rank() == 1){
1018 return write(data,mem_type,file_space,file_space,dtpl);
1021 write(data,mem_type,mem_space,file_space,dtpl);
1025 template<
typename T>
1033 read_variable_length_data(data,mem_type,mem_space,file_type_,file_space,dtpl);
1040 read_variable_length_string_data(data,mem_type,mem_space,file_type_,file_space,dtpl);
1044 read_fixed_length_string_data(data,mem_type,mem_space,file_type_,file_space,dtpl);
1049 read_contiguous_data(data,mem_type,mem_space,file_type_,file_space,dtpl);
1054 template<
typename T>
1060 read_reshape(data, mem_type_holder.
get(data), mem_space_holder.
get(data), selection, dtpl);
1063 template<
typename T>
1069 read_reshape(data, mem_type_holder.
get(data), mem_space_holder.
get(data), selection, dtpl);
1072 template<
typename T>
1082 return read(data,mem_type,mem_space,file_space,dtpl);
1085 if(hyper.
rank() > 1) {
1087 if (selected_space.
size() == mem_space.
size()) {
1089 return read(data,mem_type,selected_space,file_space,dtpl);
1093 catch(
const std::bad_cast&) { }
1094 read(data,mem_type,mem_space,file_space,dtpl);
1097 template<
typename T>
1106 read(data,memory_type,memory_space,file_space,dtpl);
1109 template<
typename T>
1117 read(data,memory_type,memory_space,file_space,dtpl);
1120 template<
typename T>
1126 write_reshape(data, mem_type_holder.
get(data), mem_space_holder.
get(data), selection, dtpl);
1129 template<
typename T>
1135 write_reshape(data, mem_type_holder.
get(data), mem_space_holder.
get(data), selection, dtpl);
1138 template<
typename T>
1149 return write(data,mem_type,mem_space,file_space,dtpl);
1152 if(hyper.
rank() > 1) {
1155 if(selected_space.
rank() > 1 &&
1156 mem_simple_space.
rank() == 1 &&
1157 selected_space.
size() == mem_space.
size()) {
1159 return write(data,mem_type,selected_space,file_space,dtpl);
1163 catch(
const std::bad_cast&) { }
1164 write(data,mem_type,mem_space,file_space,dtpl);
1168 template<
typename T>
1182 template<
typename T>
1191 template<
typename T>
1198 file_space.selection.all();
1200 if (file_space.size() == mem_space.
size()){
1201 read(data,mem_type,file_space,file_space,dtpl);
1204 read(data,mem_type,mem_space,file_space,dtpl);
path to a node object
Definition: path.hpp:54
data space object holder
Definition: type_trait.hpp:124
const Dataspace & get(const T &v)
factory holder method for getting reference of data spaces
Definition: type_trait.hpp:158
data space object pool
Definition: pool.hpp:42
dataspace base class
Definition: dataspace.hpp:41
SelectionManager selection
access to selection manager
Definition: dataspace.hpp:144
Type type() const
get the type of the dataspace
virtual hssize_t size() const
number of elements in the dataspace
hyperslab selection class
Definition: hyperslab.hpp:52
size_t rank() const noexcept
get rank
virtual Dimensions dimensions() const override
get current dimensions
scalar dataspace
Definition: scalar.hpp:44
void all() const
select everything
selection base class
Definition: selection.hpp:42
virtual SelectionType type() const =0
get the selection type
simple multidimensional dataspace
Definition: simple.hpp:43
size_t rank() const
get number of dimensions
data type object holder
Definition: factory.hpp:54
const Datatype & get(const T &v=T{})
factory holder method for getting reference of data types
Definition: factory.hpp:74
base class for all data types
Definition: datatype.hpp:42
Class get_class() const
returns the datatypes class
virtual size_t size() const
get size of type in bytes
string datatype
Definition: string.hpp:40
bool is_variable_length() const
return true if type is a variable length string
static Singleton & instance()
reference to singleton
Definition: error.hpp:59
void throw_with_stack(const std::string &message)
throws an exception, potentially nested with error stack
utility container for external filters
Definition: external_filter.hpp:123
Definition: dataset.hpp:60
void write(const T &data, const datatype::Datatype &mem_type, const dataspace::Dataspace &mem_space, const dataspace::Dataspace &file_space, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const
write data to the dataset
Definition: dataset.hpp:823
void read_reshape(T &data, const datatype::Datatype &mem_type, const dataspace::Dataspace &mem_space, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const
Definition: dataset.hpp:1192
void write(const char *data, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const
dataspace::Dataspace dataspace() const
get dataspace of dataset
void extent(const Dimensions &dims) const
set extent of the dataset
void refresh() const
refresh the dataset (since hdf5 1.10.0)
property::DatasetAccessList access_list() const
get the dataset access property list for the instance
Dataset()=default
default constructor
void resize(const Dimensions &dims) const
resize the dataset
datatype::Datatype datatype() const
get datatype of dataset
Dataset(const Node &node)
construct
void extent(size_t dim, ssize_t delta_elements) const
unsigned long long chunk_storage_size(std::vector< unsigned long long > offset) const
read dataset chunk
void write(const char *data, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get())
write entire dataset
Dataset(const Group &base, const Path &path, const datatype::Datatype &type, const dataspace::Dataspace &space=dataspace::Scalar(), const property::LinkCreationList &lcpl=property::LinkCreationList(), const property::DatasetCreationList &dcpl=property::DatasetCreationList(), const property::DatasetAccessList &dapl=property::DatasetAccessList())
constructor
property::DatasetCreationList creation_list() const
get the dataset creation property list used for creation
void read(T &data, const datatype::Datatype &mem_type, const dataspace::Dataspace &mem_space, const dataspace::Dataspace &file_space, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const
read data from the dataset
Definition: dataset.hpp:1026
std::uint32_t read_chunk(T &data, const datatype::Datatype &mem_type, std::vector< unsigned long long > &offset, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const
read dataset chunk
filter::ExternalFilters filters() const
get the dataset external filters for the instance
void write_chunk(const T &data, std::vector< unsigned long long > offset, std::uint32_t filter_mask=0, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get())
write dataset chunk
Definition: dataset.hpp:865
std::uint32_t read_chunk(T &data, std::vector< unsigned long long > offset, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const
read dataset chunk (since hdf5 1.10.2)
void write_reshape(const T &data, const datatype::Datatype &mem_type, const dataspace::Dataspace &mem_space, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const
write entire dataset
Definition: dataset.hpp:1004
Path path() const
get path of the link
const Link & link() const
return link to object
dataset access property list
Definition: dataset_access.hpp:76
dataset creation property list
Definition: dataset_creation.hpp:111
class for a dataset transfer property list
Definition: dataset_transfer.hpp:57
static const DatasetTransferList & get()
reference to const static DatasetTransferList object
Definition: dataset_transfer.hpp:88
Definition: link_creation.hpp:35
const void * cptr(const T &value)
Definition: type_trait.hpp:116
void * ptr(T &value)
Definition: type_trait.hpp:111
TypeTrait< T >::DataspaceType create(const T &value)
factory function for dataspaces
Definition: type_trait.hpp:89
Class
Definition: types.hpp:53
@ String
indicates a string type
@ VarLength
indicates a variable length type
@ Integer
indicates an integer type
File from_buffer(T &data, ImageFlags flags=ImageFlags::ReadOnly)
load an image file from a buffer
Definition: functions.hpp:126
void resize_by(const Dataset &dataset, size_t dimension_index, ssize_t delta)
resize a dataset by a particular offset
void link(const Node &target, const Group &link_base, const Path &link_path, const property::LinkCreationList &lcpl=property::LinkCreationList(), const property::LinkAccessList &lapl=property::LinkAccessList())
Create a soft or external link.
top-level namespace of the entire library
Definition: attribute.hpp:45
std::vector< hsize_t > Dimensions
Definition: types.hpp:32
std::vector< hvl_t > VarLengthDataBuffer
Definition: types.hpp:34
static void to_buffer(const T &, VarLengthDataBuffer &)
Definition: types.hpp:45
static void from_buffer(const VarLengthDataBuffer &, T &)
Definition: types.hpp:48
#define DLL_EXPORT
Definition: windows.hpp:29