proxygen
folly::gen::detail::Batch Class Reference

#include <Base-inl.h>

Inheritance diagram for folly::gen::detail::Batch:
folly::gen::Operator< Batch > folly::gen::FBounded< Self >

Classes

class  Generator
 

Public Member Functions

 Batch (size_t batchSize)
 
template<class Source , class Value , class Gen = Generator<Value, Source>>
Gen compose (GenImpl< Value, Source > &&source) const
 
template<class Source , class Value , class Gen = Generator<Value, Source>>
Gen compose (const GenImpl< Value, Source > &source) const
 
- Public Member Functions inherited from folly::gen::Operator< Batch >
ResultGen compose (const GenImpl< Value, Source > &source) const
 
- Public Member Functions inherited from folly::gen::FBounded< Self >
const Self & self () const
 
Self & self ()
 

Private Attributes

size_t batchSize_
 

Additional Inherited Members

- Protected Member Functions inherited from folly::gen::Operator< Batch >
 Operator ()=default
 
 Operator (Operator &&) noexcept=default
 
 Operator (const Operator &)=default
 
Operatoroperator= (Operator &&) noexcept=default
 
Operatoroperator= (const Operator &)=default
 

Detailed Description

Batch - For producing fixed-size batches of each value from a source.

This type is usually used through the 'batch' helper function:

auto batchSums = seq(1, 10) | batch(3) | map([](const std::vector<int>& batch) { return from(batch) | sum; }) | as<vector>();

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

Constructor & Destructor Documentation

folly::gen::detail::Batch::Batch ( size_t  batchSize)
inlineexplicit

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

References type, and testing::Value().

1447  : batchSize_(batchSize) {
1448  if (batchSize_ == 0) {
1449  throw std::invalid_argument("Batch size must be non-zero!");
1450  }
1451  }

Member Function Documentation

template<class Source , class Value , class Gen = Generator<Value, Source>>
Gen folly::gen::detail::Batch::compose ( GenImpl< Value, Source > &&  source) const
inline

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

References folly::gen::move.

1495  {
1496  return Gen(std::move(source.self()), batchSize_);
1497  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
template<class Source , class Value , class Gen = Generator<Value, Source>>
Gen folly::gen::detail::Batch::compose ( const GenImpl< Value, Source > &  source) const
inline

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

References folly::gen::FBounded< Self >::self().

1500  {
1501  return Gen(source.self(), batchSize_);
1502  }

Member Data Documentation

size_t folly::gen::detail::Batch::batchSize_
private

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


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