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))
223 property::DatasetTransferList::get())
const;
235 property::DatasetTransferList::get())
const;
259 property::DatasetTransferList::get())
const;
266 property::DatasetTransferList::get())
const;
269 void read_reshape(T &data,
273 property::DatasetTransferList::get())
const;
288 property::DatasetTransferList::get());
291 property::DatasetTransferList::get())
const;
307 void write_reshape(
const T &data,
311 property::DatasetTransferList::get())
const;
323 property::DatasetTransferList::get());
325 property::DatasetTransferList::get())
const;
340 void write_chunk(
const T &data,
341 std::vector<hsize_t> offset,
342 std::uint32_t filter_mask = 0,
344 property::DatasetTransferList::get());
347 void write_chunk(
const T &data,
348 std::vector<hsize_t> offset,
349 std::uint32_t filter_mask = 0,
351 property::DatasetTransferList::get())
const;
368 void write_chunk(
const T &data,
371 std::vector<hsize_t> & offset,
372 std::uint32_t filter_mask = 0,
374 property::DatasetTransferList::get())
const;
376#if (defined(_DOXYGEN_) || H5_VERSION_GE(1,10,2))
392 std::vector<hsize_t> offset,
394 property::DatasetTransferList::get())
const;
413 std::vector<hsize_t> & offset,
415 property::DatasetTransferList::get())
const;
434 std::vector<hsize_t> offset,
436 property::DatasetTransferList::get())
const;
457 std::vector<hsize_t> & offset,
459 property::DatasetTransferList::get())
const;
487 property::DatasetTransferList::get());
490 property::DatasetTransferList::get())
const;
506 property::DatasetTransferList::get());
510 property::DatasetTransferList::get())
const;
527 void write_reshape(
const T &data,
532 property::DatasetTransferList::get())
const;
549 property::DatasetTransferList::get());
553 property::DatasetTransferList::get())
const;
572 void read_reshape(T &data,
577 property::DatasetTransferList::get())
const;
617 static Node create_dataset(
const Group &base,
629 void write_variable_length_data(
const T &data,
638 if(H5Dwrite(
static_cast<hid_t
>(*
this),
639 static_cast<hid_t
>(mem_type),
640 static_cast<hid_t
>(mem_space),
641 static_cast<hid_t
>(file_space),
642 static_cast<hid_t
>(dtpl),
645 std::stringstream ss;
646 ss<<
"Failure to write variable length data to dataset ["<<
link().path()<<
"]!";
647 error::Singleton::instance().throw_with_stack(ss.str());
652 void write_contiguous_data(
const T &data,
659 if(H5Dwrite(
static_cast<hid_t
>(*
this),
660 static_cast<hid_t
>(mem_type),
661 static_cast<hid_t
>(mem_space),
662 static_cast<hid_t
>(file_space),
663 static_cast<hid_t
>(dtpl),
664 dataspace::cptr(data))<0)
666 std::stringstream ss;
667 ss<<
"Failure to write contiguous data to dataset ["<<link().path()<<
"]!";
668 error::Singleton::instance().throw_with_stack(ss.str());
673 void write_variable_length_string_data(
const T &data,
674 const datatype::Datatype &mem_type,
675 const dataspace::Dataspace &mem_space,
676 const datatype::Datatype &,
677 const dataspace::Dataspace &file_space,
678 const property::DatasetTransferList &dtpl)
const
680 using Trait = VarLengthStringTrait<T>;
681 auto buffer = Trait::to_buffer(data);
683 if(H5Dwrite(
static_cast<hid_t
>(*
this),
684 static_cast<hid_t
>(mem_type),
685 static_cast<hid_t
>(mem_space),
686 static_cast<hid_t
>(file_space),
687 static_cast<hid_t
>(dtpl),
688 reinterpret_cast<void*
>(buffer.data()))<0)
690 std::stringstream ss;
691 ss<<
"Failure to write variable length string data to dataset ["<<
link().path()<<
"]!";
692 error::Singleton::instance().throw_with_stack(ss.str());
697 void write_fixed_length_string_data(
const T &data,
698 const datatype::Datatype &mem_type,
699 const dataspace::Dataspace &mem_space,
700 const datatype::Datatype &,
701 const dataspace::Dataspace &file_space,
702 const property::DatasetTransferList &dtpl)
const
704 using Trait = FixedLengthStringTrait<T>;
705 auto buffer = Trait::to_buffer(data,mem_type,mem_space);
707 if(H5Dwrite(
static_cast<hid_t
>(*
this),
708 static_cast<hid_t
>(mem_type),
709 static_cast<hid_t
>(mem_space),
710 static_cast<hid_t
>(file_space),
711 static_cast<hid_t
>(dtpl),
712 reinterpret_cast<void*
>(buffer.data()))<0)
714 std::stringstream ss;
715 ss<<
"Failure to write fixed length string data to dataset ["<<
link().path()<<
"]!";
716 error::Singleton::instance().throw_with_stack(ss.str());
726 void read_variable_length_data(T &data,
727 const datatype::Datatype &mem_type,
728 const dataspace::Dataspace &mem_space,
729 const datatype::Datatype &file_type,
730 const dataspace::Dataspace &file_space,
731 const property::DatasetTransferList &dtpl)
const
734 if(file_space.selection.type() != dataspace::SelectionType::All)
736 buffer.resize(file_space.selection.size());
740 buffer.resize(signed2unsigned<size_t>(file_space.size()));
743 if(H5Dread(
static_cast<hid_t
>(*
this),
744 static_cast<hid_t
>(mem_type),
745 static_cast<hid_t
>(mem_space),
746 static_cast<hid_t
>(file_space),
747 static_cast<hid_t
>(dtpl),
750 std::stringstream ss;
751 ss<<
"Failure to read variable length data from dataset ["<<
link().path()<<
"]!";
752 error::Singleton::instance().throw_with_stack(ss.str());
755 VarLengthBufferTrait<T>::from_buffer(buffer,data);
757 if(H5Dvlen_reclaim(
static_cast<hid_t
>(file_type),
758 static_cast<hid_t
>(file_space),
759 static_cast<hid_t
>(dtpl),
762 error::Singleton::instance().throw_with_stack(
"Error reclaiming variable length memory!");
767 void read_contiguous_data(T &data,
768 const datatype::Datatype &mem_type,
769 const dataspace::Dataspace &mem_space,
770 const datatype::Datatype &,
771 const dataspace::Dataspace &file_space,
772 const property::DatasetTransferList &dtpl)
const
774 if(H5Dread(
static_cast<hid_t
>(*
this),
775 static_cast<hid_t
>(mem_type),
776 static_cast<hid_t
>(mem_space),
777 static_cast<hid_t
>(file_space),
778 static_cast<hid_t
>(dtpl),
779 dataspace::ptr(data))<0)
781 std::stringstream ss;
782 ss<<
"Failure to read contiguous data from dataset ["<<
link().path()<<
"]!";
783 error::Singleton::instance().throw_with_stack(ss.str());
788 void read_variable_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 = VarLengthStringTrait<T>;
796 using size_type =
typename std::vector<T>::size_type;
798 typename Trait::BufferType buffer(
static_cast<size_type
>(mem_space.size()));
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 variable length string data from dataset ["
810 <<
link().path()<<
"]!";
811 error::Singleton::instance().throw_with_stack(ss.str());
814 Trait::from_buffer(buffer,data);
816 if(buffer.size() > 0)
818 if(H5Dvlen_reclaim(
static_cast<hid_t
>(mem_type),
819 static_cast<hid_t
>(mem_space),
820 static_cast<hid_t
>(dtpl),
823 std::stringstream ss;
824 ss<<
"Error reclaiming memory from variable length string data in "
825 <<
"dataset ["<<
link().path()<<
"]!";
826 error::Singleton::instance().throw_with_stack(ss.str());
832 void read_fixed_length_string_data(T &data,
833 const datatype::Datatype &mem_type,
834 const dataspace::Dataspace &mem_space,
835 const datatype::Datatype &,
836 const dataspace::Dataspace &file_space,
837 const property::DatasetTransferList &dtpl)
const
839 using Trait = FixedLengthStringTrait<T>;
841 auto buffer = Trait::BufferType::create(mem_type,mem_space);
843 if(file_space.size() > 0)
845 if(H5Dread(
static_cast<hid_t
>(*
this),
846 static_cast<hid_t
>(mem_type),
847 static_cast<hid_t
>(mem_space),
848 static_cast<hid_t
>(file_space),
849 static_cast<hid_t
>(dtpl),
852 std::stringstream ss;
853 ss<<
"Failure to read fixed length string data to dataset ["<<
link().path()<<
"]!";
854 error::Singleton::instance().throw_with_stack(ss.str());
858 data = Trait::from_buffer(buffer,mem_type,mem_space);
863#pragma clang diagnostic pop
874 write_variable_length_data(data,mem_type,mem_space,file_type_,file_space,dtpl);
881 write_variable_length_string_data(data,mem_type,mem_space,file_type_,file_space,dtpl);
885 write_fixed_length_string_data(data,mem_type,mem_space,file_type_,file_space,dtpl);
890 write_contiguous_data(data,mem_type,mem_space,file_type_,file_space,dtpl);
902 file_space.selection.all();
904 write(data,mem_type,mem_space,file_space,dtpl);
910 std::vector<hsize_t> offset,
911 std::uint32_t filter_mask,
916 write_chunk(data, mem_type_holder.
get(data), mem_space_holder.
get(data), offset, filter_mask, dtpl);
921 std::vector<hsize_t> offset,
922 std::uint32_t filter_mask,
927 write_chunk(data, mem_type_holder.
get(data), mem_space_holder.
get(data), offset, filter_mask, dtpl);
934 std::vector<hsize_t> & offset,
935 std::uint32_t filter_mask,
938 size_t databytesize = signed2unsigned<hsize_t>(mem_space.
size()) * mem_type.
size();
942#if H5_VERSION_GE(1,10,3)
943 if(H5Dwrite_chunk(
static_cast<hid_t
>(*
this),
944 static_cast<hid_t
>(dtpl),
950 std::stringstream ss;
951 ss<<
"Failure to write chunk data to dataset ["<<
link().
path()<<
"]!";
955 if(H5DOwrite_chunk(
static_cast<hid_t
>(*
this),
956 static_cast<hid_t
>(dtpl),
962 std::stringstream ss;
963 ss<<
"Failure to write chunk data to dataset ["<<
link().
path()<<
"]!";
970 std::stringstream ss;
971 ss<<
"Failure to write non-integer chunk data to dataset ["<<
link().
path()<<
"]!";
976#if H5_VERSION_GE(1,10,2)
980 std::vector<hsize_t> offset,
984 return read_chunk(data, mem_type_holder.
get(data), offset, dtpl);
990 std::vector<hsize_t> offset,
994 return read_chunk(data, byte_size, mem_type_holder.
get(data), offset, dtpl);
999 const datatype::Datatype &mem_type,
1000 std::vector<hsize_t> & offset,
1001 const property::DatasetTransferList &dtpl)
const
1003 std::uint32_t filter_mask;
1006#if H5_VERSION_GE(2,0,0)
1007 if(H5Dread_chunk1(
static_cast<hid_t
>(*
this),
1008 static_cast<hid_t
>(dtpl),
1013 std::stringstream ss;
1014 ss<<
"Failure to read chunk data from dataset ["<<
link().
path()<<
"]!";
1017#elif H5_VERSION_GE(1,10,3)
1018 if(H5Dread_chunk(
static_cast<hid_t
>(*
this),
1019 static_cast<hid_t
>(dtpl),
1024 std::stringstream ss;
1025 ss<<
"Failure to read chunk data from dataset ["<<
link().
path()<<
"]!";
1029 if(H5DOread_chunk(
static_cast<hid_t
>(*
this),
1030 static_cast<hid_t
>(dtpl),
1035 std::stringstream ss;
1036 ss<<
"Failure to read chunk data from dataset ["<<
link().
path()<<
"]!";
1043 std::stringstream ss;
1044 ss<<
"Failure to read non-integer chunk data from dataset ["<<
link().
path()<<
"]!";
1054 const datatype::Datatype &mem_type,
1055 std::vector<hsize_t> & offset,
1056 const property::DatasetTransferList &dtpl)
const
1058 std::uint32_t filter_mask = 0;
1061#if H5_VERSION_GE(2,0,0)
1062 if(H5Dread_chunk(
static_cast<hid_t
>(*
this),
1063 static_cast<hid_t
>(dtpl),
1068 std::stringstream ss;
1069 ss<<
"Failure to read chunk data from dataset ["<<
link().
path()<<
"]!";
1077 std::stringstream ss;
1078 ss<<
"Failure to read chunk data from dataset ["<<
link().
path()<<
"]!";
1085 std::stringstream ss;
1086 ss<<
"Failure to read non-integer chunk data from dataset ["<<
link().
path()<<
"]!";
1132 file_space.selection.all();
1134 if (file_space.size() == mem_space.
size() &&
1139 if(file_simple_space.
rank() > 1 && mem_simple_space.
rank() == 1){
1140 return write(data,mem_type,file_space,file_space,dtpl);
1143 write(data,mem_type,mem_space,file_space,dtpl);
1155 read_variable_length_data(data,mem_type,mem_space,file_type_,file_space,dtpl);
1162 read_variable_length_string_data(data,mem_type,mem_space,file_type_,file_space,dtpl);
1166 read_fixed_length_string_data(data,mem_type,mem_space,file_type_,file_space,dtpl);
1171 read_contiguous_data(data,mem_type,mem_space,file_type_,file_space,dtpl);
1182 read_reshape(data, mem_type_holder.
get(data), mem_space_holder.
get(data), selection, dtpl);
1191 read_reshape(data, mem_type_holder.
get(data), mem_space_holder.
get(data), selection, dtpl);
1204 return read(data,mem_type,mem_space,file_space,dtpl);
1207 if(hyper.
rank() > 1) {
1209 if (selected_space.
size() == mem_space.
size()) {
1211 return read(data,mem_type,selected_space,file_space,dtpl);
1215 catch(
const std::bad_cast&) { }
1216 read(data,mem_type,mem_space,file_space,dtpl);
1228 read(data,memory_type,memory_space,file_space,dtpl);
1239 read(data,memory_type,memory_space,file_space,dtpl);
1248 write_reshape(data, mem_type_holder.
get(data), mem_space_holder.
get(data), selection, dtpl);
1257 write_reshape(data, mem_type_holder.
get(data), mem_space_holder.
get(data), selection, dtpl);
1271 return write(data,mem_type,mem_space,file_space,dtpl);
1274 if(hyper.
rank() > 1) {
1277 if(selected_space.
rank() > 1 &&
1278 mem_simple_space.
rank() == 1 &&
1279 selected_space.
size() == mem_space.
size()) {
1281 return write(data,mem_type,selected_space,file_space,dtpl);
1285 catch(
const std::bad_cast&) { }
1286 write(data,mem_type,mem_space,file_space,dtpl);
1320 file_space.selection.all();
1322 if (file_space.size() == mem_space.
size()){
1323 read(data,mem_type,file_space,file_space,dtpl);
1326 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
hsize_t chunk_storage_size(std::vector< hsize_t > offset) const
read dataset chunk
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:867
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:1314
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
void write_chunk(const T &data, std::vector< hsize_t > offset, std::uint32_t filter_mask=0, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get())
write dataset chunk
Definition dataset.hpp:909
Dataset()=default
default constructor
void resize(const Dimensions &dims) const
resize the dataset
std::uint32_t read_chunk(T &data, const datatype::Datatype &mem_type, std::vector< hsize_t > &offset, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const
read dataset chunk
datatype::Datatype datatype() const
get datatype of dataset
Dataset(const Node &node)
construct
void extent(size_t dim, ssize_t delta_elements) const
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
std::uint32_t read_chunk(T &data, std::vector< hsize_t > offset, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const
read dataset chunk (since hdf5 1.10.2)
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:1148
filter::ExternalFilters filters() const
get the dataset external filters for the instance
std::uint32_t read_chunk(T &data, size_t byte_size, const datatype::Datatype &mem_type, std::vector< hsize_t > &offset, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const
read dataset chunk
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:1126
std::uint32_t read_chunk(T &data, size_t byte_size, std::vector< hsize_t > offset, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const
read dataset chunk (since hdf5 1.10.2)
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
Definition link_creation.hpp:35
void * ptr(T &value)
Definition type_trait.hpp:111
const void * cptr(const T &value)
Definition type_trait.hpp:116
Class
Definition types.hpp:53
@ String
indicates a string type
@ VarLength
indicates a variable length type
@ Integer
indicates an integer type
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
variable length buffer trait
Definition types.hpp:44
#define DLL_EXPORT
Definition windows.hpp:29