This file is indexed.

/usr/include/caf/response_handle.hpp is in libcaf-dev 0.13.2-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
/******************************************************************************
 *                       ____    _    _____                                   *
 *                      / ___|  / \  |  ___|    C++                           *
 *                     | |     / _ \ | |_       Actor                         *
 *                     | |___ / ___ \|  _|      Framework                     *
 *                      \____/_/   \_|_|                                      *
 *                                                                            *
 * Copyright (C) 2011 - 2015                                                  *
 * Dominik Charousset <dominik.charousset (at) haw-hamburg.de>                *
 *                                                                            *
 * Distributed under the terms and conditions of the BSD 3-Clause License or  *
 * (at your option) under the terms and conditions of the Boost Software      *
 * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE.       *
 *                                                                            *
 * If you did not receive a copy of the license files, see                    *
 * http://opensource.org/licenses/BSD-3-Clause and                            *
 * http://www.boost.org/LICENSE_1_0.txt.                                      *
 ******************************************************************************/

#ifndef CAF_RESPONSE_HANDLE_HPP
#define CAF_RESPONSE_HANDLE_HPP

#include <type_traits>

#include "caf/message_id.hpp"
#include "caf/typed_behavior.hpp"
#include "caf/continue_helper.hpp"
#include "caf/system_messages.hpp"
#include "caf/typed_continue_helper.hpp"

#include "caf/detail/type_list.hpp"
#include "caf/detail/typed_actor_util.hpp"

namespace caf {

/**
 * This tag identifies response handles featuring a
 * nonblocking API by providing a `then` member function.
 * @relates response_handle
 */
struct nonblocking_response_handle_tag {};

/**
 * This tag identifies response handles featuring a
 * blocking API by providing an `await` member function.
 * @relates response_handle
 */
struct blocking_response_handle_tag {};

/**
 * This helper class identifies an expected response message
 * and enables `sync_send(...).then(...)`.
 */
template <class Self, class ResultOptPairOrMessage, class Tag>
class response_handle;

/******************************************************************************
 *                            nonblocking + untyped                           *
 ******************************************************************************/
template <class Self>
class response_handle<Self, message, nonblocking_response_handle_tag> {
 public:
  response_handle() = delete;
  response_handle(const response_handle&) = default;
  response_handle& operator=(const response_handle&) = default;

  response_handle(message_id mid, Self* self) : m_mid(mid), m_self(self) {
    // nop
  }

  template <class... Ts>
  continue_helper then(Ts&&... xs) const {
    m_self->set_response_handler(m_mid, behavior{std::forward<Ts>(xs)...});
    return {m_mid};
  }

 private:
  message_id m_mid;
  Self* m_self;
};

/******************************************************************************
 *                            nonblocking + typed                             *
 ******************************************************************************/
template <class Self, class TypedOutputPair>
class response_handle<Self, TypedOutputPair, nonblocking_response_handle_tag> {
 public:
  response_handle() = delete;
  response_handle(const response_handle&) = default;
  response_handle& operator=(const response_handle&) = default;

  response_handle(message_id mid, Self* self) : m_mid(mid), m_self(self) {
    // nop
  }

  template <class... Fs>
  typed_continue_helper<
    typename detail::lifted_result_type<
      typename detail::common_result_type<
        typename detail::get_callable_trait<Fs>::result_type...
      >::type
    >::type>
  then(Fs... fs) {
    static_assert(sizeof...(Fs) > 0, "at least one functor is requried");
    static_assert(detail::conjunction<detail::is_callable<Fs>::value...>::value,
                  "all arguments must be callable");
    static_assert(detail::conjunction<
                    !std::is_base_of<match_case, Fs>::value...
                  >::value,
                  "match cases are not allowed in this context");
    detail::type_checker<TypedOutputPair, Fs...>::check();
    m_self->set_response_handler(m_mid, behavior{std::move(fs)...});
    return {m_mid};
  }

 private:
  message_id m_mid;
  Self* m_self;
};

/******************************************************************************
 *                             blocking + untyped                             *
 ******************************************************************************/
template <class Self>
class response_handle<Self, message, blocking_response_handle_tag> {
 public:
  response_handle() = delete;
  response_handle(const response_handle&) = default;
  response_handle& operator=(const response_handle&) = default;

  response_handle(message_id mid, Self* self) : m_mid(mid), m_self(self) {
    // nop
  }

  void await(behavior& bhvr) {
    m_self->dequeue(bhvr, m_mid);
  }

  template <class... Ts>
  void await(Ts&&... xs) const {
    behavior bhvr{std::forward<Ts>(xs)...};
    m_self->dequeue(bhvr, m_mid);
  }

 private:
  message_id m_mid;
  Self* m_self;
};

/******************************************************************************
 *                              blocking + typed                              *
 ******************************************************************************/
template <class Self, class OutputPair>
class response_handle<Self, OutputPair, blocking_response_handle_tag> {
 public:
  response_handle() = delete;
  response_handle(const response_handle&) = default;
  response_handle& operator=(const response_handle&) = default;

  response_handle(message_id mid, Self* self) : m_mid(mid), m_self(self) {
    // nop
  }

  static constexpr bool is_either_or_handle =
    !std::is_same<
      none_t,
      typename OutputPair::second
    >::value;

  template <class... Fs>
  void await(Fs... fs) {
    static_assert(sizeof...(Fs) > 0,
                  "at least one argument is required");
    static_assert((is_either_or_handle && sizeof...(Fs) == 2)
                  || sizeof...(Fs) == 1,
                  "wrong number of functors");
    static_assert(detail::conjunction<detail::is_callable<Fs>::value...>::value,
                  "all arguments must be callable");
    static_assert(detail::conjunction<
                    !std::is_base_of<match_case, Fs>::value...
                  >::value,
                  "match cases are not allowed in this context");
    detail::type_checker<OutputPair, Fs...>::check();
    behavior tmp{std::move(fs)...};
    m_self->dequeue(tmp, m_mid);
  }

 private:
  message_id m_mid;
  Self* m_self;
};

} // namespace caf

#endif // CAF_RESPONSE_HANDLE_HPP