OpenMS
Loading...
Searching...
No Matches
ThermoTrailerIndex Class Reference

Per-file trailer label lookup. More...

#include <OpenMS/FORMAT/HANDLERS/ThermoRawFileMetadata.h>

Public Types

using Key = std::size_t
 Key of a registered label for find() / value().
 

Public Member Functions

Key add (const std::string &label)
 Register label (exact match, including the trailing colon) and return its key.
 
const std::string * find (const ThermoScan &scan, Key key)
 Value of the registered label in scan, or nullptr if the scan has no such entry.
 
const std::string & value (const ThermoScan &scan, Key key)
 Value of the registered label in scan, or "" if absent.
 

Private Attributes

std::vector< std::string > labels_
 registered labels by key
 
std::vector< std::size_t > positions_
 last position of each label (npos_ if not seen yet)
 

Static Private Attributes

static constexpr std::size_t npos_ = static_cast<std::size_t>(-1)
 

Detailed Description

Per-file trailer label lookup.

Thermo stores the trailer-extra layout once per controller, so every scan of a file lists the same labels in the same order. Labels are registered once (add()) and their position is learned from the first scan that has them; later scans only verify the label at that position (one string comparison) instead of searching all entries. A scan with a different layout falls back to a linear search and updates the cached position, so arbitrary trailers are still handled correctly.

Member Typedef Documentation

◆ Key

using Key = std::size_t

Key of a registered label for find() / value().

Member Function Documentation

◆ add()

Key add ( const std::string &  label)

Register label (exact match, including the trailing colon) and return its key.

◆ find()

const std::string * find ( const ThermoScan &  scan,
Key  key 
)

Value of the registered label in scan, or nullptr if the scan has no such entry.

◆ value()

const std::string & value ( const ThermoScan &  scan,
Key  key 
)

Value of the registered label in scan, or "" if absent.

Member Data Documentation

◆ labels_

std::vector<std::string> labels_
private

registered labels by key

◆ npos_

constexpr std::size_t npos_ = static_cast<std::size_t>(-1)
staticconstexprprivate

◆ positions_

std::vector<std::size_t> positions_
private

last position of each label (npos_ if not seen yet)