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

#include <Base-inl.h>

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

Public Member Functions

 Generator (Source source, size_t stride)
 
template<class Handler >
bool apply (Handler &&handler) const
 
template<class Body >
void foreach (Body &&body) 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 = Source::infinite
 
- Static Public Attributes inherited from folly::gen::GenImpl< Value, Generator< Value, Source > >
static constexpr bool infinite
 

Private Attributes

Source source_
 
size_t stride_
 

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<class Value, class Source>
class folly::gen::detail::Stride::Generator< Value, Source >

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

Constructor & Destructor Documentation

template<class Value , class Source >
folly::gen::detail::Stride::Generator< Value, Source >::Generator ( Source  source,
size_t  stride 
)
inlineexplicit

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

824  : source_(std::move(source)), stride_(stride) {}
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
detail::Stride stride(size_t s)
Definition: Base-inl.h:2589

Member Function Documentation

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

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

References handler(), value, and testing::Value().

827  {
828  size_t distance = stride_;
829  return source_.apply([&](Value value) -> bool {
830  if (++distance >= stride_) {
831  if (!handler(std::forward<Value>(value))) {
832  return false;
833  }
834  distance = 0;
835  }
836  return true;
837  });
838  }
void handler(int, siginfo_t *, void *)
bool Value(const T &value, M matcher)
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)
template<class Value , class Source >
template<class Body >
void folly::gen::detail::Stride::Generator< Value, Source >::foreach ( Body &&  body) const
inline

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

References value, and testing::Value().

841  {
842  size_t distance = stride_;
843  source_.foreach([&](Value value) {
844  if (++distance >= stride_) {
845  body(std::forward<Value>(value));
846  distance = 0;
847  }
848  });
849  }
bool Value(const T &value, M matcher)
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)

Member Data Documentation

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

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

template<class Value , class Source >
Source folly::gen::detail::Stride::Generator< Value, Source >::source_
private

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

template<class Value , class Source >
size_t folly::gen::detail::Stride::Generator< Value, Source >::stride_
private

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


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