AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::inlet::LuaReader Class Reference

A Reader that is able to read variables from a Lua file. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/v0.4.0/src/axom/inlet/LuaReader.hpp>

Inheritance diagram for axom::inlet::LuaReader:

Public Member Functions

bool parseFile (const std::string &filePath)
 Parses the given input file. More...
 
bool parseString (const std::string &luaString)
 Parses the given Lua string. More...
 
bool getBool (const std::string &id, bool &value)
 Return a boolean out of the input file. More...
 
bool getDouble (const std::string &id, double &value)
 Return a double out of the input file. More...
 
bool getInt (const std::string &id, int &value)
 Return a int out of the input file. More...
 
bool getString (const std::string &id, std::string &value)
 Return a string out of the input file. More...
 
bool getIntMap (const std::string &id, std::unordered_map< int, int > &values)
 Get an index-integer mapping for the given Lua array. More...
 
bool getDoubleMap (const std::string &id, std::unordered_map< int, double > &values)
 Get an index-double mapping for the given Lua array. More...
 
bool getBoolMap (const std::string &id, std::unordered_map< int, bool > &values)
 Get an index-bool mapping for the given Lua array. More...
 
bool getStringMap (const std::string &id, std::unordered_map< int, std::string > &values)
 Get an index-string mapping for the given Lua array. More...
 

Detailed Description

A Reader that is able to read variables from a Lua file.

See also
Reader

Member Function Documentation

◆ parseFile()

bool axom::inlet::LuaReader::parseFile ( const std::string &  filePath)
virtual

Parses the given input file.

This performs any setup work and parses the given input file. It is required that this is called before using the Reader and overrides any Lua state that was previously there.

Parameters
[in]filePathThe Input file to be read
Returns
true if the input file was able to be parsed

Implements axom::inlet::Reader.

◆ parseString()

bool axom::inlet::LuaReader::parseString ( const std::string &  luaString)
virtual

Parses the given Lua string.

This performs any setup work and parses the given Lua string. It is required that this is called before using the Reader and overrides any Lua state that was previously there.

Parameters
[in]luaStringThe Input file to be read
Returns
true if the string was able to be parsed

Implements axom::inlet::Reader.

◆ getBool()

bool axom::inlet::LuaReader::getBool ( const std::string &  id,
bool &  value 
)
virtual

Return a boolean out of the input file.

This performs any necessary retrieval and mapping from the given identifier to what is in the input file.

Parameters
[in]idThe identifier to the bool that will be retrieved
[out]valueThe value of the bool that was retrieved
Returns
true if the variable was able to be retrieved from the file

Implements axom::inlet::Reader.

◆ getDouble()

bool axom::inlet::LuaReader::getDouble ( const std::string &  id,
double &  value 
)
virtual

Return a double out of the input file.

This performs any necessary retrieval and mapping from the given identifier to what is in the input file.

Parameters
[in]idThe identifier to the double that will be retrieved
[out]valueThe value of the double that was retrieved
Returns
true if the variable was able to be retrieved from the file

Implements axom::inlet::Reader.

◆ getInt()

bool axom::inlet::LuaReader::getInt ( const std::string &  id,
int &  value 
)
virtual

Return a int out of the input file.

This performs any necessary retrieval and mapping from the given identifier to what is in the input file.

Parameters
[in]idThe identifier to the int that will be retrieved from the file
[out]valueThe value of the int that was retrieved from the file
Returns
true if the variable was able to be retrieved from the file

Implements axom::inlet::Reader.

◆ getString()

bool axom::inlet::LuaReader::getString ( const std::string &  id,
std::string &  value 
)
virtual

Return a string out of the input file.

This performs any necessary retrieval and mapping from the given identifier to what is in the input file.

Parameters
[in]idThe identifier to the string that will be retrieved
[out]valueThe value of the string that was retrieved
Returns
true if the variable was able to be retrieved from the file

Implements axom::inlet::Reader.

◆ getIntMap()

bool axom::inlet::LuaReader::getIntMap ( const std::string &  id,
std::unordered_map< int, int > &  values 
)
virtual

Get an index-integer mapping for the given Lua array.

This performs any necessary retrieval and mapping from the given identifier to what is in the input file.

Parameters
[in]idThe identifier to the string that will be retrieved
[out]mapThe values of the ints that were retrieved
Returns
true if the array was able to be retrieved from the file

Implements axom::inlet::Reader.

◆ getDoubleMap()

bool axom::inlet::LuaReader::getDoubleMap ( const std::string &  id,
std::unordered_map< int, double > &  values 
)
virtual

Get an index-double mapping for the given Lua array.

This performs any necessary retrieval and mapping from the given identifier to what is in the input file.

Parameters
[in]idThe identifier to the string that will be retrieved
[out]mapThe values of the doubles that were retrieved
Returns
true if the array was able to be retrieved from the file

Implements axom::inlet::Reader.

◆ getBoolMap()

bool axom::inlet::LuaReader::getBoolMap ( const std::string &  id,
std::unordered_map< int, bool > &  values 
)
virtual

Get an index-bool mapping for the given Lua array.

This performs any necessary retrieval and mapping from the given identifier to what is in the input file.

Parameters
[in]idThe identifier to the string that will be retrieved
[out]mapThe values of the bools that were retrieved
Returns
true if the array was able to be retrieved from the file

Implements axom::inlet::Reader.

◆ getStringMap()

bool axom::inlet::LuaReader::getStringMap ( const std::string &  id,
std::unordered_map< int, std::string > &  values 
)
virtual

Get an index-string mapping for the given Lua array.

This performs any necessary retrieval and mapping from the given identifier to what is in the input file.

Parameters
[in]idThe identifier to the string that will be retrieved
[out]mapThe values of the strings that were retrieved
Returns
true if the array was able to be retrieved from the file

Implements axom::inlet::Reader.


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