Gromacs  2025-dev-20241002-88a4191
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
gmx::IFileInputRedirector Class Referenceabstract

#include <gromacs/utility/include/gromacs/utility/fileredirector.h>

+ Inheritance diagram for gmx::IFileInputRedirector:

Description

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 std::filesystem::path &filename, const File::NotFoundHandler &onNotFound) const =0
 Checks whether the provided path exists (and is a file). More...
 

Member Function Documentation

virtual bool gmx::IFileInputRedirector::fileExists ( const std::filesystem::path &  filename,
const File::NotFoundHandler &  onNotFound 
) const
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, and gmx::anonymous_namespace{fileredirector.cpp}::DefaultInputRedirector.


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