This file is indexed.

/usr/include/pbcopper/stream/Stream.h is in libpbcopper-dev 0.0.1+20161202-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
#ifndef PBCOPPER_STREAM_STREAM_H
#define PBCOPPER_STREAM_STREAM_H

#include "pbcopper/Config.h"
#include <functional>

namespace PacBio {
namespace Stream {

/// \brief Sink function type for data streams.
///
/// A sink function takes a data value and does some 'final' action on it, such
/// as printing.
///
/// Example:
/// \code{.cpp}
///     auto printToConsole = [](const int x) { std::cout << x; };
/// \endcode
///
template<typename T>
using Sink = std::function<void (const T&)>;

/// \brief Source function type for data streams.
///
/// A source function writes data to the sink provided.
///
/// Example:
/// \code{.cpp}
///     auto intList = [](Sink<std::int> out)
///     {
///         const std::vector<int> v = { 1,2,3,4,5 };
///         for (auto e : v)
///             out(e);
///     };
/// \endcode
///
template<typename T>
using Source = std::function<void (Sink<T>)>;

/// \brief Source function type for data streams.
///
/// A transform function takes a value, (likely) does some modification and
/// writes to the sink provided. Input & output types are allowed to differ.
///
/// Example:
/// \code{.cpp}
///     auto splitLines = [](Sink<std::string> out, std::string s)
///     {
///         auto stream = std::stringstream{ s };
///         auto token  = std::string{ };
///         while (std::getline(stream, token)
///             out(token);
///     };
///
///     auto intToString = [](Sink<std::string> out, int x)
///     {
///         out( std::to_string(x) );
///     };
/// \endcode
///
template<typename T, typename U>
using Transform = std::function<void (Sink<U>, T)>;

/// \brief This method connects a Source to a Sink, in that order.
///
/// \param source   data source
/// \param sink     data sink
///
template<typename T>
void sourceToSink(Source<T> source, Sink<T> sink)
{
    source(sink);
}

/// \brief This method connects a Transform to a Sink, in that order.
///
/// \param transform    data transform
/// \param sink         data sink
///
/// \returns a Sink function, which can transform data before the final action
///
template<typename T, typename U>
Sink<T> transformToSink (Transform<T,U> transform, Sink<U> sink)
{
    return [transform, sink](const T& value) {
        transform(sink, value);
    };
}

/// \brief This method connects a Source to a Transform, in that order.
///
/// \param source       data source
/// \param transform    data transform
///
/// \returns a Source function, which provides transformed data
///
template<typename T, typename U>
Source<U> sourceToTransform (Transform<T,U> transform, Source<T> source)
{
    return [transform, source](Sink<U> sink)
    {
        auto intermediateSink = [transform, sink](const T& value)
        {
            transform(sink, value);
        };
        source(intermediateSink);
    };
}

/// \brief This method connects a Transform to another Transform.
///
/// \param t1   upstream data transform
/// \param t2   downstream data transform
///
/// \returns a Transform function representing the composite operation
///
template<typename T, typename Intermediate, typename U>
Transform<T,U> transformToTransform(Transform<T, Intermediate> t1,
                                    Transform<Intermediate, U> t2)
{
    return [t1, t2](Sink<U> finalSink, T originalValue)
    {
        auto intermediateSink = [t2,finalSink](const Intermediate& value)
        {
            t2(finalSink, value);
        };
        t1(intermediateSink, originalValue);
    };
}

/// \brief Overloaded stream operator for chaining (source >> sink).
///
/// \param source   data source
/// \param sink     data sink
///
/// \sa sourceToSink
///
template<typename T, typename U>
void operator>>(Source<T> source, Sink<U> sink)
{
    sourceToSink(source, sink);
}

/// \brief Overloaded stream operator for chaining (source >> transform).
///
/// \param source       data source
/// \param transform    data transform
///
/// \returns a Source function, which provides transformed data
/// \sa sourceToTransform
///
template<typename T, typename U>
Source<U> operator>>(Source<T> source, Transform<T,U> transform)
{
    return sourceToTransform(transform, source);
}

/// \brief Overloaded stream operator for chaining (transform >> sink).
///
/// \param transform    data transform
/// \param sink         data sink
///
/// \returns a Sink function, which can transform data before the final action
/// \sa transformToSink
///
template<typename T, typename U>
Sink<T> operator>>(Transform<T,U> transform, Sink<U> sink)
{
    return transformToSink(transform, sink);
}

/// \brief Overloaded stream operator for chaining (transform >> transform).
///
/// \param t1   upstream data transform
/// \param t2   downstream data transform
///
/// \returns a Transform function representing the composite operation
/// \sa transformToTransform
///
template<typename T, typename Intermediate, typename U>
Transform<T,U> operator>>(Transform<T, Intermediate> t1,
                          Transform<Intermediate, U> t2)
{
    return transformToTransform(t1, t2);
}

} // namespace Stream
} // namespace PacBio

#endif // PBCOPPER_CLI_FXNCLI_H