ORIGINAL
Loading...
Searching...
No Matches
Friends | List of all members
original::genPipe< Callback > Class Template Reference

Pipe adapter for generator operations to enable fluent chaining. More...

#include <generators.h>

Collaboration diagram for original::genPipe< Callback >:
Collaboration graph

Friends

template<typename TYPE , typename F >
auto operator| (coroutine::generator< TYPE > gen, genPipe< F > p)
 Pipe operator for generator operations.
 
template<typename T , typename U >
auto join (coroutine::generator< T > gen2)
 
template<typename T , typename U >
auto flatten ()
 Creates a flatten pipe operation.
 
template<typename F >
auto transforms (F &&f)
 Creates a transform pipe operation.
 
template<typename F >
auto filters (F &&f)
 Creates a filter pipe operation.
 
template<typename F >
auto extract (F &&f)
 Creates an extract pipe operation.
 
template<typename >
auto enumerate ()
 Creates an enumerate pipe operation.
 
template<typename >
auto take (u_integer n)
 Creates a take pipe operation.
 
template<typename >
auto skip (u_integer n)
 Creates a skip pipe operation.
 
template<typename F >
auto zipWith (coroutine::generator< F > gen2)
 
template<typename >
auto count ()
 Creates a count pipe operation.
 
template<typename F >
auto count (F &&f)
 Creates a conditional count pipe operation.
 
template<typename F >
auto all (F &&f)
 Creates an all-match pipe operation.
 
template<typename F >
auto none (F &&f)
 Creates a none-match pipe operation.
 
template<typename F >
auto any (F &&f)
 Creates an any-match pipe operation.
 
template<typename F >
auto position (F &&f)
 Creates a position-finding pipe operation.
 
template<typename F >
auto find (F &&f)
 Creates an element-finding pipe operation.
 

Detailed Description

template<typename Callback>
class original::genPipe< Callback >

Pipe adapter for generator operations to enable fluent chaining.

Template Parameters
CallbackThe operation to be applied in the pipe.

This class enables the use of the pipe operator (|) for generator operations, allowing for fluent and readable generator pipelines.

The genPipe wraps generator operations so they can be composed using the pipe operator, creating expressive data processing pipelines.

Example usage:

auto result = container.generator()
| transforms([](auto x) { return x * 2; })
| filters([](auto x) { return x > 10; })
| take(5)
| list<vector>();
Abstract base class for containers.
Definition container.h:26
friend auto take(u_integer n)
Creates a take pipe operation.
friend auto filters(F &&f)
Creates a filter pipe operation.
friend auto transforms(F &&f)
Creates a transform pipe operation.
Unique ownership smart pointer with move semantics.
Definition ownerPtr.h:37
See also
transforms(), filters(), take(), skip(), etc. for available pipe operations.

Friends And Related Symbol Documentation

◆ all

template<typename Callback >
template<typename F >
auto all ( F &&  f)
friend

Creates an all-match pipe operation.

Template Parameters
FThe predicate function type.
Parameters
fThe validation predicate.
Returns
A genPipe that checks if all elements satisfy the predicate.

Factory function for creating all-match operations.

◆ any

template<typename Callback >
template<typename F >
auto any ( F &&  f)
friend

Creates an any-match pipe operation.

Template Parameters
FThe predicate function type.
Parameters
fThe existence predicate.
Returns
A genPipe that checks if any element satisfies the predicate.

Factory function for creating any-match operations.

◆ count [1/2]

template<typename Callback >
template<typename >
auto count ( )
friend

Creates a count pipe operation.

Returns
A genPipe that counts elements.

Factory function for creating count operations that can be used with the pipe operator.

◆ count [2/2]

template<typename Callback >
template<typename F >
auto count ( F &&  f)
friend

Creates a conditional count pipe operation.

Template Parameters
FThe predicate function type.
Parameters
fThe counting predicate.
Returns
A genPipe that counts elements satisfying the predicate.

Factory function for creating conditional count operations.

◆ enumerate

template<typename Callback >
template<typename >
auto enumerate ( )
friend

Creates an enumerate pipe operation.

Returns
A genPipe that adds indices to elements.

Factory function for creating enumerate operations that can be used with the pipe operator.

◆ extract

template<typename Callback >
template<typename F >
auto extract ( F &&  f)
friend

Creates an extract pipe operation.

Template Parameters
FThe predicate function type.
Parameters
fThe exclusion predicate.
Returns
A genPipe that applies the extraction.

Factory function for creating extract operations that can be used with the pipe operator.

◆ filters

template<typename Callback >
template<typename F >
auto filters ( F &&  f)
friend

Creates a filter pipe operation.

Template Parameters
FThe predicate function type.
Parameters
fThe filter predicate.
Returns
A genPipe that applies the filter.

Factory function for creating filter operations that can be used with the pipe operator.

◆ find

template<typename Callback >
template<typename F >
auto find ( F &&  f)
friend

Creates an element-finding pipe operation.

Template Parameters
FThe predicate function type.
Parameters
fThe search predicate.
Returns
A genPipe that finds the first matching element.

Factory function for creating element-finding operations.

◆ flatten

template<typename Callback >
template<typename T , typename U >
auto flatten ( )
friend

Creates a flatten pipe operation.

Template Parameters
TThe first element type in couples.
UThe second element type in couples.
Returns
A genPipe that flattens couples.

Factory function for creating flatten operations that can be used with the pipe operator.

◆ none

template<typename Callback >
template<typename F >
auto none ( F &&  f)
friend

Creates a none-match pipe operation.

Template Parameters
FThe predicate function type.
Parameters
fThe exclusion predicate.
Returns
A genPipe that checks if no elements satisfy the predicate.

Factory function for creating none-match operations.

◆ operator|

template<typename Callback >
template<typename TYPE , typename F >
auto operator| ( coroutine::generator< TYPE gen,
genPipe< F p 
)
friend

Pipe operator for generator operations.

Template Parameters
TYPEThe generator element type.
FThe pipe operation type.
Parameters
genThe source generator.
pThe pipe operation to apply.
Returns
The result of applying the pipe operation to the generator.

Enables fluent chaining of generator operations using the | operator.

Example:

◆ position

template<typename Callback >
template<typename F >
auto position ( F &&  f)
friend

Creates a position-finding pipe operation.

Template Parameters
FThe predicate function type.
Parameters
fThe search predicate.
Returns
A genPipe that finds the position of the first matching element.

Factory function for creating position-finding operations.

◆ skip

template<typename Callback >
template<typename >
auto skip ( u_integer  n)
friend

Creates a skip pipe operation.

Parameters
nNumber of elements to skip.
Returns
A genPipe that skips the first n elements.

Factory function for creating skip operations that can be used with the pipe operator.

◆ take

template<typename Callback >
template<typename >
auto take ( u_integer  n)
friend

Creates a take pipe operation.

Parameters
nNumber of elements to take.
Returns
A genPipe that takes the first n elements.

Factory function for creating take operations that can be used with the pipe operator.

◆ transforms

template<typename Callback >
template<typename F >
auto transforms ( F &&  f)
friend

Creates a transform pipe operation.

Template Parameters
FThe transformation function type.
Parameters
fThe transformation function.
Returns
A genPipe that applies the transformation.

Factory function for creating transform operations that can be used with the pipe operator.

Example:

auto double_transform = transforms([](int x) { return x * 2; });
auto result = gen | double_transform;

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