Add a convenience function for checking whether a selection consists of
atom positions only. This will be useful for analysis tools that may
only support atom positions with some combination of options, leads
to clearer code than checking type() == INDEX_ATOM, and exposes less
internal implementation details.
Change-Id: Iaa2d0bfa2f567c060f6b006d423c2910ffd46a69
bool isDynamic() const { return bDynamic_; }
//! Returns the type of positions in the selection.
e_index_t type() const { return rawPositions_.m.type; }
bool isDynamic() const { return bDynamic_; }
//! Returns the type of positions in the selection.
e_index_t type() const { return rawPositions_.m.type; }
+ //! Returns true if the selection only contains positions with a single atom each.
+ bool hasOnlyAtoms() const { return type() == INDEX_ATOM; }
//! Number of positions in the selection.
int posCount() const { return rawPositions_.count(); }
//! Number of positions in the selection.
int posCount() const { return rawPositions_.count(); }
bool isDynamic() const { return data().isDynamic(); }
//! Returns the type of positions in the selection.
e_index_t type() const { return data().type(); }
bool isDynamic() const { return data().isDynamic(); }
//! Returns the type of positions in the selection.
e_index_t type() const { return data().type(); }
+ //! Returns true if the selection only contains positions with a single atom each.
+ bool hasOnlyAtoms() const { return data().hasOnlyAtoms(); }
//! Total number of atoms in the selection.
int atomCount() const
//! Total number of atoms in the selection.
int atomCount() const
const internal::SelectionData &sel = **iter;
if (sel.hasFlag(efSelection_OnlyAtoms))
{
const internal::SelectionData &sel = **iter;
if (sel.hasFlag(efSelection_OnlyAtoms))
{
- if (sel.type() != INDEX_ATOM)
+ if (!sel.hasOnlyAtoms())
{
std::string message = formatString(
"Selection '%s' does not evaluate to individual atoms. "
{
std::string message = formatString(
"Selection '%s' does not evaluate to individual atoms. "