Implements a ICommandLineModule, given a function with C/C++ main() signature.
|
typedef
CommandLineModuleManager::CMainFunction | CMainFunction |
| Function pointer type for a C main function. More...
|
|
typedef
CommandLineModuleManager::InitSettingsFunction | InitSettingsFunction |
| Function pointer to a settings provider. More...
|
|
Function pointer type for a C main function.
Function pointer to a settings provider.
gmx::anonymous_namespace{cmdlinemodulemanager.cpp}::CMainCommandLineModule::CMainCommandLineModule |
( |
const char * |
name, |
|
|
const char * |
shortDescription, |
|
|
CMainFunction |
mainFunction, |
|
|
InitSettingsFunction |
settingsFunction |
|
) |
| |
|
inline |
Creates a wrapper module for the given main function.
- Parameters
-
[in] | name | Name for the module. |
[in] | shortDescription | One-line description for the module. |
[in] | mainFunction | Main function to wrap. |
[in] | settingsFunction | Initializer for settings (can be null). |
Does not throw. This is essential for correct implementation of CommandLineModuleManager::runAsMainCMain().
virtual void gmx::anonymous_namespace{cmdlinemodulemanager.cpp}::CMainCommandLineModule::init |
( |
CommandLineModuleSettings * |
settings | ) |
|
|
inlinevirtual |
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.
Implements gmx::ICommandLineModule.
virtual int gmx::anonymous_namespace{cmdlinemodulemanager.cpp}::CMainCommandLineModule::run |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
|
inlinevirtual |
Runs the module with the given arguments.
- Parameters
-
[in] | argc | Number of elements in argv . |
[in] | argv | Command-line arguments. |
- Exceptions
-
unspecified | May throw exceptions to indicate errors. |
- Returns
- Exit code for the program.
- Return values
-
0 | on 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.
Implements gmx::ICommandLineModule.
virtual void gmx::anonymous_namespace{cmdlinemodulemanager.cpp}::CMainCommandLineModule::writeHelp |
( |
const CommandLineHelpContext & |
context | ) |
const |
|
inlinevirtual |
Prints help for the module.
- Parameters
-
[in] | context | Context object for writing the help. |
- Exceptions
-
std::bad_alloc | if out of memory. |
FileIOError | on any I/O error. |
Note that for MPI-enabled builds, this is called only on the master rank.
Implements gmx::ICommandLineModule.
The documentation for this class was generated from the following file: