Gromacs
2024.4
|
#include <gromacs/trajectoryanalysis/cmdlinerunner.h>
Runner for command-line trajectory analysis tools.
This class provides static methods to implement a command-line analysis program, given a TrajectoryAnalysisModule object (or a factory of such). It takes care of common command-line parameters, initializing and evaluating selections, and looping over trajectory frames.
Public Types | |
typedef std::function < TrajectoryAnalysisModulePointer()> | ModuleFactoryMethod |
Factory method type for creating a trajectory analysis module. More... | |
Static Public Member Functions | |
template<class ModuleType > | |
static int | runAsMain (int argc, char *argv[]) |
Implements a main() method that runs a given module. More... | |
static int | runAsMain (int argc, char *argv[], const ModuleFactoryMethod &factory) |
Implements a main() method that runs a given module. More... | |
static void | registerModule (CommandLineModuleManager *manager, const char *name, const char *description, const ModuleFactoryMethod &factory) |
Registers a command-line module that runs a given module. More... | |
static std::unique_ptr < ICommandLineOptionsModule > | createModule (TrajectoryAnalysisModulePointer module) |
Create a command-line module that runs the provided analysis module. More... | |
typedef std::function<TrajectoryAnalysisModulePointer()> gmx::TrajectoryAnalysisCommandLineRunner::ModuleFactoryMethod |
Factory method type for creating a trajectory analysis module.
This method allows the module creation to be postponed to the point where the module is needed, reducing initialization costs in, e.g., the gmx
binary, and simplifying exception handling.
|
static |
Create a command-line module that runs the provided analysis module.
[in] | module | Module to run. |
std::bad_alloc | if out of memory. |
This is mainly provided for testing purposes that want to bypass CommandLineModuleManager.
|
static |
Registers a command-line module that runs a given module.
manager | Manager to register the module to. |
name | Name of the module to register. |
description | One-line description for the module to register. |
factory | Function that creates the module on demand. |
name
and descriptions
must be string constants or otherwise stay valid for the duration of the program execution.
|
inlinestatic |
Implements a main() method that runs a given module.
ModuleType | Trajectory analysis module. |
This method abstracts away all the logic required to implement a main() method in user tools, allowing that to be changed without requiring changes to the tools themselves.
ModuleType
should be default-constructible and derive from TrajectoryAnalysisModule.
Does not throw. All exceptions are caught and handled internally.
|
static |
Implements a main() method that runs a given module.
argc | argc passed to main(). |
argv | argv passed to main(). |
factory | Function that creates the module on demand. |
Implements the template runAsMain(), but can also be used independently.
Does not throw. All exceptions are caught and handled internally.