GridFire 0.6.0 General Purpose Nuclear Network

Loading...
Searching...
No Matches
Public Member Functions | List of all members
gridfire::io::NetworkFileParser Class Referenceabstract

An abstract base class for network file parsers. More...

`#include <network_file.h>`

Inheritance diagram for gridfire::io::NetworkFileParser:

## Public Member Functions
virtual | ~NetworkFileParser ()=default
| Virtual destructor for the base class.
virtual ParsedNetworkData | parse (const std::string &filename) const =0
| Parses a network file and returns the parsed data.

## Detailed Description

An abstract base class for network file parsers.

This class defines the interface for parsing files that contain reaction network definitions. Derived classes must implement the `parse` method to handle specific file formats.

## Constructor & Destructor Documentation

## ◆ ~NetworkFileParser()

virtual gridfire::io::NetworkFileParser::~NetworkFileParser | ( |  | ) |
| virtual default

Virtual destructor for the base class.

## Member Function Documentation

## ◆ parse()

virtual ParsedNetworkData gridfire::io::NetworkFileParser::parse | ( | const std::string & | filename | ) | const
| nodiscard pure virtual

Parses a network file and returns the parsed data.

This is a pure virtual function that must be implemented by derived classes. It takes a filename as input and returns a `ParsedNetworkData` struct containing the information extracted from the file.

Parameters

  filename | The path to the network file to parse.

Returns
  A `ParsedNetworkData` struct containing the parsed reaction data.

Exceptions

  std::runtime_error | If the file cannot be opened or a parsing error occurs.

Usage

std::unique_ptr<NetworkFileParser> parser = std::make_unique<SimpleReactionListFileParser>();
try {
ParsedNetworkData data = parser->parse("my_reactions.txt");
for (const auto& reaction_name : data.reactionPENames) {
// ... process reaction name
}
} catch (const std::runtime_error& e) {
// ... handle error
}
gridfire::io::ParsedNetworkData
std::vector< std::string > ParsedNetworkData
Definition network_file.h:12

Implemented in gridfire::io::MESANetworkFileParser, gridfire::io::SimpleReactionListFileParser, and PyNetworkFileParser.

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

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