159 void extent(
size_t dim,ssize_t delta_elements)
const;
179 #if H5_VERSION_GE(1,10,0) 180 void refresh()
const;
282 void write_chunk(
const T &data,
283 std::vector<long long unsigned int> offset,
284 std::uint32_t filter_mask = 0,
288 #if H5_VERSION_GE(1,10,2) 303 std::uint32_t read_chunk(T &data,
304 std::vector<long long unsigned int> offset,
320 long long unsigned int chunk_storage_size( std::vector<long long unsigned int> offset)
const;
398 static Node create_dataset(
const Group &base,
410 void write_variable_length_data(
const T &data,
419 if(H5Dwrite(static_cast<hid_t>(*
this),
420 static_cast<hid_t>(mem_type),
421 static_cast<hid_t>(mem_space),
422 static_cast<hid_t>(file_space),
423 static_cast<hid_t>(dtpl),
426 std::stringstream ss;
427 ss<<
"Failure to write variable length data to dataset ["<<
link().path()<<
"]!";
433 void write_contiguous_data(
const T &data,
440 if(H5Dwrite(static_cast<hid_t>(*
this),
441 static_cast<hid_t>(mem_type),
442 static_cast<hid_t>(mem_space),
443 static_cast<hid_t>(file_space),
444 static_cast<hid_t>(dtpl),
447 std::stringstream ss;
448 ss<<
"Failure to write contiguous data to dataset ["<<
link().path()<<
"]!";
454 void write_variable_length_string_data(
const T &data,
462 auto buffer = Trait::to_buffer(data);
464 if(H5Dwrite(static_cast<hid_t>(*
this),
465 static_cast<hid_t>(mem_type),
466 static_cast<hid_t>(mem_space),
467 static_cast<hid_t>(file_space),
468 static_cast<hid_t>(dtpl),
469 reinterpret_cast<void*>(buffer.data()))<0)
471 std::stringstream ss;
472 ss<<
"Failure to write variable length string data to dataset ["<<
link().path()<<
"]!";
478 void write_fixed_length_string_data(
const T &data,
486 auto buffer = Trait::to_buffer(data,mem_type,mem_space);
488 if(H5Dwrite(static_cast<hid_t>(*
this),
489 static_cast<hid_t>(mem_type),
490 static_cast<hid_t>(mem_space),
491 static_cast<hid_t>(file_space),
492 static_cast<hid_t>(dtpl),
493 reinterpret_cast<void*>(buffer.data()))<0)
495 std::stringstream ss;
496 ss<<
"Failure to write fixed length string data to dataset ["<<
link().path()<<
"]!";
507 void read_variable_length_data(T &data,
521 buffer.resize(file_space.
size());
524 if(H5Dread(static_cast<hid_t>(*
this),
525 static_cast<hid_t>(mem_type),
526 static_cast<hid_t>(mem_space),
527 static_cast<hid_t>(file_space),
528 static_cast<hid_t>(dtpl),
531 std::stringstream ss;
532 ss<<
"Failure to read variable length data from dataset ["<<
link().path()<<
"]!";
538 if(H5Dvlen_reclaim(static_cast<hid_t>(file_type),
539 static_cast<hid_t>(file_space),
540 static_cast<hid_t>(dtpl),
548 void read_contiguous_data(T &data,
555 if(H5Dread(static_cast<hid_t>(*
this),
556 static_cast<hid_t>(mem_type),
557 static_cast<hid_t>(mem_space),
558 static_cast<hid_t>(file_space),
559 static_cast<hid_t>(dtpl),
562 std::stringstream ss;
563 ss<<
"Failure to read contiguous data from dataset ["<<
link().path()<<
"]!";
569 void read_variable_length_string_data(T &data,
578 typename Trait::BufferType buffer(mem_space.
size());
581 if(H5Dread(static_cast<hid_t>(*
this),
582 static_cast<hid_t>(mem_type),
583 static_cast<hid_t>(mem_space),
584 static_cast<hid_t>(file_space),
585 static_cast<hid_t>(dtpl),
588 std::stringstream ss;
589 ss<<
"Failure to read variable length string data from dataset [" 590 <<
link().path()<<
"]!";
594 Trait::from_buffer(buffer,data);
596 if(buffer.size() > 0)
598 if(H5Dvlen_reclaim(static_cast<hid_t>(mem_type),
599 static_cast<hid_t>(mem_space),
600 static_cast<hid_t>(dtpl),
603 std::stringstream ss;
604 ss<<
"Error reclaiming memory from variable length string data in " 605 <<
"dataset ["<<
link().path()<<
"]!";
612 void read_fixed_length_string_data(T &data,
623 if(file_space.
size() > 0)
625 if(H5Dread(static_cast<hid_t>(*
this),
626 static_cast<hid_t>(mem_type),
627 static_cast<hid_t>(mem_space),
628 static_cast<hid_t>(file_space),
629 static_cast<hid_t>(dtpl),
632 std::stringstream ss;
633 ss<<
"Failure to read fixed length string data to dataset ["<<
link().path()<<
"]!";
638 data = Trait::from_buffer(buffer,mem_type,mem_space);
653 write_variable_length_data(data,mem_type,mem_space,file_type,file_space,dtpl);
660 write_variable_length_string_data(data,mem_type,mem_space,file_type,file_space,dtpl);
664 write_fixed_length_string_data(data,mem_type,mem_space,file_type,file_space,dtpl);
669 write_contiguous_data(data,mem_type,mem_space,file_type,file_space,dtpl);
680 auto file_space = dataspace();
681 file_space.selection.all();
683 write(data,mem_type,mem_space,file_space,dtpl);
689 std::vector<long long unsigned int> offset,
690 std::uint32_t filter_mask,
695 size_t databytesize = memory_space.size() * memory_type.size();
699 #if H5_VERSION_GE(1,10,3) 700 if(H5Dwrite_chunk(static_cast<hid_t>(*
this),
701 static_cast<hid_t>(dtpl),
707 std::stringstream ss;
708 ss<<
"Failure to write chunk data to dataset ["<<
link().path()<<
"]!";
712 if(H5DOwrite_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()<<
"]!";
727 std::stringstream ss;
728 ss<<
"Failure to write non-integer chunk data to dataset ["<<
link().path()<<
"]!";
733 #if H5_VERSION_GE(1,10,2) 736 std::uint32_t Dataset::read_chunk(T &data,
737 std::vector<long long unsigned int> offset,
741 std::uint32_t filter_mask;
744 #if H5_VERSION_GE(1,10,3) 745 if(H5Dread_chunk(static_cast<hid_t>(*
this),
746 static_cast<hid_t>(dtpl),
751 std::stringstream ss;
752 ss<<
"Failure to read chunk data from dataset ["<<
link().path()<<
"]!";
756 if(H5DOread_chunk(static_cast<hid_t>(*
this),
757 static_cast<hid_t>(dtpl),
762 std::stringstream ss;
763 ss<<
"Failure to read chunk data from dataset ["<<
link().path()<<
"]!";
770 std::stringstream ss;
771 ss<<
"Failure to read non-integer chunk data from dataset ["<<
link().path()<<
"]!";
784 auto file_space = dataspace();
785 file_space.selection.all();
787 if (file_space.size() == memory_space.size() &&
792 if(fl_space.
rank() > 1 && mem_space.
rank() == 1){
793 write(data,memory_type,file_space,file_space,dtpl);
797 write(data,memory_type,memory_space,file_space,dtpl);
810 read_variable_length_data(data,mem_type,mem_space,file_type,file_space,dtpl);
817 read_variable_length_string_data(data,mem_type,mem_space,file_type,file_space,dtpl);
821 read_fixed_length_string_data(data,mem_type,mem_space,file_type,file_space,dtpl);
826 read_contiguous_data(data,mem_type,mem_space,file_type,file_space,dtpl);
842 auto dims = hyper.
block();
843 auto count = hyper.
count();
844 for(Dimensions::size_type i = 0; i != dims.size(); i++)
848 if (selected_space.
size() == memory_space.size())
849 read(data,memory_type,selected_space,file_space,dtpl);
851 read(data,memory_type,memory_space,file_space,dtpl);
853 catch(
const std::bad_cast&){
854 read(data,memory_type,memory_space,file_space,dtpl);
867 read(data,memory_type,memory_space,file_space,dtpl);
878 read(data,memory_type,memory_space,file_space,dtpl);
891 write(data,memory_type,memory_space,file_space,dtpl);
899 auto dims = hyper.
block();
900 auto count = hyper.
count();
901 for(Dimensions::size_type i = 0; i != dims.size(); i++)
904 if(selected_space.
rank() > 1 &&
905 mem_space.
rank() == 1 &&
906 selected_space.
size() == memory_space.size())
907 write(data,memory_type,selected_space,file_space,dtpl);
909 write(data,memory_type,memory_space,file_space,dtpl);
912 catch(
const std::bad_cast&){
913 write(data,memory_type,memory_space,file_space,dtpl);
924 auto file_space = dataspace();
925 file_space.selection.all();
927 if (file_space.size() == memory_space.size()){
928 read(data,memory_type,file_space,file_space,dtpl);
931 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:802
void count(size_t index, size_t value)
set count value for a particular dimension
SelectionType type() const
get the type of the current selection
Definition: dataset.hpp:49
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:644
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
void write_chunk(const T &data, std::vector< long long unsigned int > offset, std::uint32_t filter_mask=0, const property::DatasetTransferList &dtpl=property::DatasetTransferList()) const
write dataset chunk
Definition: dataset.hpp:688
DLL_EXPORT 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.
simple multidimensional dataspace
Definition: simple.hpp:39
size_t size() const
return the number of elements in the current selection
static void from_buffer(const VarLengthDataBuffer &, T &)
Definition: types.hpp:52
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
SelectionManager selection
access to selection manager
Definition: dataspace.hpp:151
Class get_class() const
returns the datatypes class
Definition: fixed_length_string.hpp:56
DLL_EXPORT void resize_by(const Dataset &dataset, size_t dimension_index, ssize_t delta)
resize a dataset by a particular offset
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