proxygen
ImmediateFlowManySender Class Reference
Inheritance diagram for ImmediateFlowManySender:
testing::Test

Protected Member Functions

auto make_producer ()
 
template<class F >
auto make_consumer (F f)
 
- Protected Member Functions inherited from testing::Test
 Test ()
 
virtual void SetUp ()
 
virtual void TearDown ()
 
 Test ()
 
virtual void SetUp ()
 
virtual void TearDown ()
 
 Test ()
 
virtual void SetUp ()
 
virtual void TearDown ()
 

Protected Attributes

int signals_ {0}
 

Additional Inherited Members

- Public Types inherited from testing::Test
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
- Public Member Functions inherited from testing::Test
virtual ~Test ()
 
virtual ~Test ()
 
virtual ~Test ()
 
- Static Public Member Functions inherited from testing::Test
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 

Detailed Description

Definition at line 49 of file FlowManyTest.cpp.

Member Function Documentation

template<class F >
auto ImmediateFlowManySender::make_consumer ( f)
inlineprotected

Definition at line 90 of file FlowManyTest.cpp.

References f, MAKE, folly::gen::move, folly::pushmi::__adl::noexcept(), folly::pushmi::on_done(), folly::pushmi::on_error(), folly::pushmi::on_starting(), and folly::pushmi::on_value().

90  {
91  return mi::MAKE(flow_receiver)(
92  mi::on_value([&](int) { signals_ += 100; }),
93  mi::on_error([&](auto) noexcept { signals_ += 1000; }),
94  mi::on_done([&]() { signals_ += 1; }),
95  mi::on_starting([&, f](auto up) {
96  signals_ += 10;
97  f(std::move(up));
98  }));
99  }
auto f
auto on_value(Fns...fns) -> on_value_fn< Fns... >
Definition: boosters.h:262
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
auto on_error(Fns...fns) -> on_error_fn< Fns... >
Definition: boosters.h:273
auto on_starting(Fns...fns) -> on_starting_fn< Fns... >
Definition: boosters.h:296
requires E e noexcept(noexcept(s.error(std::move(e))))
#define MAKE(x)
auto on_done(Fn fn) -> on_done_fn< Fn >
Definition: boosters.h:285
auto ImmediateFlowManySender::make_producer ( )
inlineprotected

Definition at line 51 of file FlowManyTest.cpp.

References data, MAKE, folly::gen::move, folly::pushmi::__adl::noexcept(), folly::pushmi::set_done, folly::pushmi::set_starting, folly::pushmi::set_value, and stop().

51  {
52  return mi::MAKE(flow_many_sender)([&](auto out) {
53  using Out = decltype(out);
54  struct Data : mi::receiver<> {
55  explicit Data(Out out) : out(std::move(out)), stop(false) {}
56  Out out;
57  bool stop;
58  };
59 
60  auto up = mi::MAKE(receiver)(
61  Data{std::move(out)},
62  [&](auto& data, auto requested) {
63  signals_ += 1000000;
64  if (requested < 1) {
65  return;
66  }
67  // check boolean to select signal
68  if (!data.stop) {
69  ::mi::set_value(data.out, 42);
70  }
71  ::mi::set_done(data.out);
72  },
73  [&](auto& data, auto) noexcept {
74  signals_ += 100000;
75  data.stop = true;
76  ::mi::set_done(data.out);
77  },
78  [&](auto& data) {
79  signals_ += 10000;
80  data.stop = true;
81  ::mi::set_done(data.out);
82  });
83 
84  // pass reference for cancellation.
85  ::mi::set_starting(up.data().out, std::move(up));
86  });
87  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
STL namespace.
requires E e noexcept(noexcept(s.error(std::move(e))))
static void stop()
#define MAKE(x)
PUSHMI_INLINE_VAR constexpr __adl::set_starting_fn set_starting
PUSHMI_INLINE_VAR constexpr __adl::set_value_fn set_value
static constexpr uint64_t data[1]
Definition: Fingerprint.cpp:43
PUSHMI_INLINE_VAR constexpr __adl::set_done_fn set_done

Member Data Documentation

int ImmediateFlowManySender::signals_ {0}
protected

Definition at line 101 of file FlowManyTest.cpp.


The documentation for this class was generated from the following file: