This file is indexed.

/usr/include/openturns/OSS.hxx is in libopenturns-dev 1.5-7build2.

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
//                                               -*- C++ -*-
/**
 *  @file  OSS.hxx
 *  @brief The class OSS streams out objects
 *
 *  Copyright 2005-2015 Airbus-EDF-IMACS-Phimeca
 *
 *  This library 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 3 of the License, or
 *  (at your option) any later version.
 *
 *  This library 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
 *  along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 *  @author schueller
 *  @date   2012-07-16 12:24:33 +0200 (Mon, 16 Jul 2012)
 */
#ifndef OPENTURNS_OSS_HXX
#define OPENTURNS_OSS_HXX

#include <sstream>
#include <iterator>
#include <functional>
#include <utility>        // for std::pair
#include "OStream.hxx"

BEGIN_NAMESPACE_OPENTURNS

template <typename U, typename V>
std::ostream & operator << (std::ostream & os, const std::pair<U, V> & p)
{
  return os << "(" << p.first << "," << p.second << ")";
}

template <typename U, typename V>
OStream & operator << (OStream & OS, const std::pair<U, V> & p)
{
  return OS << "(" << p.first << "," << p.second << ")";
}



/**
 * Struct Bulk protects the underlying object output from being
 * modified by OSSFormater
 */
template <class T>
struct Bulk
{
  T data_;
  Bulk(T data) : data_(data) {}
  operator T() const
  {
    return data_;
  }
};

/**
 * Struct OSSFormater is a helper class for OSS that adapt the
 * format of output according to type T
 */

/* Any type */
template <class T>
struct OSSFormater
{
  inline
  static
  void apply(std::ostringstream & oss, T obj, int precision)
  {
    oss << obj;
  }

  inline
  static
  void apply(OStream & OS, T obj, int precision)
  {
    OS << obj;
  }
}; /* struct OSSFormater */

/* double */
template <>
struct OSSFormater<double>
{
  inline
  static
  void apply(std::ostringstream & oss, double d, int precision)
  {
    int oldPrecision = static_cast<int>(oss.precision(precision));
    oss << d;
    oss.precision(oldPrecision);
  }

  inline
  static
  void apply(OStream & OS, double d, int precision)
  {
    int oldPrecision = static_cast<int>(OS.getStream().precision(precision));
    OS.getStream() << d;
    OS.getStream().precision(oldPrecision);
  }
};

/* float */
template <>
struct OSSFormater<float>
{
  inline
  static
  void apply(std::ostringstream & oss, float f, int precision)
  {
    int oldPrecision = static_cast<int>(oss.precision(precision));
    oss << f;
    oss.precision(oldPrecision);
  }

  inline
  static
  void apply(OStream & OS, float f, int precision)
  {
    int oldPrecision = static_cast<int>(OS.getStream().precision(precision));
    OS.getStream() << f;
    OS.getStream().precision(oldPrecision);
  }
};

/* bool */
template <>
struct OSSFormater<bool>
{
  inline
  static
  void apply(std::ostringstream & oss, bool b, int precision)
  {
    oss << (b ? "true" : "false");
  }

  inline
  static
  void apply(OStream & OS, bool b, int precision)
  {
    OS.getStream() << (b ? "true" : "false");
  }
};






/**
 * Class OSS is useful when streaming data through a function
 * that expect a string as parameter
 */
class OT_API OSS
{
private:
  std::ostringstream oss_;
  mutable int precision_;
  mutable bool full_;

public:
  explicit OSS(bool full = true);

  template <class T>
  inline
  OSS & operator << (T obj)
  {
    if (full_)
    {
      OStream OS(oss_);
      OSSFormater<T>::apply(OS, obj, precision_);
    }
    else OSSFormater<T>::apply(oss_, obj, precision_);
    return *this;
  }

  inline
  OSS & setPrecision(int precision)
  {
    precision_ = precision;
    oss_.precision(precision_);
    return *this;
  }

  inline
  int getPrecision() const
  {
    precision_ = static_cast<int>(oss_.precision());
    return precision_;
  }

  operator std::string() const;
  std::string str() const;

  void clear();

}; /* class OSS */

template <typename _Tp>
struct AllElementsPredicate : public std::unary_function<_Tp, Bool>
{
  Bool
  operator()(const _Tp&) const
  {
    return true;
  }
};

template < typename _Tp, typename _UnaryPredicate = AllElementsPredicate<_Tp>, typename _CharT = char,
         typename _Traits = std::char_traits<_CharT> >
class OSS_iterator
  : public std::iterator<std::output_iterator_tag, void, void, void, void>
{
public:
  //@{
  /// Public typedef
  typedef _CharT                         char_type;
  typedef _Traits                        traits_type;
  typedef OSS                            ostream_type;
  //@}

private:
  ostream_type*     _M_stream;
  String            _M_string;
  String            _M_prefix;
  mutable bool      _M_first;

public:
  /**
   *  Construct from an ostream
   *
   *  The delimiter string @a c is written to the stream after every Tp
   *  written to the stream.  The delimiter is not copied, and thus must
   *  not be destroyed while this iterator is in use.
   *
   *  @param  s  Underlying ostream to write to.
   *  @param  c  CharT delimiter string to insert.
   */
  OSS_iterator(ostream_type & __s, const String & __c = "", const String & __p = "")
    : _M_stream(&__s)
    , _M_string(__c)
    , _M_prefix(__p)
    , _M_first(true)
  {}

  /// Copy constructor.
  OSS_iterator(const OSS_iterator& __obj)
    : _M_stream(__obj._M_stream)
    , _M_string(__obj._M_string)
    , _M_prefix(__obj._M_prefix)
    , _M_first(__obj._M_first)
  {}

  /// Copy assignment
  OSS_iterator&
  operator=(const OSS_iterator& obj)
  {
    _M_stream = obj._M_stream;
    _M_string = obj._M_string;
    _M_prefix = obj._M_prefix;
    _M_first  = obj._M_first;
    return *this;
  }

  /// Writes @a value to underlying ostream using operator<<.  If
  /// constructed with delimiter string, writes delimiter to ostream.
  OSS_iterator&
  operator=(const _Tp& value)
  {
#ifdef __GNUC__
#if ( GCC_VERSION >= 30400 )
    __glibcxx_requires_cond(_M_stream != 0,
                            _M_message(__gnu_debug::__msg_output_ostream)
                            ._M_iterator(*this));
#endif
#endif
    if (_UnaryPredicate()(value))
    {
      if (!_M_first) *_M_stream << _M_string;
      *_M_stream << _M_prefix << value;
      _M_first = false;
    }
    return *this;
  }

  OSS_iterator&
  operator*()
  {
    return *this;
  }

  OSS_iterator&
  operator++()
  {
    return *this;
  }

  OSS_iterator&
  operator++(int)
  {
    return *this;
  }

};


END_NAMESPACE_OPENTURNS

#endif /* OPENTURNS_OSS_HXX */