proxygen
folly::gen::GenImpl< Value, Self > Class Template Reference

#include <Core-inl.h>

Inheritance diagram for folly::gen::GenImpl< Value, Self >:
folly::gen::FBounded< Self >

Public Types

typedef Value ValueType
 
typedef std::decay< Value >::type StorageType
 

Public Member Functions

template<class Handler >
bool apply (Handler &&handler) const
 
template<class Body >
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 = false
 

Protected Member Functions

 GenImpl ()=default
 
 GenImpl (GenImpl &&)=default
 
 GenImpl (const GenImpl &)=default
 
GenImploperator= (GenImpl &&)=default
 
GenImploperator= (const GenImpl &)=default
 

Detailed Description

template<class Value, class Self>
class folly::gen::GenImpl< Value, Self >

GenImpl - Core abstraction of a generator, an object which produces values by passing them to a given handler lambda. All generator implementations must implement apply(). foreach() may also be implemented to special case the condition where the entire sequence is consumed.

Definition at line 146 of file Core-inl.h.

Member Typedef Documentation

template<class Value, class Self>
typedef std::decay<Value>::type folly::gen::GenImpl< Value, Self >::StorageType

Definition at line 157 of file Core-inl.h.

template<class Value, class Self>
typedef Value folly::gen::GenImpl< Value, Self >::ValueType

Definition at line 156 of file Core-inl.h.

Constructor & Destructor Documentation

template<class Value, class Self>
folly::gen::GenImpl< Value, Self >::GenImpl ( )
protecteddefault
template<class Value, class Self>
folly::gen::GenImpl< Value, Self >::GenImpl ( GenImpl< Value, Self > &&  )
protecteddefault
template<class Value, class Self>
folly::gen::GenImpl< Value, Self >::GenImpl ( const GenImpl< Value, Self > &  )
protecteddefault

Member Function Documentation

template<class Value, class Self>
template<class Handler >
bool folly::gen::GenImpl< Value, Self >::apply ( Handler &&  handler) const

apply() - Send all values produced by this generator to given handler until the handler returns false. Returns false if and only if the handler passed in returns false. Note: It should return true even if it completes (without the handler returning false), as 'Chain' uses the return value of apply to determine if it should process the second object in its chain.

template<class Value, class Self>
template<class Body >
void folly::gen::GenImpl< Value, Self >::foreach ( Body &&  body) const
inline

foreach() - Send all values produced by this generator to given lambda.

Definition at line 173 of file Core-inl.h.

Referenced by folly::gen::detail::FileWriter::compose().

173  {
174  this->self().apply([&](Value value) -> bool {
175  static_assert(!infinite, "Cannot call foreach on infinite GenImpl");
176  body(std::forward<Value>(value));
177  return true;
178  });
179  }
bool Value(const T &value, M matcher)
static constexpr bool infinite
Definition: Core-inl.h:191
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)
bool apply(Handler &&handler) const
template<class Value, class Self>
GenImpl& folly::gen::GenImpl< Value, Self >::operator= ( GenImpl< Value, Self > &&  )
protecteddefault
template<class Value, class Self>
GenImpl& folly::gen::GenImpl< Value, Self >::operator= ( const GenImpl< Value, Self > &  )
protecteddefault

Member Data Documentation

template<class Value, class Self>
constexpr bool folly::gen::GenImpl< Value, Self >::infinite = false
static

Definition at line 191 of file Core-inl.h.


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