Make some unit tests skip file system access
[alexxy/gromacs.git] / src / gromacs / options / filenameoptionmanager.h
index ac588a00606dde9f0f530f12880fe684d510e7c0..37f9f7c3bb880673bc18ee49e617deacc4da3ab8 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2014, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -51,6 +51,7 @@
 namespace gmx
 {
 
+class FileInputRedirectorInterface;
 class FileNameOptionInfo;
 class Options;
 
@@ -84,6 +85,24 @@ class FileNameOptionManager : public OptionManagerInterface
         FileNameOptionManager();
         virtual ~FileNameOptionManager();
 
+        /*! \brief
+         * Redirects file existence checks.
+         *
+         * \param[in] redirector  File redirector to use for existence checks.
+         *
+         * The manager checks for existence of various files on the file system
+         * to complete file extensions.  This method can be used to redirect
+         * those checks to an alternative implementation.
+         *
+         * This is used for unit tests to more easily control the result of the
+         * checks and to keep the tests as fast as possible by avoiding real
+         * file system access.  To keep implementation options open, behavior
+         * with `redirector == NULL` is undefined and should not be relied on.
+         * For tests, there should only be need to call this a single time,
+         * right after creating the manager.
+         */
+        void setInputRedirector(const FileInputRedirectorInterface *redirector);
+
         /*! \brief
          * Disables special input file option handling.
          *