This file is indexed.

/usr/include/openturns/OSS.hxx is in libopenturns-dev 0.15-2.

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
//                                               -*- C++ -*-
/**
 *  @file  OSS.hxx
 *  @brief The class OSS streams out objects
 *
 *  (C) Copyright 2005-2011 EDF-EADS-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 2.1 of the License.
 *
 *  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
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 *
 *  @author: $LastChangedBy: schueller $
 *  @date:   $LastChangedDate: 2011-06-01 17:59:24 +0200 (Wed, 01 Jun 2011) $
 *  Id:      $Id: OSS.hxx 1920 2011-06-01 15:59:24Z schueller $
 */
#ifndef OPENTURNS_OSS_HXX
#define OPENTURNS_OSS_HXX

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

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>
  Base::Common::OStream & operator << (Base::Common::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(Base::Common::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 = oss.precision(precision);
      oss << d;
      oss.precision(oldPrecision);
    }

    inline
    static
    void apply(Base::Common::OStream & OS, double d, int precision)
    {
      int oldPrecision = 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 = oss.precision(precision);
      oss << f;
      oss.precision(oldPrecision);
    }

    inline
    static
    void apply(Base::Common::OStream & OS, float f, int precision)
    {
      int oldPrecision = 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(Base::Common::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 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_) {
        Base::Common::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_ = 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;
    const String &    _M_string;
    const String &    _M_prefix;
    mutable bool      _M_first;

  public:
    /// Construct from an ostream.
    OSS_iterator(ostream_type& __s) : _M_stream(&__s), _M_string(), _M_prefix(), _M_first(true) {}

    /**
     *  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)  {}

    /// 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; }

  };


} /* namespace OpenTURNS */

#endif /* OPENTURNS_OSS_HXX */