CatalogParser
CatalogParser is the intermediate abstract base that every
spectroscopic catalog parser derives from. It extends
FileParser with a single hook —
CatalogParser::parse(), which returns a
CatalogData value containing the ordered transition list
(frequency, intensity, error, lower-state energy, quantum numbers) and
the source-program metadata that downstream code uses to label the
overlay. Splitting parse() onto an intermediate base lets the
catalog-specific consumers — CatalogOverlay, the catalog-import
dialog, and the catalog overlay-replay path — work against this
interface alone, without coupling to either of the concrete formats.
The concrete catalog parsers shipped with Blackchirp are
SPCATParser (Pickett SPFIT/SPCAT, .cat files) and
XIAMParser (XIAM internal-rotation analysis, .xo and
.out files). A new format with the same conceptual shape — a list of
transitions with frequency, intensity, and quantum-number assignments —
is added by deriving from this class, implementing the
FileParser hooks plus parse(), and registering an
instance with FileParserRegistry at application startup.
Once registered, the new format becomes selectable in the catalog
overlay-import dialog with no further wiring; that workflow is described
in Overlays.
API Reference
-
class CatalogParser : public FileParser
Abstract base for spectroscopic catalog parsers.
Adds a single hook on top of :cpp:class:
FileParser— theparse()method that converts a recognized catalog file into a :cpp:class:CatalogDatavalue.CatalogDatacontains the ordered list of transitions (frequency, intensity, error, lower energy, quantum numbers, …) plus source-program metadata. The concrete subclasses ship with Blackchirp are :cpp:class:SPCATParserand :cpp:class:XIAMParser; a new format that exposes the same transition shape (frequency + intensity + quantum numbers) should derive from this class so thatCatalogOverlaycan consume it without further code changes.See also
SPCATParser, XIAMParser, CatalogData, FileParserRegistry
Subclassed by SPCATParser, XIAMParser
Public Functions
-
virtual ~CatalogParser() = default
-
virtual CatalogData parse(const QString &filePath, const QVariantMap &hints = QVariantMap()) const = 0
Parse a catalog file into a :cpp:class:
CatalogDatavalue.Returns a default-constructed (empty)
CatalogDataif the file cannot be opened or contains no recognizable transitions. Callers are expected to checkCatalogData::transitions().isEmpty()before consuming the result.- Parameters:
filePath – Absolute or relative path to the catalog file.
hints – Optional format-specific overrides. Subclasses document which keys they consume.
- Returns:
Parsed catalog data; empty on failure.
-
virtual ~CatalogParser() = default