Provides the base class and various helpers for defining commands in the input file. More...
Classes | |
class | Command |
Abstract base class for all commands. More... | |
class | DeprecatedCommand |
Base class for a deprecated command which will translate old syntax into the new command that replaces it. More... | |
struct | LinkDescription< Enum > |
Generate a description functor for addDescriptions() from an EnumStringMap. More... | |
Functions | |
std::map< string, Command * > & | getCommandMap () |
Retrieve the map from command names to objects created during static initialization. | |
std::map< string, DeprecatedCommand * > & | getDeprecatedMap () |
Retrieve the map from deprecated command names to objects. | |
template<typename GetDescription > | |
string | addDescriptions (string optionList, const GetDescription &getDescription, string spacer="\n+ ") |
Process the EnumStringMap::optionList() to add descriptions using an arbitrary functor. More... | |
string | nullDescription (const string &) |
Null description function that can be used with addDescriptions(). This can be useful for simply reformatting EnumStringMap::optionList() | |
template<typename Enum > | |
LinkDescription< Enum > | linkDescription (const EnumStringMap< Enum > &nameMap, const EnumStringMap< Enum > &descMap) |
Helper function to select appropriate LinkDescription<> by overloading. More... | |
std::shared_ptr< class SpeciesInfo > | findSpecies (string id, Everything &e) |
Find species matching an id (and create it from a wildcard if necessary) More... | |
bool | isReadable (string fname) |
Check if file is readable in an MPI friendly way. This function must be called from all processes, the file will be checked on one process and the result broadcast to all processes. More... | |
void | setAvailableFilename (string filenamePattern, string varName, string &target) |
void | setAvailableFilenames (string filenamePattern, Everything &e) |
Apply setAvailableFilename for all standard input variables (action of CommandInitialState) | |
Provides the base class and various helpers for defining commands in the input file.
To create a new command, paste this code block into a cpp file, replace all occurences of dummy with something suitable, add the documentation strings (format and comment) and the parse code. See any of the existing commands for examples of using ParamList effectively. Note that there is no need to edit any global list of commands, this happens automatically during static initialization, just create an object of the new derived Command class at file scope. However, for coherent documentation, edit doc/commands.dox and link to the command in the appropriate section.
struct CommandDummy : public Command { CommandDummy() : Command("dummy") { format = ""; comments = ""; } void process(ParamList& pl, Everything& e) { } void printStatus(Everything& e, int iRep) { } } commandDummy;