HighFive 2.10.0
HighFive - Header-only C++ HDF5 interface
Loading...
Searching...
No Matches
HighFive::File Class Reference

File class. More...

#include <H5File.hpp>

Inheritance diagram for HighFive::File:
Collaboration diagram for HighFive::File:

Public Types

enum  : unsigned {
  ReadOnly = 0x00u , ReadWrite = 0x01u , Truncate = 0x02u , Excl = 0x04u ,
  Debug = 0x08u , Create = 0x10u , Overwrite = Truncate , OpenOrCreate = ReadWrite | Create
}
 

Public Member Functions

 File (const std::string &filename, unsigned openFlags=ReadOnly, const FileAccessProps &fileAccessProps=FileAccessProps::Default())
 File.
 
 File (const std::string &filename, unsigned openFlags, const FileCreateProps &fileCreateProps, const FileAccessProps &fileAccessProps=FileAccessProps::Default())
 File.
 
const std::string & getName () const noexcept
 Return the name of the file.
 
std::string getPath () const noexcept
 Object path of a File is always "/".
 
hsize_t getMetadataBlockSize () const
 Returns the block size for metadata in bytes.
 
std::pair< H5F_libver_t, H5F_libver_t > getVersionBounds () const
 Returns the HDF5 version compatibility bounds.
 
void flush ()
 flush
 
FileCreateProps getCreatePropertyList () const
 Get the list of properties for creation of this file.
 
FileAccessProps getAccessPropertyList () const
 Get the list of properties for accession of this file.
 
size_t getFileSize () const
 Get the size of this file in bytes.
 
size_t getFreeSpace () const
 Get the amount of tracked, unused space in bytes.
 
- Public Member Functions inherited from HighFive::Object
 Object (Object &&other) noexcept
 
 ~Object ()
 
bool isValid () const noexcept
 isValid
 
hid_t getId () const noexcept
 getId
 
ObjectInfo getInfo () const
 Retrieve several infos about the current object (address, dates, etc)
 
ObjectType getType () const
 Gets the fundamental type of the object (dataset, group, etc)
 
bool operator== (const Object &other) const noexcept
 
- Public Member Functions inherited from HighFive::NodeTraits< File >
DataSet createDataSet (const std::string &dataset_name, const DataSpace &space, const DataType &type, const DataSetCreateProps &createProps=DataSetCreateProps::Default(), const DataSetAccessProps &accessProps=DataSetAccessProps::Default(), bool parents=true)
 createDataSet Create a new dataset in the current file of datatype type and of size space
 
DataSet createDataSet (const std::string &dataset_name, const DataSpace &space, const DataSetCreateProps &createProps=DataSetCreateProps::Default(), const DataSetAccessProps &accessProps=DataSetAccessProps::Default(), bool parents=true)
 createDataSet create a new dataset in the current file with a size specified by space
 
DataSet createDataSet (const std::string &dataset_name, const T &data, const DataSetCreateProps &createProps=DataSetCreateProps::Default(), const DataSetAccessProps &accessProps=DataSetAccessProps::Default(), bool parents=true)
 createDataSet create a new dataset in the current file and write to it, inferring the DataSpace from the data.
 
DataSet createDataSet (const std::string &dataset_name, const deprecated::FixedLenStringArray< N > &data, const DataSetCreateProps &createProps=DataSetCreateProps::Default(), const DataSetAccessProps &accessProps=DataSetAccessProps::Default(), bool parents=true)
 
DataSet getDataSet (const std::string &dataset_name, const DataSetAccessProps &accessProps=DataSetAccessProps::Default()) const
 get an existing dataset in the current file
 
Group createGroup (const std::string &group_name, bool parents=true)
 create a new group, and eventually intermediate groups
 
Group createGroup (const std::string &group_name, const GroupCreateProps &createProps, bool parents=true)
 create a new group, and eventually intermediate groups
 
Group getGroup (const std::string &group_name) const
 open an existing group with the name group_name
 
DataType getDataType (const std::string &type_name, const DataTypeAccessProps &accessProps=DataTypeAccessProps::Default()) const
 open a commited datatype with the name type_name
 
size_t getNumberObjects () const
 return the number of leaf objects of the node / group
 
std::string getObjectName (size_t index) const
 return the name of the object with the given index
 
bool rename (const std::string &src_path, const std::string &dest_path, bool parents=true) const
 moves an object and its content within an HDF5 file.
 
std::vector< std::string > listObjectNames (IndexType idx_type=IndexType::NAME) const
 list all leaf objects name of the node / group
 
bool exist (const std::string &node_name) const
 check a dataset or group exists in the current node / group
 
void unlink (const std::string &node_name) const
 unlink the given dataset or group
 
LinkType getLinkType (const std::string &node_name) const
 Returns the kind of link of the given name (soft, hard...)
 
ObjectType getObjectType (const std::string &node_name) const
 A shorthand to get the kind of object pointed to (group, dataset, type...)
 
void createSoftLink (const std::string &linkName, const T &obj)
 A shorthand to create softlink to any object which provides getPath The link will be created with default properties along with required parent groups.
 
void createSoftLink (const std::string &link_name, const std::string &obj_path, LinkCreateProps linkCreateProps=LinkCreateProps(), const LinkAccessProps &linkAccessProps=LinkAccessProps(), const bool parents=true)
 Creates softlinks.
 
void createExternalLink (const std::string &link_name, const std::string &h5_file, const std::string &obj_path, LinkCreateProps linkCreateProps=LinkCreateProps(), const LinkAccessProps &linkAccessProps=LinkAccessProps(), const bool parents=true)
 
void createHardLink (const std::string &link_name, const T &target_obj, LinkCreateProps linkCreateProps=LinkCreateProps(), const LinkAccessProps &linkAccessProps=LinkAccessProps(), const bool parents=true)
 Creates hardlinks.
 
- Public Member Functions inherited from HighFive::AnnotateTraits< File >
Attribute createAttribute (const std::string &attribute_name, const DataSpace &space, const DataType &type)
 create a new attribute with the name attribute_name
 
Attribute createAttribute (const std::string &attribute_name, const DataSpace &space)
 createAttribute create a new attribute on the current dataset with size specified by space
 
Attribute createAttribute (const std::string &attribute_name, const T &data)
 createAttribute create a new attribute on the current dataset and write to it, inferring the DataSpace from data.
 
void deleteAttribute (const std::string &attribute_name)
 deleteAttribute let you delete an attribute by its name.
 
Attribute getAttribute (const std::string &attribute_name) const
 open an existing attribute with the name attribute_name
 
size_t getNumberAttributes () const
 return the number of attributes of the node / group
 
std::vector< std::string > listAttributeNames () const
 list all attribute name of the node / group
 
bool hasAttribute (const std::string &attr_name) const
 checks an attribute exists
 

Static Public Attributes

static const ObjectType type = ObjectType::File
 

Protected Member Functions

 File ()=default
 
 Object (Object &&other) noexcept
 
 Object ()
 
 Object (const Object &other)
 
 Object (hid_t)
 
- Protected Member Functions inherited from HighFive::Object
 Object ()
 
 Object (const Object &other)
 
 Object (hid_t)
 
Objectoperator= (const Object &other)
 

Friends

template<typename >
class PathTraits
 

Additional Inherited Members

- Protected Attributes inherited from HighFive::Object
hid_t _hid
 

Detailed Description

File class.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : unsigned
Enumerator
ReadOnly 

Open flag: Read only access.

ReadWrite 

Open flag: Read Write access.

Truncate 

Open flag: Truncate a file if already existing.

Excl 

Open flag: Open will fail if file already exist.

Debug 

Open flag: Open in debug mode.

Create 

Open flag: Create non existing file.

Overwrite 

Derived open flag: common write mode (=ReadWrite|Create|Truncate)

OpenOrCreate 

Derived open flag: Opens RW or exclusively creates.

Constructor & Destructor Documentation

◆ File() [1/3]

HighFive::File::File ( const std::string & filename,
unsigned openFlags = ReadOnly,
const FileAccessProps & fileAccessProps = FileAccessProps::Default() )
inlineexplicit

File.

Parameters
filenamefilepath of the HDF5 file
openFlagsOpen mode / flags ( ReadOnly, ReadWrite)
fileAccessPropsthe file access properties

Open or create a new HDF5 file

◆ File() [2/3]

HighFive::File::File ( const std::string & filename,
unsigned openFlags,
const FileCreateProps & fileCreateProps,
const FileAccessProps & fileAccessProps = FileAccessProps::Default() )
inline

File.

Parameters
filenamefilepath of the HDF5 file
openFlagsOpen mode / flags ( ReadOnly, ReadWrite)
fileCreatePropsthe file create properties
fileAccessPropsthe file access properties

Open or create a new HDF5 file

◆ File() [3/3]

HighFive::File::File ( )
protecteddefault

Member Function Documentation

◆ flush()

void HighFive::File::flush ( )
inline

flush

Flushes all buffers associated with a file to disk

◆ getAccessPropertyList()

FileAccessProps HighFive::File::getAccessPropertyList ( ) const
inline

Get the list of properties for accession of this file.

◆ getCreatePropertyList()

FileCreateProps HighFive::File::getCreatePropertyList ( ) const
inline

Get the list of properties for creation of this file.

◆ getFileSize()

size_t HighFive::File::getFileSize ( ) const
inline

Get the size of this file in bytes.

◆ getFreeSpace()

size_t HighFive::File::getFreeSpace ( ) const
inline

Get the amount of tracked, unused space in bytes.

Note, this is a wrapper for H5Fget_freespace and returns the number bytes in the free space manager. This might be different from the total amount of unused space in the HDF5 file, since the free space manager might not track everything or not track across open-close cycles.

◆ getMetadataBlockSize()

hsize_t HighFive::File::getMetadataBlockSize ( ) const
inline

Returns the block size for metadata in bytes.

◆ getName()

const std::string & HighFive::File::getName ( ) const
inlinenoexcept

Return the name of the file.

◆ getPath()

std::string HighFive::File::getPath ( ) const
inlinenoexcept

Object path of a File is always "/".

◆ getVersionBounds()

std::pair< H5F_libver_t, H5F_libver_t > HighFive::File::getVersionBounds ( ) const
inline

Returns the HDF5 version compatibility bounds.

◆ Object() [1/4]

HighFive::Object::Object ( )
inlineprotected

◆ Object() [2/4]

HighFive::Object::Object ( const Object & other)
inlineprotected

◆ Object() [3/4]

HighFive::Object::Object ( hid_t hid)
inlineexplicitprotected

◆ Object() [4/4]

HighFive::Object::Object ( Object && other)
inlineprotectednoexcept

Friends And Related Symbol Documentation

◆ PathTraits

template<typename >
friend class PathTraits
friend

Member Data Documentation

◆ type

const ObjectType HighFive::File::type = ObjectType::File
static

The documentation for this class was generated from the following files: