Utopia  2
Framework for studying models of complex & adaptive systems.
Public Member Functions | Private Attributes | List of all members
Utopia::DataIO::HDFIdentifier Class Referencefinal

Wrapper class around an hdf5 identifier, used to manage reference counts of the object this identifier refers to. More...

#include <hdfidentifier.hh>

Public Member Functions

void swap (HDFIdentifier &other)
 Exchange states between caller and 'other'. More...
 
hid_t get_id () const
 Get the HDF5 id held by this object. More...
 
void set_id (hid_t id)
 Set id to the given argument. Only to be used to invalidate objects upon move or similar. More...
 
bool is_valid () const
 Check if thi ID refers to a valid object. More...
 
auto get_refcount () const
 Get the number of references currently referring to the object identified by this ID. More...
 
void increment_refcount ()
 Increase the reference count of the object referred to by this ID by one. More...
 
void decrement_refcount ()
 Decrease the reference count of the object referred to by this ID by one. More...
 
void close ()
 Close the identifier and render the C-Level id held invalid. More...
 
void open (hid_t id, std::function< herr_t(hid_t) > closing_func)
 Open the object and bind it to another C-Level id. More...
 
 HDFIdentifier (hid_t id, std::function< herr_t(hid_t) > closing_func)
 Construct HDFIdentifier from the given arguments. More...
 
 HDFIdentifier ()
 Construct HDFIdentifier from the given arguments. More...
 
 HDFIdentifier (const HDFIdentifier &other)
 Construct HDFIdentifier by copying another instance of HDFIdentifier, incrementing the refcount of the held id in the process. More...
 
 HDFIdentifier (HDFIdentifier &&other)
 Construct HDFIdentifier by moving from another instance of HDFIdentifier. More...
 
HDFIdentifieroperator= (const HDFIdentifier &other)
 Assign HDFIdentifier by copying another instance of HDFIdentifier, incrementing the refcount of the held id in the process. More...
 
HDFIdentifieroperator= (HDFIdentifier &&other)
 Assign HDFIdentifier by moving from another instance of HDFIdentifier. More...
 
 ~HDFIdentifier ()
 Destroy the HDFIdentifier object, decrementing its refcount. More...
 

Private Attributes

hid_t _id = -1
 
std::function< herr_t(hid_t) > _closing_func
 

Detailed Description

Wrapper class around an hdf5 identifier, used to manage reference counts of the object this identifier refers to.

Constructor & Destructor Documentation

◆ HDFIdentifier() [1/4]

Utopia::DataIO::HDFIdentifier::HDFIdentifier ( hid_t  id,
std::function< herr_t(hid_t) >  closing_func 
)
inline

Construct HDFIdentifier from the given arguments.

Parameters
idC-Level id that is to be wrappend into an object of this class. Management of this id is then taken over by this class instance. Continuing to do so using the C-Interface outside of this class will result in errors.

◆ HDFIdentifier() [2/4]

Utopia::DataIO::HDFIdentifier::HDFIdentifier ( )
inline

Construct HDFIdentifier from the given arguments.

◆ HDFIdentifier() [3/4]

Utopia::DataIO::HDFIdentifier::HDFIdentifier ( const HDFIdentifier other)
inline

Construct HDFIdentifier by copying another instance of HDFIdentifier, incrementing the refcount of the held id in the process.

Parameters
otherObject to copy from

◆ HDFIdentifier() [4/4]

Utopia::DataIO::HDFIdentifier::HDFIdentifier ( HDFIdentifier &&  other)
inline

Construct HDFIdentifier by moving from another instance of HDFIdentifier.

◆ ~HDFIdentifier()

Utopia::DataIO::HDFIdentifier::~HDFIdentifier ( )
inline

Destroy the HDFIdentifier object, decrementing its refcount.

Member Function Documentation

◆ close()

void Utopia::DataIO::HDFIdentifier::close ( )
inline

Close the identifier and render the C-Level id held invalid.

◆ decrement_refcount()

void Utopia::DataIO::HDFIdentifier::decrement_refcount ( )
inline

Decrease the reference count of the object referred to by this ID by one.

◆ get_id()

hid_t Utopia::DataIO::HDFIdentifier::get_id ( ) const
inline

Get the HDF5 id held by this object.

Returns
hid_t

◆ get_refcount()

auto Utopia::DataIO::HDFIdentifier::get_refcount ( ) const
inline

Get the number of references currently referring to the object identified by this ID.

Returns
auto

◆ increment_refcount()

void Utopia::DataIO::HDFIdentifier::increment_refcount ( )
inline

Increase the reference count of the object referred to by this ID by one.

◆ is_valid()

bool Utopia::DataIO::HDFIdentifier::is_valid ( ) const
inline

Check if thi ID refers to a valid object.

Returns
true
false

◆ open()

void Utopia::DataIO::HDFIdentifier::open ( hid_t  id,
std::function< herr_t(hid_t) >  closing_func 
)
inline

Open the object and bind it to another C-Level id.

Parameters
id

◆ operator=() [1/2]

HDFIdentifier& Utopia::DataIO::HDFIdentifier::operator= ( const HDFIdentifier other)
inline

Assign HDFIdentifier by copying another instance of HDFIdentifier, incrementing the refcount of the held id in the process.

Parameters
otherObject to copy from

◆ operator=() [2/2]

HDFIdentifier& Utopia::DataIO::HDFIdentifier::operator= ( HDFIdentifier &&  other)
inline

Assign HDFIdentifier by moving from another instance of HDFIdentifier.

Returns
HDFIdentifier&

◆ set_id()

void Utopia::DataIO::HDFIdentifier::set_id ( hid_t  id)
inline

Set id to the given argument. Only to be used to invalidate objects upon move or similar.

Parameters
id

◆ swap()

void Utopia::DataIO::HDFIdentifier::swap ( HDFIdentifier other)
inline

Exchange states between caller and 'other'.

Parameters
otherIdentifier to exchange states with

Member Data Documentation

◆ _closing_func

std::function< herr_t(hid_t) > Utopia::DataIO::HDFIdentifier::_closing_func
private

◆ _id

hid_t Utopia::DataIO::HDFIdentifier::_id = -1
private

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