GridFire 0.0.1a
General Purpose Nuclear Network
Loading...
Searching...
No Matches
gridfire::io::NetworkFileParser Class Referenceabstract

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

#include <network_file.h>

Inheritance diagram for gridfire::io::NetworkFileParser:
gridfire::io::MESANetworkFileParser gridfire::io::SimpleReactionListFileParser

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.

Definition at line 38 of file network_file.h.

Constructor & Destructor Documentation

◆ ~NetworkFileParser()

virtual gridfire::io::NetworkFileParser::~NetworkFileParser ( )
virtualdefault

Virtual destructor for the base class.

Member Function Documentation

◆ parse()

virtual ParsedNetworkData gridfire::io::NetworkFileParser::parse ( const std::string & filename) const
nodiscardpure 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
filenameThe path to the network file to parse.
Returns
A ParsedNetworkData struct containing the parsed reaction data.
Exceptions
std::runtime_errorIf 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
}
Holds the data parsed from a network file.
std::vector< std::string > reactionPENames
A vector of reaction names in their PEN-style format.

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


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