Refactor ProgramInfo use
[alexxy/gromacs.git] / src / gromacs / commandline / cmdlineinit.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 2013,2014, by the GROMACS development team, led by
5  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6  * and including many others, as listed in the AUTHORS file in the
7  * top-level source directory and at http://www.gromacs.org.
8  *
9  * GROMACS is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public License
11  * as published by the Free Software Foundation; either version 2.1
12  * of the License, or (at your option) any later version.
13  *
14  * GROMACS is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with GROMACS; if not, see
21  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
23  *
24  * If you want to redistribute modifications to GROMACS, please
25  * consider that scientific software is very special. Version
26  * control is crucial - bugs must be traceable. We will be happy to
27  * consider code for inclusion in the official distribution, but
28  * derived work must not be called official GROMACS. Details are found
29  * in the README & COPYING files - if they are missing, get the
30  * official version at http://www.gromacs.org.
31  *
32  * To help us fund GROMACS development, we humbly ask that you cite
33  * the research papers on the package. Check out http://www.gromacs.org.
34  */
35 /*! \file
36  * \brief
37  * Declares functions for initializing the \Gromacs library for command-line use.
38  *
39  * \author Teemu Murtola <teemu.murtola@gmail.com>
40  * \inpublicapi
41  * \ingroup module_commandline
42  */
43 #ifndef GMX_COMMANDLINE_CMDLINEINIT_H
44 #define GMX_COMMANDLINE_CMDLINEINIT_H
45
46 // Forward declaration of class ProgramInfo is not sufficient for MSVC if
47 // the return value of initForCommandLine() is ignored(!)
48 #include "cmdlineprogramcontext.h"
49
50 namespace gmx
51 {
52
53 /*! \brief
54  * Initializes the \Gromacs library for command-line use.
55  *
56  * \param[in] argc  argc value passed to main().
57  * \param[in] argv  argv array passed to main().
58  * \returns   Reference to initialized program context object.
59  *
60  * This function is tailored for use in command line applications.
61  * For other usage, combination of gmx::init() and gmx::setProgramContext()
62  * provides more flexible initialization alternatives.
63  * Unlike gmx::init(), calls to this method cannot be nested.
64  *
65  * The command line arguments are communicated so that they can be
66  * parsed on each processor.
67  * \p argc and \p argv are passed to gmx::init(); see there for additional
68  * discussion.  This method does not place any additional limitations, but
69  * generally there should be no need to pass NULL values.
70  *
71  * Does not throw. Terminates the program on out-of-memory error.
72  *
73  * This method is not thread-safe, since it is intended to be the first method
74  * called.  See setProgramContext() for additional discussion.
75  *
76  * \see gmx::init()
77  * \see setProgramContext()
78  * \ingroup module_commandline
79  */
80 ProgramInfo &initForCommandLine(int *argc, char ***argv);
81 /*! \brief
82  * Deinitializes the \Gromacs library after initForCommandLine().
83  *
84  * Calls gmx::finalize() and additionally undoes the work done by
85  * initForCommandLine().
86  *
87  * \see gmx::finalize()
88  * \ingroup module_commandline
89  */
90 void finalizeForCommandLine();
91
92 } // namespace gmx
93
94 #endif