This file is indexed.

/usr/include/gromacs/commandline/cmdlineprogramcontext.h is in libgromacs-dev 2018.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
/*
 * This file is part of the GROMACS molecular simulation package.
 *
 * Copyright (c) 2012,2013,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.
 *
 * GROMACS is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2.1
 * of the License, or (at your option) any later version.
 *
 * GROMACS 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with GROMACS; if not, see
 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
 *
 * If you want to redistribute modifications to GROMACS, please
 * consider that scientific software is very special. Version
 * control is crucial - bugs must be traceable. We will be happy to
 * consider code for inclusion in the official distribution, but
 * derived work must not be called official GROMACS. Details are found
 * in the README & COPYING files - if they are missing, get the
 * official version at http://www.gromacs.org.
 *
 * To help us fund GROMACS development, we humbly ask that you cite
 * the research papers on the package. Check out http://www.gromacs.org.
 */
/*! \file
 * \brief
 * Declares gmx::CommandLineProgramContext.
 *
 * This header is installed to support cmdlineinit.h because some compilers
 * don't allow returning a reference to an incomplete type from a function.
 * It should not be necessary to use gmx::CommandLineProgramContext outside the
 * \Gromacs library.
 *
 * \author Teemu Murtola <teemu.murtola@gmail.com>
 * \inlibraryapi
 * \ingroup module_commandline
 */
#ifndef GMX_COMMANDLINE_CMDLINEPROGRAMCONTEXT_H
#define GMX_COMMANDLINE_CMDLINEPROGRAMCONTEXT_H

#include <memory>
#include <string>
#include <vector>

#include "gromacs/utility/classhelpers.h"
#include "gromacs/utility/programcontext.h"

namespace gmx
{

//! \addtogroup module_commandline
//! \{

/*! \libinternal \brief
 * Allows customization of the way various directories are found by
 * CommandLineProgramContext.
 *
 * For the CommandLineProgramContext constructors that do not take this
 * interface as a parameter, a default implementation is used that forwards
 * the calls to the corresponding methods in gmx::Path.
 *
 * \inlibraryapi
 */
class IExecutableEnvironment
{
    public:
        virtual ~IExecutableEnvironment() {}

        /*! \brief
         * Returns the working directory when the program was launched.
         */
        virtual std::string getWorkingDirectory() const = 0;
        /*! \brief
         * Returns list of paths where executables are searched for.
         *
         * The returned list should be in priority order.  An empty string in
         * the returned list corresponds to getWorkindDirectory().
         */
        virtual std::vector<std::string> getExecutablePaths() const = 0;
};

//! Shorthand for a smart pointer to IExecutableEnvironment.
typedef std::unique_ptr<IExecutableEnvironment> ExecutableEnvironmentPointer;

/*! \libinternal \brief
 * Program context implementation for command line programs.
 *
 * Constructors are provided mostly for unit testing purposes; in normal usage,
 * a single CommandLineProgramContext object is constructed with
 * initForCommandLine() in the beginning of the program.
 * The returned object can be explicitly passed to other methods, or accessed
 * through getProgramContext().
 *
 * Unless explicitly noted otherwise, methods in this class may throw
 * std::bad_alloc on out-of-memory conditions, but do not throw other
 * exceptions.
 *
 * \inlibraryapi
 */
class CommandLineProgramContext : public IProgramContext
{
    public:
        /*! \brief
         * Constructs an empty context object.
         *
         * All methods in the constructed object return dummy values.
         */
        CommandLineProgramContext();
        /*! \brief
         * Initializes a program context object with binary name only.
         *
         * \param[in] binaryName  Name of the binary.
         *
         * This is needed for unit testing purposes.
         * The constructed object works as if the command line consisted of
         * only of the binary name.
         */
        explicit CommandLineProgramContext(const char *binaryName);
        /*! \brief
         * Initializes a program context object based on command line.
         *
         * \param[in] argc  argc value passed to main().
         * \param[in] argv  argv array passed to main().
         */
        CommandLineProgramContext(int argc, const char *const argv[]);
        /*! \brief
         * Initializes a program context object based on command line.
         *
         * \param[in] argc  argc value passed to main().
         * \param[in] argv  argv array passed to main().
         * \param[in] env   Customizes the way the binary name is handled.
         *
         * This overload allows one to customize the way the binary is located
         * by providing a custom IExecutableEnvironment implementation.
         * This is mainly useful for testing purposes to make it possible to
         * test different paths without setting environment variables, changing
         * the working directory or doing other process-wide operations.
         * It may also be useful for making Gromacs behave better when linked
         * into a non-Gromacs executable (with possible extensions in
         * IExecutableEnvironment).
         */
        CommandLineProgramContext(int argc, const char *const argv[],
                                  ExecutableEnvironmentPointer env);
        virtual ~CommandLineProgramContext();

        /*! \brief
         * Sets a display name for the binary.
         *
         * \throws std::bad_alloc if out of memory.
         *
         * This is used with the wrapper binary to add the name of the invoked
         * module to the name of the binary shown.
         *
         * It is not threadsafe if there are concurrent calls to displayName()
         * before this method has returned.  Thread safety is not required for
         * the normal initialization sequence of command line programs; it is
         * called in the wrapper binary before the control passes to the actual
         * module which may create threads.
         */
        void setDisplayName(const std::string &name);

        /*! \brief
         * Returns the name of the binary as it was invoked without any path.
         *
         * Does not throw.
         */
        virtual const char *programName() const;
        /*! \brief
         * Returns a display name of the current module.
         *
         * The returned value equals programName(), unless a separate display
         * name has been set with setDisplayName().
         *
         * Does not throw.
         */
        virtual const char *displayName() const;
        /*! \brief
         * Returns the full path of the running binary.
         *
         * \throws std::bad_alloc if out of memory.
         * \throws tMPI::system_error on thread synchronization errors.
         *
         * Returns argv[0] if there was an error in finding the absolute path.
         */
        virtual const char *fullBinaryPath() const;
        /*! \brief
         * Returns the installation prefix (for finding \Gromacs data files).
         *
         * \throws std::bad_alloc if out of memory.
         * \throws tMPI::system_error on thread synchronization errors.
         *
         * Returns a hardcoded path set during configuration time if there is
         * an error in finding the library data files.
         */
        virtual InstallationPrefixInfo installationPrefix() const;
        /*! \brief
         * Returns the full command line used to invoke the binary.
         *
         * Does not throw.
         */
        virtual const char *commandLine() const;

    private:
        class Impl;

        PrivateImplPointer<Impl> impl_;
};

} // namespace gmx

#endif