Allow runAsMainSingleModule to be called more than once
[alexxy/gromacs.git] / src / gromacs / commandline / cmdlineinit.h
index 5c0fc026eb2b3aae9c9b84c96242502b6916b76e..0f95039cbcfb45f12afa13be5fc9f80391efa498 100644 (file)
@@ -47,7 +47,7 @@
 
 // Forward declaration of class CommandLineProgramContext is not sufficient for
 // MSVC if the return value of initForCommandLine() is ignored(!)
-#include "cmdlineprogramcontext.h"
+#include "gromacs/commandline/cmdlineprogramcontext.h"
 
 namespace gmx
 {
@@ -92,7 +92,19 @@ CommandLineProgramContext &initForCommandLine(int *argc, char ***argv);
  * \ingroup module_commandline
  */
 void finalizeForCommandLine();
-
+/*! \brief
+ * Handles an exception and deinitializes after initForCommandLine.
+ *
+ * \param[in] ex  Exception that is the cause for terminating the program.
+ * \returns   Return code to return from main().
+ *
+ * This method should be called as the last thing before terminating the
+ * program because of an exception. See processExceptionAtExit() for details.
+ * Additionally this method undoes the work done by initForCommandLine.
+ *
+ * Does not throw.
+ */
+int processExceptionAtExitForCommandLine(const std::exception &ex);
 /*! \brief
  * Implements a main() method that runs a single module.
  *