161 void extent(
size_t dim,ssize_t delta_elements)
const;
181 #if H5_VERSION_GE(1,10,0) 182 void refresh()
const;
284 void write_chunk(
const T &data,
285 std::vector<unsigned long long> offset,
286 std::uint32_t filter_mask = 0,
290 #if H5_VERSION_GE(1,10,2) 305 std::uint32_t read_chunk(T &data,
306 std::vector<unsigned long long> offset,
322 unsigned long long chunk_storage_size( std::vector<unsigned long long> offset)
const;
410 static Node create_dataset(
const Group &base,
422 void write_variable_length_data(
const T &data,
431 if(H5Dwrite(static_cast<hid_t>(*
this),
432 static_cast<hid_t>(mem_type),
433 static_cast<hid_t>(mem_space),
434 static_cast<hid_t>(file_space),
435 static_cast<hid_t>(dtpl),
438 std::stringstream ss;
439 ss<<
"Failure to write variable length data to dataset ["<<
link().path()<<
"]!";
445 void write_contiguous_data(
const T &data,
452 if(H5Dwrite(static_cast<hid_t>(*
this),
453 static_cast<hid_t>(mem_type),
454 static_cast<hid_t>(mem_space),
455 static_cast<hid_t>(file_space),
456 static_cast<hid_t>(dtpl),
459 std::stringstream ss;
460 ss<<
"Failure to write contiguous data to dataset ["<<
link().path()<<
"]!";
466 void write_variable_length_string_data(
const T &data,
474 auto buffer = Trait::to_buffer(data);
476 if(H5Dwrite(static_cast<hid_t>(*
this),
477 static_cast<hid_t>(mem_type),
478 static_cast<hid_t>(mem_space),
479 static_cast<hid_t>(file_space),
480 static_cast<hid_t>(dtpl),
481 reinterpret_cast<void*>(buffer.data()))<0)
483 std::stringstream ss;
484 ss<<
"Failure to write variable length string data to dataset ["<<
link().path()<<
"]!";
490 void write_fixed_length_string_data(
const T &data,
498 auto buffer = Trait::to_buffer(data,mem_type,mem_space);
500 if(H5Dwrite(static_cast<hid_t>(*
this),
501 static_cast<hid_t>(mem_type),
502 static_cast<hid_t>(mem_space),
503 static_cast<hid_t>(file_space),
504 static_cast<hid_t>(dtpl),
505 reinterpret_cast<void*>(buffer.data()))<0)
507 std::stringstream ss;
508 ss<<
"Failure to write fixed length string data to dataset ["<<
link().path()<<
"]!";
519 void read_variable_length_data(T &data,
533 buffer.resize(file_space.
size());
536 if(H5Dread(static_cast<hid_t>(*
this),
537 static_cast<hid_t>(mem_type),
538 static_cast<hid_t>(mem_space),
539 static_cast<hid_t>(file_space),
540 static_cast<hid_t>(dtpl),
543 std::stringstream ss;
544 ss<<
"Failure to read variable length data from dataset ["<<
link().path()<<
"]!";
550 if(H5Dvlen_reclaim(static_cast<hid_t>(file_type),
551 static_cast<hid_t>(file_space),
552 static_cast<hid_t>(dtpl),
560 void read_contiguous_data(T &data,
567 if(H5Dread(static_cast<hid_t>(*
this),
568 static_cast<hid_t>(mem_type),
569 static_cast<hid_t>(mem_space),
570 static_cast<hid_t>(file_space),
571 static_cast<hid_t>(dtpl),
574 std::stringstream ss;
575 ss<<
"Failure to read contiguous data from dataset ["<<
link().path()<<
"]!";
581 void read_variable_length_string_data(T &data,
590 typename Trait::BufferType buffer(mem_space.
size());
593 if(H5Dread(static_cast<hid_t>(*
this),
594 static_cast<hid_t>(mem_type),
595 static_cast<hid_t>(mem_space),
596 static_cast<hid_t>(file_space),
597 static_cast<hid_t>(dtpl),
600 std::stringstream ss;
601 ss<<
"Failure to read variable length string data from dataset [" 602 <<
link().path()<<
"]!";
608 if(buffer.size() > 0)
610 if(H5Dvlen_reclaim(static_cast<hid_t>(mem_type),
611 static_cast<hid_t>(mem_space),
612 static_cast<hid_t>(dtpl),
615 std::stringstream ss;
616 ss<<
"Error reclaiming memory from variable length string data in " 617 <<
"dataset ["<<
link().path()<<
"]!";
624 void read_fixed_length_string_data(T &data,
635 if(file_space.
size() > 0)
637 if(H5Dread(static_cast<hid_t>(*
this),
638 static_cast<hid_t>(mem_type),
639 static_cast<hid_t>(mem_space),
640 static_cast<hid_t>(file_space),
641 static_cast<hid_t>(dtpl),
644 std::stringstream ss;
645 ss<<
"Failure to read fixed length string data to dataset ["<<
link().path()<<
"]!";
665 write_variable_length_data(data,mem_type,mem_space,file_type,file_space,dtpl);
672 write_variable_length_string_data(data,mem_type,mem_space,file_type,file_space,dtpl);
676 write_fixed_length_string_data(data,mem_type,mem_space,file_type,file_space,dtpl);
681 write_contiguous_data(data,mem_type,mem_space,file_type,file_space,dtpl);
692 auto file_space = dataspace();
693 file_space.selection.all();
695 write(data,mem_type,mem_space,file_space,dtpl);
701 std::vector<unsigned long long> offset,
702 std::uint32_t filter_mask,
707 size_t databytesize = memory_space.size() * memory_type.size();
711 #if H5_VERSION_GE(1,10,3) 712 if(H5Dwrite_chunk(static_cast<hid_t>(*
this),
713 static_cast<hid_t>(dtpl),
719 std::stringstream ss;
720 ss<<
"Failure to write chunk data to dataset ["<<
link().path()<<
"]!";
724 if(H5DOwrite_chunk(static_cast<hid_t>(*
this),
725 static_cast<hid_t>(dtpl),
731 std::stringstream ss;
732 ss<<
"Failure to write chunk data to dataset ["<<
link().path()<<
"]!";
739 std::stringstream ss;
740 ss<<
"Failure to write non-integer chunk data to dataset ["<<
link().path()<<
"]!";
745 #if H5_VERSION_GE(1,10,2) 748 std::uint32_t Dataset::read_chunk(T &data,
749 std::vector<unsigned long long> offset,
753 std::uint32_t filter_mask;
756 #if H5_VERSION_GE(1,10,3) 757 if(H5Dread_chunk(static_cast<hid_t>(*
this),
758 static_cast<hid_t>(dtpl),
763 std::stringstream ss;
764 ss<<
"Failure to read chunk data from dataset ["<<
link().path()<<
"]!";
768 if(H5DOread_chunk(static_cast<hid_t>(*
this),
769 static_cast<hid_t>(dtpl),
774 std::stringstream ss;
775 ss<<
"Failure to read chunk data from dataset ["<<
link().path()<<
"]!";
782 std::stringstream ss;
783 ss<<
"Failure to read non-integer chunk data from dataset ["<<
link().path()<<
"]!";
796 auto file_space = dataspace();
797 file_space.selection.all();
799 if (file_space.size() == memory_space.size() &&
804 if(fl_space.
rank() > 1 && mem_space.
rank() == 1){
805 write(data,memory_type,file_space,file_space,dtpl);
809 write(data,memory_type,memory_space,file_space,dtpl);
822 read_variable_length_data(data,mem_type,mem_space,file_type,file_space,dtpl);
829 read_variable_length_string_data(data,mem_type,mem_space,file_type,file_space,dtpl);
833 read_fixed_length_string_data(data,mem_type,mem_space,file_type,file_space,dtpl);
838 read_contiguous_data(data,mem_type,mem_space,file_type,file_space,dtpl);
854 auto dims = hyper.
block();
855 auto count = hyper.
count();
856 for(Dimensions::size_type i = 0; i != dims.size(); i++)
860 if (selected_space.
size() == memory_space.size())
861 read(data,memory_type,selected_space,file_space,dtpl);
863 read(data,memory_type,memory_space,file_space,dtpl);
865 catch(
const std::bad_cast&){
866 read(data,memory_type,memory_space,file_space,dtpl);
879 read(data,memory_type,memory_space,file_space,dtpl);
890 read(data,memory_type,memory_space,file_space,dtpl);
903 write(data,memory_type,memory_space,file_space,dtpl);
911 auto dims = hyper.
block();
912 auto count = hyper.
count();
913 for(Dimensions::size_type i = 0; i != dims.size(); i++)
916 if(selected_space.
rank() > 1 &&
917 mem_space.
rank() == 1 &&
918 selected_space.
size() == memory_space.size())
919 write(data,memory_type,selected_space,file_space,dtpl);
921 write(data,memory_type,memory_space,file_space,dtpl);
924 catch(
const std::bad_cast&){
925 write(data,memory_type,memory_space,file_space,dtpl);
936 auto file_space = dataspace();
937 file_space.selection.all();
939 if (file_space.size() == memory_space.size()){
940 read(data,memory_type,file_space,file_space,dtpl);
943 read(data,memory_type,memory_space,file_space,dtpl);
TypeTrait< T >::DataspaceType create(const T &value)
factory function for dataspaces
Definition: type_trait.hpp:115
dataspace base class
Definition: dataspace.hpp:41
scalar dataspace
Definition: scalar.hpp:40
Definition: link_creation.hpp:35
static Singleton & instance()
reference to singleton
Definition: error.hpp:50
size_t rank() const
get number of dimensions
void throw_with_stack(const std::string &message)
throws an exception, potentially nested with error stack
string datatype
Definition: string.hpp:39
indicates an integer type
selection base class
Definition: selection.hpp:42
void all() const
select everything
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()) const
read data from the dataset
Definition: dataset.hpp:814
void count(size_t index, size_t value)
set count value for a particular dimension
File from_buffer(T &data, ImageFlags flags=ImageFlags::READONLY)
load an image file from a buffer
Definition: functions.hpp:120
SelectionType type() const
get the type of the current selection
Definition: dataset.hpp:50
const void * cptr(const T &value)
Definition: type_trait.hpp:125
hyperslab selection class
Definition: hyperslab.hpp:51
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()) const
write data to the dataset
Definition: dataset.hpp:656
utility container for external filters
Definition: external_filter.hpp:116
bool is_variable_length() const
return true if type is a variable length string
dataset creation property list
Definition: dataset_creation.hpp:110
dataset access property list
Definition: dataset_access.hpp:73
std::vector< hvl_t > VarLengthDataBuffer
Definition: types.hpp:38
virtual hssize_t size() const
number of elements in the dataspace
Definition: attribute.hpp:43
void block(size_t index, size_t value)
set block size for dimension
simple multidimensional dataspace
Definition: simple.hpp:39
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.
size_t size() const
return the number of elements in the current selection
static void from_buffer(const VarLengthDataBuffer &, T &)
Definition: types.hpp:52
void resize_by(const Dataset &dataset, size_t dimension_index, ssize_t delta)
resize a dataset by a particular offset
TypeTrait< typename std::remove_const< T >::type >::TypeClass create(const T &v=T())
factory function for creating data types
Definition: factory.hpp:38
Definition: dataset_transfer.hpp:53
std::vector< hsize_t > Dimensions
Definition: types.hpp:36
void * ptr(T &value)
Definition: type_trait.hpp:120
path to a node object
Definition: path.hpp:49
#define DLL_EXPORT
Definition: windows.hpp:35
static void to_buffer(const T &, VarLengthDataBuffer &)
Definition: types.hpp:49
void write_chunk(const T &data, std::vector< unsigned long long > offset, std::uint32_t filter_mask=0, const property::DatasetTransferList &dtpl=property::DatasetTransferList()) const
write dataset chunk
Definition: dataset.hpp:700
SelectionManager selection
access to selection manager
Definition: dataspace.hpp:151
Class get_class() const
returns the datatypes class
Definition: fixed_length_string.hpp:56
variable length string buffer trait
Definition: variable_length_string.hpp:53
base class for all data types
Definition: datatype.hpp:41
indicates a variable length type