OpenMS
Loading...
Searching...
No Matches
hash< OpenMS::NASequence > Struct Reference

Hash function for OpenMS::NASequence. More...

#include <OpenMS/CHEMISTRY/NASequence.h>

Public Member Functions

std::size_t operator() (const OpenMS::NASequence &seq) const noexcept
 

Detailed Description

Hash function for OpenMS::NASequence.

Computes a hash based on the ribonucleotide sequence (codes), and the 5' and 3' terminal modifications.

Design decisions:

  • Uses ribonucleotide codes instead of pointers for portability
  • Includes 5' and 3' terminal modification codes
  • Hash is consistent with operator== when all Ribonucleotide pointers originate from RibonucleotideDB (the singleton guarantees identical codes map to identical pointers)
Precondition
All Ribonucleotide* in the sequence must originate from RibonucleotideDB. If pointers from different sources with identical codes are used, hash equality may not imply object equality (violating hash contract).
Note
Hash is reproducible across process runs for equal sequences.

Member Function Documentation

◆ operator()()

std::size_t operator() ( const OpenMS::NASequence seq) const
inlinenoexcept