Class Avogadro::QtGui::PersistentAtom

template<typename Molecule_T>
class Avogadro::QtGui::PersistentAtom

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

Public Types

typedef Molecule_T MoleculeType
typedef Molecule_T::AtomType AtomType

Public Functions

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

Create a persistent atom, with the specified unique id.

Parameters
  • m – The molecule the persistent atom belongs to.

  • uniqueId – The unique identifier for the atom.

explicit PersistentAtom(const AtomType &a)

Create a persistent atom from a standard atom object.

Parameters

a – The atom 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 atom.

  • uniqueId – The unique ID of the atom.

void set(const AtomType &a)

Set the persistent atom from a standard atom object.

Parameters

a – The atom 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 atom is valid.

inline MoleculeType *molecule() const
Returns

The molecule the atom is a part of.

inline Index uniqueIdentifier() const

The persistent unique ID of the atom.

Returns

The unique ID of the atom.

AtomType atom() const

Obtain the atom being held by the persistent object.

Returns

A reference to the atom held by the object.