GridFire v0.7.1_rc2 General Purpose Nuclear Network

Loading...
Searching...
No Matches
Public Member Functions | Private Types | Private Attributes | List of all members
gridfire::io::SimpleReactionListFileParser Class Referencefinal

A parser for simple text files containing a list of reactions. More...

`#include <network_file.h>`

Inheritance diagram for gridfire::io::SimpleReactionListFileParser:
[legend]
Collaboration diagram for gridfire::io::SimpleReactionListFileParser:
[legend]

## Public Member Functions
| SimpleReactionListFileParser ()
| Constructs a SimpleReactionListFileParser.
ParsedNetworkData | parse (const std::string &filename) const override
| Parses a simple reaction list file.
Public Member Functions inherited from gridfire::io::NetworkFileParser
virtual | ~NetworkFileParser ()=default
| Virtual destructor for the base class.

## Private Types
using | Config = fourdst::config::Config
using | LogManager = fourdst::logging::LogManager

## Private Attributes
Config & | m_config = Config::getInstance()
quill::Logger * | m_logger = LogManager::getInstance().getLogger("log")

## Detailed Description

A parser for simple text files containing a list of reactions.

This parser reads a file where each line contains a single reaction name. It supports comments (lines starting with '#') and ignores empty lines.

## Member Typedef Documentation

## ◆ Config

using gridfire::io::SimpleReactionListFileParser::Config = fourdst::config::Config
| private

## ◆ LogManager

using gridfire::io::SimpleReactionListFileParser::LogManager = fourdst::logging::LogManager
| private

## Constructor & Destructor Documentation

## ◆ SimpleReactionListFileParser()

gridfire::io::SimpleReactionListFileParser::SimpleReactionListFileParser | ( |  | ) |
| explicit default

Constructs a SimpleReactionListFileParser.

Postcondition
  The parser is initialized and ready to parse files.

## Member Function Documentation

## ◆ parse()

ParsedNetworkData gridfire::io::SimpleReactionListFileParser::parse | ( | const std::string & | filename | ) | const
| override virtual

Parses a simple reaction list file.

This method reads the specified file line by line. It trims whitespace from each line, ignores lines that are empty or start with a '#' comment character, and stores the remaining lines as reaction names.

Parameters

  filename | The path to the simple reaction list file.

Returns
  A `ParsedNetworkData` struct containing the list of reaction names.

Exceptions

  std::runtime_error | If the file cannot be opened for reading.

Algorithm

1. Opens the specified file.
2. Reads the file line by line.
3. For each line, it removes any trailing comments (starting with '#').
4. Trims leading and trailing whitespace.
5. If the line is not empty, it is added to the list of reaction names.
6. Returns the populated `ParsedNetworkData` struct.

Usage

SimpleReactionListFileParser parser;
ParsedNetworkData data = parser.parse("reactions.txt");
gridfire::io::SimpleReactionListFileParser
A parser for simple text files containing a list of reactions.
Definition network_file.h:68
gridfire::io::SimpleReactionListFileParser::parse
ParsedNetworkData parse(const std::string &filename) const override
Parses a simple reaction list file.
Definition network_file.cpp:44
gridfire::io::ParsedNetworkData
std::vector< std::string > ParsedNetworkData
Definition network_file.h:12

Implements gridfire::io::NetworkFileParser.

## Member Data Documentation

## ◆ m_config

Config& gridfire::io::SimpleReactionListFileParser::m_config = Config::getInstance()
| private

## ◆ m_logger

quill::Logger* gridfire::io::SimpleReactionListFileParser::m_logger = LogManager::getInstance().getLogger("log")
| private

The documentation for this class was generated from the following files:

- src/include/gridfire/io/network_file.h
- src/lib/io/network_file.cpp