/**********************************************************************
* 
* user_abort.h
*
* This file is part of MitoGen
* 
* Copyright (C) 2013-2016 -- Centre for Biomedical Image Analysis (CBIA)
* http://cbia.fi.muni.cz/
* 
* MitoGen is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* 
* MitoGen is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with MitoGen. If not, see <http://www.gnu.org/licenses/>.
* 
* Author: Vladimir Ulman
* 
* Description: A module that controls the presence of LOCK file in the
* current directory. If the file is missing, the application correctly
* completes the phases of all living cells in the population. This way,
* we prevent from invasive interruption of the generation process.
*
***********************************************************************/

#ifndef MITOGEN_USER_ABORT_H
#define MITOGEN_USER_ABORT_H

/**
 * Indicator of user requested abort, which is recognized when
 * there \b DOES \b NOT \b exist a file called \e file in the current working directory.
 *
 * The routine performs check for the presence of this file. If it is
 * \b NOT \b found and \e stop is true, it throws a 'user requested interrupt' exception.
 *
 * Actually, the routine tries to open the file for read-only access.
 * The content of the file is not modified at all.
 *
 * \param[in] file	the name of the file to be checked
 * \param[in] stop	whether the routine should also stop
 *
 * \return Returns true if detected user's wish to stop.
 */
bool UserAbort(const char *file, const bool stop=true);

#endif
