This file is indexed.

/usr/include/trilinos/Teuchos_VerboseObject.hpp is in libtrilinos-teuchos-dev 12.10.1-3.

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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
// @HEADER
// ***********************************************************************
//
//                    Teuchos: Common Tools Package
//                 Copyright (2004) 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 TEUCHOS_VERBOSE_OBJECT_HPP
#define TEUCHOS_VERBOSE_OBJECT_HPP

#include "Teuchos_RCP.hpp"
#include "Teuchos_FancyOStream.hpp"
#include "Teuchos_VerbosityLevel.hpp"


namespace Teuchos {


/** \brief Non-templated base class for objects that can print their
 * activities to a stream.
 *
 * \ingroup teuchos_outputting_grp
 *
 * Objects that derive from this interface print to a default class-owned
 * (i.e. static) output stream object (set using <tt>setDefaultOStream()</tt>)
 * or the output stream can be set on an object-by-object basis using
 * <tt>setOStream()</tt>.
 *
 * The output stream type is <tt>FancyOStream</tt> which allows for automated
 * indentation (using the <tt>OSTab</tt> class) and has other useful features.
 */
class TEUCHOSCORE_LIB_DLL_EXPORT VerboseObjectBase {
public:

  //! @name Public static member functions
  //@{

  /** \brief Set the default output stream object.
   *
   * If this function is not called, then a default stream based on
   * <tt>std::cout</tt> is used.
   */
  static void setDefaultOStream( const RCP<FancyOStream> &defaultOStream );

  /** \brief Get the default output stream object. */
  static RCP<FancyOStream> getDefaultOStream();

  //@}

  //! @name Constructors/Initializers
  //@{

  /** \brief . */
  virtual ~VerboseObjectBase();

  /** \brief Calls <tt>initializeVerboseObject()</tt>.
   */
  explicit
  VerboseObjectBase(
    const RCP<FancyOStream> &oStream = Teuchos::null
    );

  /** \brief The output stream for <tt>*this</tt> object.
   *
   * This function is supposed by called by general clients to set the output
   * stream according to some general logic in the code.
   */
  virtual const VerboseObjectBase& setOStream(
    const RCP<FancyOStream> &oStream) const;

  /** \brief Set the overriding the output stream for <tt>*this</tt> object.
   *
   * This function is supposed to be called by special clients that want to
   * set the output stream in a way that will not be overridden by
   * <tt>setOStream()</tt>.
   */
  virtual const VerboseObjectBase& setOverridingOStream(
    const RCP<FancyOStream> &oStream) const;

  /** \brief Set line prefix name for this object */
  virtual VerboseObjectBase& setLinePrefix(const std::string &linePrefix);

  //@}

  //! @name Query functions
  //@{

  /** \brief Return the output stream to be used for out for <tt>*this</tt>
   * object.
   */
  virtual RCP<FancyOStream> getOStream() const;

  /** \brief Return the the overriding output stream if set.
   *
   * This is the output stream that will be returned from
   * <tt>getOStream()</tt> regardless that stream is set by
   * <tt>setOStream()</tt>.
   */
  virtual RCP<FancyOStream> getOverridingOStream() const;

  /** \brief Get the line prefix for this object */
  virtual std::string getLinePrefix() const;

  //@}

  //! @name Utilities
  //@{

  /** \brief Create a tab object which sets the number of tabs and optionally the line prefix.
   *
   * \param tabs  [in] The number of relative tabs to add (if <tt>tabs > 0</tt>) or remove (if <tt>tabs < 0</tt>).
   *              If <tt>tabs == OSTab::DISABLE_TABBING</tt> then tabbing will be turned off temporarily.
   *
   * \param linePrefix
   *              [in] Sets a line prefix that overrides <tt>this->getLinePrefix()</tt>.
   *
   * The side effects of these changes go away as soon as the returned
   * <tt>OSTab</tt> object is destroyed at the end of the block of code.
   *
   * Returns <tt>OSTab( this->getOStream(), tabs, linePrefix.length() ? linePrefix : this->getLinePrefix() )</tt>
   */
  virtual OSTab getOSTab(const int tabs = 1, const std::string &linePrefix = "") const;

  //@}

protected:

  /** \brief Calls <tt>initializeVerboseObject()</tt>.
   */
  void initializeVerboseObjectBase(
    const RCP<FancyOStream> &oStream = Teuchos::null
    );

  /** \brief Function that is called whenever the verbosity state
   * is updated.
   *
   * Subclasses can override this function to be informed whenever the
   * verbosity state of <tt>*this</tt> object gets updated.
   *
   * The default implementation simply does nothing.
   */
  virtual void informUpdatedVerbosityState() const;

private:

  std::string thisLinePrefix_;

//use pragmas to disable some false-positive warnings for windows sharedlibs export
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4251)
#endif
  mutable RCP<FancyOStream> thisOStream_;
  mutable RCP<FancyOStream> thisOverridingOStream_;
#ifdef _MSC_VER
#pragma warning(pop)
#endif

  static RCP<FancyOStream>& privateDefaultOStream();

};


/** \brief Templated base class for objects that can print their activities to
 * a stream and have a verbosity level.
 *
 * Objects that derive from this interface print to a default class-owned
 * (i.e. static) output stream object (set using <tt>setDefaultOStream()</tt>)
 * or the output stream can be set on an object-by-object basis using
 * <tt>setOStream()</tt> .  In addition, each object, by default, has a
 * verbosity level that is shared by all objects (set using
 * <tt>setDefaultVerbosityLevel()</tt>) or can be set on an object-by-object
 * basis using <tt>setVerbLevel()</tt>.
 *
 * The output stream type is <tt>FancyOStream</tt> which allows for automated
 * indentation (using the <tt>OSTab</tt> class) and has other useful features.
 *
 * Note that <tt>setOStream()</tt> and <tt>setVerbLevel()</tt> are actually
 * declared as <tt>const</tt> functions.  This is to allow a client to
 * temporarily change the stream and verbosity level.  To do this saftely, use
 * the class <tt>VerboseObjectTempState</tt> which will revert the output
 * state after it is destroyed.
 *
 * If the ParameterList subpackage of Teuchos is enabled (which it is
 * by default), you may use the readVerboseObjectSublist nonmember
 * function to pass a verbosity level and output stream filename to a
 * VerboseObject using a ParameterList.  The parameters are passed
 * through a "VerboseObject" sublist of the input ParameterList.  The
 * sublist in turn takes optional parameters "Verbosity Level"
 * (std::string) and "Output File" (std::string).  "Verbosity Level"
 * has six valid values: "VERB_DEFAULT", "VERB_NONE", "VERB_LOW",
 * "VERB_MEDIUM", "VERB_HIGH", and "VERB_EXTREME".  "VERB_DEFAULT"
 * tells the object to use its default verbosity level, and the
 * remaining values indicate increasing verbosity starting with
 * "VERB_NONE" (say nothing).  "Output File" is the name of a file to
 * use for output; "none" means do not open a file, but write to the
 * default output stream.
 */
template<class ObjectType>
class VerboseObject : virtual public VerboseObjectBase {
public:
  //! @name Public static member functions
  //@{

  /** \brief Set the default verbosity level.
   *
   * If not called, then the default verbosity level is <tt>VERB_DEFAULT</tt>.
   */
  static void setDefaultVerbLevel( const EVerbosityLevel defaultVerbLevel);

  /** \brief Get the default verbosity level. */
  static EVerbosityLevel getDefaultVerbLevel();

  //@}
  //! @name Constructors/Initializers
  //@{

  //! Constructor: calls <tt>initializeVerboseObject()</tt>.
  explicit
  VerboseObject(
    const EVerbosityLevel verbLevel = VERB_DEFAULT,  // Note, this must be the same as the default value for defaultVerbLevel_
    const RCP<FancyOStream> &oStream  = Teuchos::null
    );

  /** \brief Set this object's verbosity level.
   *
   * This function is supposed by called by general clients to set the output
   * level according to some general logic in the code.
   */
  virtual const VerboseObject& setVerbLevel(
    const EVerbosityLevel verbLevel) const;

  /** \brief Set the overriding verbosity level for <tt>*this</tt> object.
   *
   * This function is supposed to be called by special clients that want to
   * set the output level in a way that will not be overridden by
   * <tt>setOStream()</tt>.
   */
  virtual const VerboseObject& setOverridingVerbLevel(
    const EVerbosityLevel verbLevel) const;

  //@}
  //! @name Query functions
  //@{

  /** \brief Get the verbosity level */
  virtual EVerbosityLevel getVerbLevel() const;

  //@}

protected:

  /// \brief Initialize the VerboseObject.
  ///
  /// \param verbLevel [in] Initial verbosity level.
  /// \param oStream [in/out] Initial output stream.
  ///
  /// \note \c verbLevel must be the same as the default value for
  ///   <tt>defaultVerbLevel_</tt>.
  void initializeVerboseObject(
    const EVerbosityLevel verbLevel = VERB_DEFAULT,
    const RCP<FancyOStream> &oStream  = Teuchos::null
    );

private:

  mutable EVerbosityLevel thisVerbLevel_;
  mutable EVerbosityLevel thisOverridingVerbLevel_;

  static EVerbosityLevel& privateDefaultVerbLevel();

};


/** \brief Set and release a stream and verbosity level.
 *
 */
template<class ObjectType>
class VerboseObjectTempState {
public:
  /** \brief . */
  VerboseObjectTempState(
    const RCP<const VerboseObject<ObjectType> > &verboseObject,
    const RCP<FancyOStream> &newOStream,
    const EVerbosityLevel newVerbLevel
    ):
    verboseObject_(verboseObject),
    oldVerbLevel_(VERB_DEFAULT)
    {
      if(verboseObject_.get()) {
        oldOStream_ = verboseObject_->getOStream();
        oldVerbLevel_ = verboseObject_->getVerbLevel();
        verboseObject_->setOStream(newOStream);
        verboseObject_->setVerbLevel(newVerbLevel);
      }
    }
  /** \brief . */
  ~VerboseObjectTempState()
    {
      if(verboseObject_.get()) {
        verboseObject_->setOStream(oldOStream_);
        verboseObject_->setVerbLevel(oldVerbLevel_);
      }
    }
private:
  RCP<const VerboseObject<ObjectType> > verboseObject_;
  RCP<FancyOStream> oldOStream_;
  EVerbosityLevel oldVerbLevel_;
  // Not defined and not to be called
  VerboseObjectTempState();
  VerboseObjectTempState(const VerboseObjectTempState&);
  VerboseObjectTempState& operator=(const VerboseObjectTempState&);
};


// //////////////////////////////////
// Template defintions


//
// VerboseObject
//


// Public static member functions


template<class ObjectType>
void VerboseObject<ObjectType>::setDefaultVerbLevel( const EVerbosityLevel defaultVerbLevel)
{
  privateDefaultVerbLevel() = defaultVerbLevel;
}


template<class ObjectType>
EVerbosityLevel VerboseObject<ObjectType>::getDefaultVerbLevel()
{
  return privateDefaultVerbLevel();
}


// Constructors/Initializers


template<class ObjectType>
VerboseObject<ObjectType>::VerboseObject(
  const EVerbosityLevel verbLevel,
  const RCP<FancyOStream> &oStream
  )
  : thisOverridingVerbLevel_(VERB_DEFAULT)
{
  this->initializeVerboseObject(verbLevel,oStream);
}


template<class ObjectType>
void VerboseObject<ObjectType>::initializeVerboseObject(
  const EVerbosityLevel verbLevel,
  const RCP<FancyOStream> &oStream
  )
{
  thisVerbLevel_ = verbLevel;
  this->initializeVerboseObjectBase(oStream);
}


template<class ObjectType>
const VerboseObject<ObjectType>&
VerboseObject<ObjectType>::setVerbLevel(const EVerbosityLevel verbLevel) const
{
  thisVerbLevel_ = verbLevel;
  informUpdatedVerbosityState();
  return *this;
}


template<class ObjectType>
const VerboseObject<ObjectType>&
VerboseObject<ObjectType>::setOverridingVerbLevel(
  const EVerbosityLevel verbLevel
  ) const
{
  thisOverridingVerbLevel_ = verbLevel;
  informUpdatedVerbosityState();
  return *this;
}


// Query functions


template<class ObjectType>
EVerbosityLevel VerboseObject<ObjectType>::getVerbLevel() const
{
  if (VERB_DEFAULT != thisOverridingVerbLevel_)
    return thisOverridingVerbLevel_;
  if (VERB_DEFAULT == thisVerbLevel_)
    return getDefaultVerbLevel();
  return thisVerbLevel_;
}


// Private static members


template<class ObjectType>
EVerbosityLevel& VerboseObject<ObjectType>::privateDefaultVerbLevel()
{
  static EVerbosityLevel defaultVerbLevel = VERB_DEFAULT;
  return defaultVerbLevel;
}


} // namespace Teuchos


#endif // TEUCHOS_VERBOSE_OBJECT_HPP