Retains one zero-based atom index and shared ownership of its topology. More...
#include <AtomReference.h>
Public Member Functions | |
| AtomReference (void)=delete | |
| Prevents construction without a topology and atom index. | |
| AtomReference (std::shared_ptr< const CharmmPSF > psf, const int atomIndex) | |
| Constructs a reference to one atom in a native PSF. | |
| AtomReference (const AtomReference &other) noexcept=default | |
| Constructs a reference with the same topology and atom index. | |
| AtomReference (AtomReference &&other) noexcept=default | |
| Constructs a reference by moving another reference. | |
| AtomReference & | operator= (const AtomReference &other) noexcept=default |
| Replaces this value with a copy of another reference. | |
| AtomReference & | operator= (AtomReference &&other) noexcept=default |
| Replaces this value by moving another reference. | |
| int | getAtomIndex (void) const noexcept |
| Returns the referenced atom index. | |
| std::shared_ptr< const CharmmPSF > | getPsf (void) const noexcept |
| Returns shared ownership of the originating topology. | |
| bool | hasSameTopology (const AtomReference &other) const noexcept |
| Tests whether another reference originates from the same topology. | |
| bool | operator== (const AtomReference &other) const noexcept |
| Tests topology-aware atom-reference equality. | |
| bool | operator!= (const AtomReference &other) const noexcept |
| Tests topology-aware atom-reference inequality. | |
Retains one zero-based atom index and shared ownership of its topology.
AtomReference stores a valid atom index together with a std::shared_ptr<const CharmmPSF> for the native topology that defines that index. It does not retain an AtomSelection, allocate per-atom storage, store coordinates, or perform CUDA work.
Topology identity is native object identity. Two references have the same topology only when their shared pointers address the same CharmmPSF object. Equality additionally requires the same atom index.
The object exposes no setters. Copy operations share ownership of the same topology, while move operations transfer the stored shared pointer. Whole-object copy and move assignment remain available. A moved-from object remains valid for destruction or assignment, but its query results are unspecified.
The class provides no internal locking. Concurrent read-only queries are valid only while no thread assigns to or destroys either reference and no thread mutates the shared topology through another owner.
| AtomReference::AtomReference | ( | std::shared_ptr< const CharmmPSF > | psf, |
| const int | atomIndex | ||
| ) |
Constructs a reference to one atom in a native PSF.
Validation is performed in this order: the PSF pointer must be non-null, its atom count must be initialized and non-negative, and atomIndex must be in [0, psf->getNumAtoms()).
| [in] | psf | Shared pointer to the originating topology. The pointer is retained without cloning the PSF. |
| [in] | atomIndex | Zero-based, dimensionless atom index. |
| ApoCharmmError | With ApoCharmmErrorCode::InvalidArgument if psf is null. |
| ApoCharmmError | With ApoCharmmErrorCode::NotInitialized if the PSF atom count is negative. |
| ApoCharmmError | With ApoCharmmErrorCode::InvalidArgument if atomIndex is outside [0, psf->getNumAtoms()). |
| std::bad_alloc | If diagnostic allocation fails. |
| std::length_error | If a diagnostic exceeds an implementation-defined limit. |
getAtomIndex() == atomIndex.
|
defaultnoexcept |
Constructs a reference with the same topology and atom index.
| [in] | other | Reference to copy. The source remains unchanged. |
other and shares topology ownership with it.
|
defaultnoexcept |
Constructs a reference by moving another reference.
| [in,out] | other | Reference whose stored shared pointer is transferred. |
other before the move. The moved-from object remains valid for destruction or assignment.
|
noexcept |
Returns the referenced atom index.
|
noexcept |
Returns shared ownership of the originating topology.
std::shared_ptr<const CharmmPSF> addressing the same native PSF object retained by this reference.
|
noexcept |
Tests whether another reference originates from the same topology.
| [in] | other | Reference whose native PSF object identity is compared. |
true only when both shared pointers address the same native CharmmPSF object; otherwise false.
|
noexcept |
Tests topology-aware atom-reference inequality.
| [in] | other | Reference to compare. |
true when the references differ in native PSF object identity, atom index, or both; otherwise false.
|
defaultnoexcept |
Replaces this value by moving another reference.
| [in,out] | other | Reference whose stored shared pointer is transferred. |
other before the move. The moved-from object remains valid for destruction or assignment.
|
defaultnoexcept |
Replaces this value with a copy of another reference.
| [in] | other | Reference to copy. The source remains unchanged. |
other and shares topology ownership with it.
|
noexcept |
Tests topology-aware atom-reference equality.
| [in] | other | Reference to compare. |
true only when both references have the same native PSF object identity and the same atom index; otherwise false.