proxygen
folly::gen::detail::Cycle< forever >::Generator< Value, Source > Class Template Reference

#include <Base-inl.h>

Inheritance diagram for folly::gen::detail::Cycle< forever >::Generator< Value, Source >:
folly::gen::GenImpl< Value, Generator< Value, Source > > folly::gen::FBounded< Self >

Public Member Functions

 Generator (Source source, off_t limit)
 
template<class Handler >
bool apply (Handler &&handler) const
 
- Public Member Functions inherited from folly::gen::GenImpl< Value, Generator< Value, Source > >
bool apply (Handler &&handler) const
 
void foreach (Body &&body) const
 
- Public Member Functions inherited from folly::gen::FBounded< Self >
const Self & self () const
 
Self & self ()
 

Static Public Attributes

static constexpr bool infinite = forever || Source::infinite
 
- Static Public Attributes inherited from folly::gen::GenImpl< Value, Generator< Value, Source > >
static constexpr bool infinite
 

Private Attributes

Source source_
 
off_t limit_
 

Additional Inherited Members

- Public Types inherited from folly::gen::GenImpl< Value, Generator< Value, Source > >
typedef Value ValueType
 
typedef std::decay< Value >::type StorageType
 
- Protected Member Functions inherited from folly::gen::GenImpl< Value, Generator< Value, Source > >
 GenImpl ()=default
 
 GenImpl (GenImpl &&)=default
 
 GenImpl (const GenImpl &)=default
 
GenImploperator= (GenImpl &&)=default
 
GenImploperator= (const GenImpl &)=default
 

Detailed Description

template<bool forever>
template<class Value, class Source>
class folly::gen::detail::Cycle< forever >::Generator< Value, Source >

Definition at line 1932 of file Base-inl.h.

Constructor & Destructor Documentation

template<bool forever>
template<class Value , class Source >
folly::gen::detail::Cycle< forever >::Generator< Value, Source >::Generator ( Source  source,
off_t  limit 
)
inlineexplicit

Definition at line 1937 of file Base-inl.h.

1938  : source_(std::move(source)), limit_(limit) {}
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567

Member Function Documentation

template<bool forever>
template<class Value , class Source >
template<class Handler >
bool folly::gen::detail::Cycle< forever >::Generator< Value, Source >::apply ( Handler &&  handler) const
inline

Definition at line 1941 of file Base-inl.h.

References folly::gen::count, forever, handler(), value, and testing::Value().

1941  {
1942  bool cont;
1943  auto handler2 = [&](Value value) {
1944  cont = handler(std::forward<Value>(value));
1945  return cont;
1946  };
1947  // Becomes an infinte loop if forever == true
1948  for (off_t count = 0; (forever || count != limit_); ++count) {
1949  cont = false;
1950  source_.apply(handler2);
1951  if (!cont) {
1952  return false;
1953  }
1954  }
1955  return true;
1956  }
constexpr detail::Count count
Definition: Base-inl.h:2551
static auto const forever
void handler(int, siginfo_t *, void *)
bool Value(const T &value, M matcher)
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)

Member Data Documentation

template<bool forever>
template<class Value , class Source >
constexpr bool folly::gen::detail::Cycle< forever >::Generator< Value, Source >::infinite = forever || Source::infinite
static

Definition at line 1964 of file Base-inl.h.

template<bool forever>
template<class Value , class Source >
off_t folly::gen::detail::Cycle< forever >::Generator< Value, Source >::limit_
private

Definition at line 1934 of file Base-inl.h.

template<bool forever>
template<class Value , class Source >
Source folly::gen::detail::Cycle< forever >::Generator< Value, Source >::source_
private

Definition at line 1933 of file Base-inl.h.


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