This file is indexed.

/usr/include/trilinos/Trilinos_Util_CommandLineParser.h is in libtrilinos-triutils-dev 12.12.1-5.

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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
// @HEADER
// ***********************************************************************
//
//                 TriUtils: Trilinos Utilities Package
//                 Copyright (2011) Sandia Corporation
//
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
// license for use of this work by or on behalf of the U.S. Government.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
//
// ***********************************************************************
// @HEADER

#ifndef _TRILINOS_UTIL_CLP_
#define _TRILINOS_UTIL_CLP_

#include <iostream>
#include <string>
#include <map>

class Trilinos_Util_Map {

public:


  Trilinos_Util_Map();

  virtual ~Trilinos_Util_Map()
  {  }

  //@}

  //@{ \name Insertion/Removal methods.

  //! Gets the value of the specified option as an integer. If not found, returns the specified default value.
  virtual int    Get( const std::string input, const int def_value) ;

  //! Gets the value of the specified option as a double. If not found, returns the specified default value.
  virtual double Get( const std::string input, const double def_value) ;

 //! Gets the value of the specified option as a std::string. If not found, returns the specified default value.
  virtual std::string Get( const std::string input, const std::string def_value ) ;

  //! Modify the value of a database entry.
  /*!  This method modifies the value of a database entry. If the entry
    does not exist in the database, return \c false. Otherwise, returns
    \c true.
  */
  virtual bool Set(const std::string input, const char * value);
  virtual bool Set(const std::string input, const std::string value);
  virtual bool Set(const std::string input, const int value);
  virtual bool Set(const std::string input, const double value);

  //! Add an entry to the databse
  /*!  This method add an entry to the databse. First, it checks that
    this entry does not exist. If it exists, the method returns \c
    false. Otherwise, it adds the entry and returns \c true.
  */
  virtual bool   Add( const std::string input, const std::string value );

  inline bool SetLabel(std::string Label) {
    Label_ = Label;
    return true;
  }

  inline std::string GetLabel(std::string Label) {
    return( Label_ );
  }

  //@}

  //@{ \name Query methods.

  /*! \brief Check wheter an option is in the database or not

  This method checks whether option \c input is in the databse or not.
  It returns \c true if it is, \c false otherwise.
  */
  virtual bool Has(const std::string input);

  //@}

  //@{ \name Miscellaneous methods.

  //! Show all the databse entries
  virtual void    ShowAll() const;

  //! Show all the databse entries, including entries beginning with "_"
  virtual void    ShowReallyAll() const;

  virtual void Reset(void);

  //@}

  //@{ \name Friend functions .

  friend std::ostream & operator << (std::ostream & os,
        const Trilinos_Util_Map & S);

  //@}

private:

  std::string Label_;

  // map containing the arguments
  std::map<std::string,std::string> Map_;

};

//! Trilinos_Util::CommandLineParser: A class for managing the input arguments and variables.

/* ======================================================================== */
/*!
 \class Trilinos_Util::CommandLineParser

 Using Trilinos_Util::CommandLineParser, it is easy to handle input line arguments and shell
 variables. For instance, the user can write
 \verbatim
 $ ./a.out -nx 10 -tol 1e-6 -solver=cg
 \endverbatim
 and then easily retrive the value of \c nx, \c tol, and \c solver.

 A simple code using this class is as follows:
 \verbatim
 int main(int argc, char *argv[])
  {

   Trilinos_Util::CommandLineParser CLP(argc,argv);
   int nx = CLP.GetInt("-nx", 123);
   int ny = CLP.GetInt("-ny", 145);
   double tol = CLP.GetDouble("-tol", 1e-12);
   std::string solver = CLP.GetInt("-solver");

   cout << "nx = " << nx << endl;
   cout << "ny = " << ny << " (default value)" << endl;
   cout << "tol = " << tol << endl;
   cout << "solver = " << solver << endl;

   return 0;

 }
 \endverbatim

 Each line option can have a value or not. For options with a value,
 the user can specify this values as follows. Let \c -tolerance be the
 name of the option and \c 1e-12 its value. Both choices are valid:
 - \c -option \c 1e-12 (with one or more spaces)
 - \c -option=1e-12 (an `=' sign and no spaces)

 Options are indentified with one or more dashes (`-'). Each option
 cannot have more than one value.

 Note that the user can specify some values without giving them a name.
 This can be done as follows:
  \verbatim
  $ ./a.out value1 value2 value 3 -nx 10 -tol 1e-6 -solver=cg
  \endverbatim
 Here, \c valueX, (X=1,...,9) is stored in the database entry
 \c ARGV_X.

 To use this class, the user has to build the database using the \c
 argc,argv input arguments. Then, to retrive the option value, the user
 has to use one of the following functions:
 - GetInt
 - GetDouble
 - GetString

 If option name is not found in the database, a value of 0, 0.0 or an
 empty std::string is returned. If needed, the user can also specify a
 default value to return when the option name is not found in the
 database. Method \c HaveOption can be used to query the database for
 an option.

 The user can modify the database as well, using
 - Set
 - Add

 (GetInt, GetDouble, GetString, Set and Add are derived from the base class,
 Trilinos_Util_Map).

 Finally, the user can retrive the integer, double or std::string value of a
 shell environmental variable using:
 - GetIntShellVariable
 - GetDoubleShellVariable
 - GetStringShellVariable

 \date Albuquerque, 19-Jan-04

 \author Marzio Sala, SNL 9214

*/
// ================================================ ====== ==== ==== == =

namespace Trilinos_Util {

class CommandLineParser : public Trilinos_Util_Map
{

 public:

  //@{ \name Constructors/Destructor.
  //! Trilinos_Util_ShellOptions constructor using the options given at the shell line.
  CommandLineParser(int argc, char *argv[] );

  // ============= //
  // query and add //
  // ------------- //

  //@}

  //@{ \name Query methods.

  //!  Returns the name of the program as a C++ std::string.
  virtual std::string GetProgramName(void);

  // =============== //
  // shell variables //
  // --------------- //

  //!Returns the value of the environmenta variable \c str as an integer.
  /*! This methods returns the value of the environmental variable \c
    str. If the variable does not exists, returns \c 0. */
  virtual int    GetIntShellVariable( const char *str );

  //!Returns the value of the environmenta variable \c str as an double.
  /*! This methods returns the value of the environmenta variable \c
    str. If the variable does not exists, returns \c 0.0. */
  virtual double GetDoubleShellVariable( const char *str );

  //!Returns the value of the environmenta variable \c str as a C++ std::string.
  /*! This methods returns the value of the environmenta variable \c
    str. If the variable does not exists, returns \c "". */
  virtual std::string GetStringShellVariable( const char *str );

  //@}

};

// ================================================ ====== ==== ==== == =

class InputFileReader : public Trilinos_Util_Map
{

 public:

  InputFileReader(const char FileName[] );
  ~InputFileReader();

  virtual std::string GetFileName(void) const;

  //  virtual bool SetCommentChar(char c);
  virtual void SetCommentChars(const std::string c);

  //  virtual bool SetSeparationChar(char c);
  virtual void SetSeparationChars(const std::string c);

  virtual int ReadFile();
  virtual int ReadFile(const char FileName[]);

private:
  std::string FileName_;
  std::string CommentChars_;
  std::string SeparationChars_;
  bool FileHasBeenRead_;
};

} // namespace Trilinos_Util
#endif