41 #include <initializer_list>
83 std::string name()
const;
88 bool is_valid()
const;
103 operator hid_t()
const
105 return static_cast<hid_t
>(handle_);
113 const node::Link &parent_link() const noexcept;
128 void write(const T& data) const;
146 void write(const
char *data) const;
166 void write(const std::initializer_list<T> &list)
const
168 write(std::vector<T>{list});
200 void read(T &data)
const;
213 void write_fixed_length_string(
const T &data,
220 if(H5Awrite(
static_cast<hid_t
>(handle_),
221 static_cast<hid_t
>(mem_type),
230 void write_variable_length_string(
const T &data,
231 const datatype::Datatype &mem_type)
const
233 using Trait = VarLengthStringTrait<T>;
234 auto buffer = Trait::to_buffer(data);
236 if(H5Awrite(
static_cast<hid_t
>(handle_),
237 static_cast<hid_t
>(mem_type),
246 void write_contiguous_data(
const T &data,
247 const datatype::Datatype &mem_type)
const
250 if(H5Awrite(
static_cast<hid_t
>(handle_),
static_cast<hid_t
>(mem_type),
ptr)<0)
257 void read_fixed_length_string(T &data,
258 const datatype::Datatype &mem_type)
const
260 using Trait = FixedLengthStringTrait<T>;
265 if(H5Aread(
static_cast<hid_t
>(handle_),
266 static_cast<hid_t
>(mem_type),
277 void read_variable_length_string(T &data,
278 const datatype::Datatype &mem_type)
const
280 using Trait = VarLengthStringTrait<T>;
282 typename Trait::BufferType buffer(
signed2unsigned<
typename std::vector<T>::size_type>(dataspace().size()));
284 if(H5Aread(
static_cast<hid_t
>(handle_),
285 static_cast<hid_t
>(mem_type),
293 if(H5Dvlen_reclaim(
static_cast<hid_t
>(mem_type),
294 static_cast<hid_t
>(dataspace()),
295 static_cast<hid_t
>(property::DatasetTransferList()),
298 std::stringstream ss;
299 ss<<
"Failure to reclaim buffer for variable length string"
300 <<
" string read on attribute!";
307 void read_contiguous_data(T &data,
308 const datatype::Datatype &mem_type)
const
312 if(H5Aread(
static_cast<hid_t
>(handle_),
static_cast<hid_t
>(mem_type),
ptr)<0)
318 void check_size(
const dataspace::Dataspace &mem_space,
319 const dataspace::Dataspace &file_space,
320 const std::string &operation)
const;
337 write_variable_length_string(data,mem_type);
341 write_fixed_length_string(data,mem_type);
346 write_contiguous_data(data,mem_type);
355 write(data,mem_type_holder.
get<T>());
364 read(data, file_type);
369 read(data, mem_type_holder.
get<T>(), file_type);
377 read(data, mem_type, file_type);
389 if(string_type.is_variable_length())
391 read_variable_length_string(data,mem_type);
395 read_fixed_length_string(data,mem_type);
400 read_contiguous_data(data,mem_type);