h5gt 0.2.0
C++ wrapper for HDF5 library (based on HighFive project)
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
h5gt::File Class Reference

File class. More...

#include <H5File.hpp>

Inheritance diagram for h5gt::File:
h5gt::Object h5gt::NodeTraits< File > h5gt::AnnotateTraits< File >

Public Types

enum  OpenFlag : 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=FileDriver())
 File.
 
bool operator== (const File &other) const
 
bool operator!= (const File &other) const
 
ObjectType getObjectType () const
 Gets the fundamental type of the object (dataset, group, etc)
 
- Public Member Functions inherited from h5gt::Object
void flush (bool globalScope=true)
 flush
 
bool isValid () const noexcept
 isValid
 
hid_t getId (const bool &increaseRefCount=false) const noexcept
 getId
 
std::string getFileName () const
 
std::string getPath () const
 return the path to the current group, dataset, datatype or attribute's holder
 
int getIdRefCount () const noexcept
 
ObjectInfo getObjectInfo () const
 Retrieve several infos about the current object (address, dates, etc)
 
ObjectType getObjectType () const
 Gets the fundamental type of the object (dataset, group, etc)
 
- Public Member Functions inherited from h5gt::NodeTraits< File >
DataSet createDataSet (const std::string &dataset_name, const DataSpace &space, const DataType &type, const LinkCreateProps &linkCreateProps=LinkCreateProps(), const DataSetCreateProps &dsetCreateProps=DataSetCreateProps(), const DataSetAccessProps &dsetAccessProps=DataSetAccessProps())
 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 LinkCreateProps &linkCreateProps=LinkCreateProps(), const DataSetCreateProps &dsetCreateProps=DataSetCreateProps(), const DataSetAccessProps &dsetAccessProps=DataSetAccessProps())
 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 LinkCreateProps &linkCreateProps=LinkCreateProps(), const DataSetCreateProps &dsetCreateProps=DataSetCreateProps(), const DataSetAccessProps &dsetAccessProps=DataSetAccessProps())
 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 FixedLenStringArray< N > &data, const LinkCreateProps &linkCreateProps=LinkCreateProps(), const DataSetCreateProps &dsetCreateProps=DataSetCreateProps(), const DataSetAccessProps &dsetAccessProps=DataSetAccessProps())
 
DataType getDataType (const std::string &dtype_name, const DataTypeAccessProps &dtypeAccessProps=DataTypeAccessProps()) const
 
DataSet getDataSet (const std::string &dataset_name, const DataSetAccessProps &accessProps=DataSetAccessProps()) const
 get an existing dataset in the current file
 
Group createGroup (const std::string &group_name, const LinkCreateProps &linkCreateProps=LinkCreateProps(), const GroupCreateProps &groupCreateProps=GroupCreateProps(), const GroupAccessProps &groupAccessProps=GroupAccessProps())
 create a new group, and eventually intermediate groups
 
Group getGroup (const std::string &group_name, const GroupAccessProps &groupAccessProps=GroupAccessProps()) const
 open an existing group with the name group_name
 
File getFile () const
 
size_t getNumberObjects () const
 return the number of leaf objects of the node / group
 
std::string getObjectName (size_t index, const LinkAccessProps &linkAccessProps=LinkAccessProps()) const
 return the name of the object with the given index
 
LinkInfo getLinkInfo (const std::string &objName) const
 
std::string unpackSoftLink (const std::string &objName)
 unpackSoftLink retrieve target path object path
 
std::string unpackExternalLink (const std::string &objName, std::string &fileName_out)
 unpackExternalLink retrieve target path object path and file path
 
bool rename (const std::string &src_path, const std::string &dest_path, const LinkCreateProps &linkCreateProps=LinkCreateProps(), const LinkAccessProps &linkAccessProps=LinkAccessProps()) const
 moves an object and its content within an HDF5 file.
 
std::vector< std::string > listObjectNames () const
 list all leaf objects name of the node / group
 
bool exist (const std::string &obj_name, const LinkAccessProps &linkAccessProps=LinkAccessProps(), bool raise_errors=false) const
 check a dataset or group exists in the current node / group
 
bool resolved (const std::string &obj_name, const LinkAccessProps &linkAccessProps=LinkAccessProps(), bool raise_errors=false) const
 resolved Hard links always resolved but Soft/External links may point to unexistant objects
 
bool existAndResolved (const std::string &obj_name, const LinkAccessProps &linkAccessProps=LinkAccessProps(), bool raise_errors=false) const
 existAndResolved invokes exist() and then reoslved()
 
bool hasObject (const std::string &objName, const ObjectType &objType, const LinkAccessProps &linkAccessProps=LinkAccessProps(), bool raise_errors=false) const
 
void unlink (const std::string &obj_name, const LinkAccessProps &linkAccessProps=LinkAccessProps()) const
 unlink the given dataset or group
 
LinkType getLinkType (const std::string &obj_name, const LinkAccessProps &linkAccessProps=LinkAccessProps()) const
 Returns the kind of link of the given name (soft, hard...)
 
ObjectType getObjectType (const std::string &obj_name, const LinkAccessProps &accessProps=LinkAccessProps()) const
 A shorthand to get the kind of object pointed to (group, dataset, type...)
 
Group copy (const Group &obj, const std::string &objNewName, const ObjectCopyProps &copyProps=ObjectCopyProps(), const LinkCreateProps &linkCreateProps=LinkCreateProps(), const GroupAccessProps &groupAccessProps=GroupAccessProps())
 Copies specified object to the new destination (this File/Group) under new name. The destination must not already have the object with the same name (objNewName).
 
DataSet copy (const DataSet &obj, const std::string &objNewName, const ObjectCopyProps &copyProps=ObjectCopyProps(), const LinkCreateProps &linkCreateProps=LinkCreateProps(), const DataSetAccessProps &dsetAccessProps=DataSetAccessProps())
 
DataType copy (const DataType &obj, const std::string &objNewName, const ObjectCopyProps &copyProps=ObjectCopyProps(), const LinkCreateProps &linkCreateProps=LinkCreateProps(), const DataTypeAccessProps &dtypeAccessProps=DataTypeAccessProps())
 Copies commited datatype.
 
Group createLink (const Node &target, const std::string &linkName, const LinkType &linkType, const std::string &targetPath="", const LinkCreateProps &linkCreateProps=LinkCreateProps(), const LinkAccessProps &linkAccessProps=LinkAccessProps(), const GroupAccessProps &groupAccessProps=GroupAccessProps())
 
DataSet createLink (const DataSet &target, const std::string &linkName, const LinkType &linkType, const std::string &targetPath="", const LinkCreateProps &linkCreateProps=LinkCreateProps(), const LinkAccessProps &linkAccessProps=LinkAccessProps(), const DataSetAccessProps &dsetAccessProps=DataSetAccessProps())
 
DataType createLink (const DataType &target, const std::string &linkName, const LinkType &linkType, const std::string &targetPath="", const LinkCreateProps &linkCreateProps=LinkCreateProps(), const LinkAccessProps &linkAccessProps=LinkAccessProps(), const DataTypeAccessProps &dtypeAccessProps=DataTypeAccessProps())
 
- Public Member Functions inherited from h5gt::AnnotateTraits< File >
Attribute createAttribute (const std::string &attr_name, const DataSpace &space, const DataType &type)
 create a new attribute with the name attr_name
 
Attribute createAttribute (const std::string &attr_name, const DataSpace &space)
 createAttribute create a new attribute on the current dataset with size specified by space
 
Attribute createAttribute (const std::string &attr_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 &attr_name)
 deleteAttribute let you delete an attribute by its name.
 
Attribute getAttribute (const std::string &attr_name) const
 open an existing attribute with the name attr_name
 
size_t getNumberAttributes () const
 return the number of attributes of the object
 
std::vector< std::string > listAttributeNames () const
 list all attribute name of the object
 
bool hasAttribute (const std::string &attr_name) const
 checks an attribute exists
 

Static Public Member Functions

static File FromId (const hid_t &id, const bool &increaseRefCount=false)
 

Static Public Attributes

static const ObjectType type = ObjectType::File
 

Protected Member Functions

 File (const Object &obj)
 
- Protected Member Functions inherited from h5gt::Object
 Object (const Object &other)
 
 Object (Object &&other) noexcept
 
 Object (const hid_t &)
 
 Object (const hid_t &, const ObjectType &, const bool &)
 
LinkInfo _getLinkInfo (const std::string &objPath) const
 getLinkInfo retrieve link info from an object with 'objPath'. This object must reside in the same container as current one.
 
std::string _unpackSoftLink (const std::string &objName) const
 
std::string _unpackExternalLink (const std::string &objName, std::string &fileName_out) const
 
void _unlink (const std::string &obj_name) const
 
Objectoperator= (const Object &other)
 
bool operator== (const Object &other) const
 When coparing objects h5gt::File must be open.
 

Additional Inherited Members

- Protected Attributes inherited from h5gt::Object
hid_t _hid
 

Detailed Description

File class.

Member Enumeration Documentation

◆ OpenFlag

enum h5gt::File::OpenFlag : 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()

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

File.

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

Open or create a new HDF5 file

Member Function Documentation

◆ getObjectType()

ObjectType h5gt::Object::getObjectType ( ) const
inline

Gets the fundamental type of the object (dataset, group, etc)

Exceptions
ObjectExceptionwhen the _hid is negative or the type is custom and not registered yet

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