Avogadro::QtGui::PersistentBond#

template<typename Molecule_T>
class PersistentBond#

The PersistentBond object provides a container for a persistent bond reference that can be held onto. The bond() method gets the underlying bond using the unique ID mechanism of the molecule.

Public Types

typedef Molecule_T MoleculeType#
typedef Molecule_T::BondType BondType#

Public Functions

inline explicit PersistentBond(MoleculeType *m = nullptr, Index uniqueId = MaxIndex)#

Create a persistent bond, with the specified unique id.

Parameters:
  • m – The molecule the persistent bond belongs to.

  • uniqueId – The unique identifier for the bond.

explicit PersistentBond(const BondType &b)#

Create a persistent bond from a standard bond object.

Parameters:

b – The bond that a persistent reference should be created for.

void set(MoleculeType *m, Index uniqueId)#

Set the molecule and unique ID for the persistent object.

Parameters:
  • m – The molecule that contains the bond.

  • uniqueId – The unique ID of the bond.

void set(const BondType &b)#

Set the persistent bond from a standard bond object.

Parameters:

b – The bond that a persistent reference should be created for.

void reset()#

Reset the object to an invalid state.

bool isValid() const#
Returns:

True if the persistent bond is valid.

inline MoleculeType *molecule() const#
Returns:

The molecule the bond is a part of.

inline Index uniqueIdentifier() const#

The persistent unique ID of the bond.

Returns:

The unique ID of the bond.

BondType bond() const#

Obtain the bond being held by the persistent object.

Returns:

A reference to the bond held by the object.