Gromacs  2024.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
gmx::ICommandLineModule Class Referenceabstract

#include <gromacs/commandline/cmdlinemodule.h>

+ Inheritance diagram for gmx::ICommandLineModule:

Description

Module that can be run from command line using CommandLineModuleManager.

See Also
CommandLineModuleManager
CommandLineOptionsModule

Public Member Functions

virtual const char * name () const =0
 Returns the name of the module.
 
virtual const char * shortDescription () const =0
 Returns a one-line description of the module.
 
virtual void init (CommandLineModuleSettings *settings)=0
 Initializes the module and provides settings for the runner. More...
 
virtual int run (int argc, char *argv[])=0
 Runs the module with the given arguments. More...
 
virtual void writeHelp (const CommandLineHelpContext &context) const =0
 Prints help for the module. More...
 

Member Function Documentation

virtual void gmx::ICommandLineModule::init ( CommandLineModuleSettings settings)
pure virtual

Initializes the module and provides settings for the runner.

This will be called before run(), and can be used to adjust initialization that the runner does.

This method is currently not called when writing the help.

Implemented in gmx::CommandLineHelpModule, gmx::anonymous_namespace{cmdlinemodulemanager.cpp}::CMainCommandLineModule, and anonymous_namespace{legacymodules.cpp}::ObsoleteToolModule.

virtual int gmx::ICommandLineModule::run ( int  argc,
char *  argv[] 
)
pure virtual

Runs the module with the given arguments.

Parameters
[in]argcNumber of elements in argv.
[in]argvCommand-line arguments.
Exceptions
unspecifiedMay throw exceptions to indicate errors.
Returns
Exit code for the program.
Return values
0on successful termination.

argv[0] is the name of the module, i.e., the arguments are as if the module was run as a standalone executable.

Implemented in gmx::CommandLineHelpModule, gmx::anonymous_namespace{cmdlinemodulemanager.cpp}::CMainCommandLineModule, and anonymous_namespace{legacymodules.cpp}::ObsoleteToolModule.

virtual void gmx::ICommandLineModule::writeHelp ( const CommandLineHelpContext context) const
pure virtual

Prints help for the module.

Parameters
[in]contextContext object for writing the help.
Exceptions
std::bad_allocif out of memory.
FileIOErroron any I/O error.

Note that for MPI-enabled builds, this is called only on the main rank.

Implemented in gmx::CommandLineHelpModule, gmx::anonymous_namespace{cmdlinemodulemanager.cpp}::CMainCommandLineModule, and anonymous_namespace{legacymodules.cpp}::ObsoleteToolModule.


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