NEML2 2.0.0
Loading...
Searching...
No Matches
HITParser Class Reference

A parser is responsible for parsing an input file into a collection of options which can be used by the Factory to manufacture corresponding objects. More...

Detailed Description

A parser is responsible for parsing an input file into a collection of options which can be used by the Factory to manufacture corresponding objects.

The HITParser parses input files written in the HIT format.

#include <HITParser.h>

Inheritance diagram for HITParser:

Public Member Functions

 HITParser ()=default
 
 HITParser (const HITParser &)=default
 
 HITParser (HITParser &&) noexcept=default
 
HITParseroperator= (const HITParser &)=default
 
HITParseroperator= (HITParser &&) noexcept=default
 
 ~HITParser () override=default
 
OptionCollection parse (const std::filesystem::path &filename, const std::string &additional_input="") const override
 Deserialize a file.
 
virtual OptionSet extract_object_options (hit::Node *object, hit::Node *section) const
 Extract options for a specific object.
 
- Public Member Functions inherited from Parser
 Parser ()=default
 
 Parser (const Parser &)=default
 
 Parser (Parser &&) noexcept=default
 
Parseroperator= (const Parser &)=default
 
Parseroperator= (Parser &&) noexcept=default
 
virtual ~Parser ()=default
 

Additional Inherited Members

- Static Public Attributes inherited from Parser
static const std::vector< std::string > sections
 Known top-level sections in the input file.
 

Constructor & Destructor Documentation

◆ HITParser() [1/3]

HITParser ( )
default

◆ HITParser() [2/3]

HITParser ( const HITParser & )
default

◆ HITParser() [3/3]

HITParser ( HITParser && )
defaultnoexcept

◆ ~HITParser()

~HITParser ( )
overridedefault

Member Function Documentation

◆ extract_object_options()

OptionSet extract_object_options ( hit::Node * object,
hit::Node * section ) const
virtual

Extract options for a specific object.

Parameters
objectThe object whose options are to be extracted.
sectionThe current section node.
Returns
OptionSet The options of the object.

◆ operator=() [1/2]

HITParser & operator= ( const HITParser & )
default

◆ operator=() [2/2]

HITParser & operator= ( HITParser && )
defaultnoexcept

◆ parse()

OptionCollection parse ( const std::filesystem::path & filename,
const std::string & additional_input = "" ) const
overridevirtual

Deserialize a file.

Parameters
filenameName/path of the input file.
additional_inputAdditional content of the input file not included in the input file itself, e.g., from command line.
Returns
OptionCollection The extracted object options.

Implements Parser.