proxygen
folly::gen::detail::GroupBy< Selector >::Generator< Value, Source, ValueDecayed, Key, KeyDecayed > Class Template Reference

#include <Base-inl.h>

Inheritance diagram for folly::gen::detail::GroupBy< Selector >::Generator< Value, Source, ValueDecayed, Key, KeyDecayed >:
folly::gen::GenImpl< Group< KeyDecayed, ValueDecayed > &&, Generator< Value, Source, ValueDecayed, Key, KeyDecayed > > folly::gen::FBounded< Self >

Public Types

typedef Group< KeyDecayed, ValueDecayed > GroupType
 
- Public Types inherited from folly::gen::GenImpl< Group< KeyDecayed, ValueDecayed > &&, Generator< Value, Source, ValueDecayed, Key, KeyDecayed > >
typedef Group< KeyDecayed, ValueDecayed > && ValueType
 
typedef std::decay< Group< KeyDecayed, ValueDecayed > && >::type StorageType
 

Public Member Functions

 Generator (Source source, Selector selector)
 
template<class Handler >
bool apply (Handler &&handler) const
 
- Public Member Functions inherited from folly::gen::GenImpl< Group< KeyDecayed, ValueDecayed > &&, Generator< Value, Source, ValueDecayed, Key, KeyDecayed > >
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 = false
 
- Static Public Attributes inherited from folly::gen::GenImpl< Group< KeyDecayed, ValueDecayed > &&, Generator< Value, Source, ValueDecayed, Key, KeyDecayed > >
static constexpr bool infinite
 

Private Attributes

Source source_
 
Selector selector_
 

Additional Inherited Members

- Protected Member Functions inherited from folly::gen::GenImpl< Group< KeyDecayed, ValueDecayed > &&, Generator< Value, Source, ValueDecayed, Key, KeyDecayed > >
 GenImpl ()=default
 
 GenImpl (GenImpl &&)=default
 
 GenImpl (const GenImpl &)=default
 
GenImploperator= (GenImpl &&)=default
 
GenImploperator= (const GenImpl &)=default
 

Detailed Description

template<class Selector>
template<class Value, class Source, class ValueDecayed = typename std::decay<Value>::type, class Key = invoke_result_t<Selector, Value>, class KeyDecayed = typename std::decay<Key>::type>
class folly::gen::detail::GroupBy< Selector >::Generator< Value, Source, ValueDecayed, Key, KeyDecayed >

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

Member Typedef Documentation

template<class Selector >
template<class Value , class Source , class ValueDecayed = typename std::decay<Value>::type, class Key = invoke_result_t<Selector, Value>, class KeyDecayed = typename std::decay<Key>::type>
typedef Group<KeyDecayed, ValueDecayed> folly::gen::detail::GroupBy< Selector >::Generator< Value, Source, ValueDecayed, Key, KeyDecayed >::GroupType

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

Constructor & Destructor Documentation

template<class Selector >
template<class Value , class Source , class ValueDecayed = typename std::decay<Value>::type, class Key = invoke_result_t<Selector, Value>, class KeyDecayed = typename std::decay<Key>::type>
folly::gen::detail::GroupBy< Selector >::Generator< Value, Source, ValueDecayed, Key, KeyDecayed >::Generator ( Source  source,
Selector  selector 
)
inline

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

1169  : source_(std::move(source)), selector_(std::move(selector)) {}
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567

Member Function Documentation

template<class Selector >
template<class Value , class Source , class ValueDecayed = typename std::decay<Value>::type, class Key = invoke_result_t<Selector, Value>, class KeyDecayed = typename std::decay<Key>::type>
template<class Handler >
bool folly::gen::detail::GroupBy< Selector >::Generator< Value, Source, ValueDecayed, Key, KeyDecayed >::apply ( Handler &&  handler) const
inline

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

References group, handler(), folly::gen::move, value, and testing::Value().

1174  {
1175  std::unordered_map<KeyDecayed, typename GroupType::VectorType> groups;
1176  source_ | [&](Value value) {
1177  const Value& cv = value;
1178  auto& group = groups[selector_(cv)];
1179  group.push_back(std::forward<Value>(value));
1180  };
1181  for (auto& kg : groups) {
1182  GroupType group(kg.first, std::move(kg.second));
1183  if (!handler(std::move(group))) {
1184  return false;
1185  }
1186  kg.second.clear();
1187  }
1188  return true;
1189  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
void handler(int, siginfo_t *, void *)
bool Value(const T &value, M matcher)
Optional< NamedGroup > group
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)
Group< KeyDecayed, ValueDecayed > GroupType
Definition: Base-inl.h:1171

Member Data Documentation

template<class Selector >
template<class Value , class Source , class ValueDecayed = typename std::decay<Value>::type, class Key = invoke_result_t<Selector, Value>, class KeyDecayed = typename std::decay<Key>::type>
constexpr bool folly::gen::detail::GroupBy< Selector >::Generator< Value, Source, ValueDecayed, Key, KeyDecayed >::infinite = false
static

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

template<class Selector >
template<class Value , class Source , class ValueDecayed = typename std::decay<Value>::type, class Key = invoke_result_t<Selector, Value>, class KeyDecayed = typename std::decay<Key>::type>
Selector folly::gen::detail::GroupBy< Selector >::Generator< Value, Source, ValueDecayed, Key, KeyDecayed >::selector_
private

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

template<class Selector >
template<class Value , class Source , class ValueDecayed = typename std::decay<Value>::type, class Key = invoke_result_t<Selector, Value>, class KeyDecayed = typename std::decay<Key>::type>
Source folly::gen::detail::GroupBy< Selector >::Generator< Value, Source, ValueDecayed, Key, KeyDecayed >::source_
private

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


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