Gromacs
2019
|
#include <gromacs/utility/fileredirector.h>
Allows overriding file existence checks from code that supports it.
The calling code should take in this interface and use the methods in it all file system operations that need to support this redirection.
This allows tests to override the file existence checks without actually using the file system. See IFileOutputRedirector for notes on a typical usage pattern.
With some further refactoring of the File class, this could also support redirecting input files from in-memory buffers as well, but for now the current capabilities are sufficient.
Public Member Functions | |
virtual bool | fileExists (const char *filename, File::NotFoundHandler onNotFound) const =0 |
Checks whether the provided path exists (and is a file). More... | |
bool | fileExists (const std::string &filename, File::NotFoundHandler onNotFound) const |
Convenience method to check file existence using an std::string path. | |
|
pure virtual |
Checks whether the provided path exists (and is a file).
The onNotFound
can be used to influence the behavior on error conditions. Functions to pass as this parameter are provided as members of gmx::File.
Implemented in gmx::test::TestFileInputRedirector.