P4C
The P4 Compiler
Loading...
Searching...
No Matches
P4::Util::ConcatEnumerator< T > Class Template Referencefinal

Concatenation. More...

#include <enumerator.h>

Inheritance diagram for P4::Util::ConcatEnumerator< T >:
[legend]

Public Member Functions

 ConcatEnumerator (Enumerator< Enumerator< T > * > *inputs)
 
 ConcatEnumerator (std::initializer_list< Enumerator< T > * > inputs)
 
 ConcatEnumerator (std::vector< Enumerator< T > * > &&inputs)
 
Enumerator< T > * concat (Enumerator< T > *other) override
 Append all elements of other after all elements of this.
 
getCurrent () const override
 Get current element in the collection.
 
bool moveNext () override
 
void reset () override
 Move back to the beginning of the collection.
 
std::string toString () const
 
- Public Member Functions inherited from P4::Util::Enumerator< T >
bool any ()
 True if the enumerator has at least one element.
 
template<typename S >
Enumerator< S > * as ()
 Cast to an enumerator of S objects.
 
EnumeratorHandle< T > begin ()
 
uint64_t count ()
 Enumerate all elements and return the count.
 
EnumeratorHandle< T > end ()
 
template<typename Mapper >
Enumerator< std::invoke_result_t< Mapper, T > > * map (Mapper map)
 Apply specified function to all elements of this enumerator.
 
next ()
 Next element; throws if there are no elements.
 
nextOrDefault ()
 Next element, or the default value if none exists.
 
single ()
 The only next element; throws if the enumerator does not have exactly 1 element.
 
singleOrDefault ()
 
const char * stateName () const
 
std::vector< T > toVector ()
 
template<typename Filter >
Enumerator< T > * where (Filter filter)
 Return an enumerator returning all elements that pass the filter.
 

Additional Inherited Members

- Public Types inherited from P4::Util::Enumerator< T >
using value_type = T
 
- Static Public Member Functions inherited from P4::Util::Enumerator< T >
static Enumerator< T > * concatAll (Enumerator< Enumerator< T > * > *inputs)
 Concatenate all these collections into a single one.
 
template<typename Container >
static Enumerator< typename Container::value_type > * createEnumerator (const Container &data)
 
template<typename Iter >
static Enumerator< typename Iter::value_type > * createEnumerator (Iter begin, Iter end)
 
template<typename Iter >
static Enumerator< typename Iter::value_type > * createEnumerator (iterator_range< Iter > range)
 
static Enumerator< T > * emptyEnumerator ()
 
- Protected Attributes inherited from P4::Util::Enumerator< T >
EnumeratorState state = EnumeratorState::NotStarted
 
- Static Protected Attributes inherited from P4::Util::Enumerator< T >
static std::vector< T > emptyVector
 

Detailed Description

template<typename T>
class P4::Util::ConcatEnumerator< T >

Concatenation.

Member Function Documentation

◆ concat()

template<typename T >
Enumerator< T > * P4::Util::ConcatEnumerator< T >::concat ( Enumerator< T > * other)
inlineoverridevirtual

Append all elements of other after all elements of this.

Reimplemented from P4::Util::Enumerator< T >.

◆ getCurrent()

template<typename T >
T P4::Util::ConcatEnumerator< T >::getCurrent ( ) const
inlineoverridevirtual

Get current element in the collection.

Implements P4::Util::Enumerator< T >.

◆ moveNext()

template<typename T >
bool P4::Util::ConcatEnumerator< T >::moveNext ( )
inlineoverridevirtual

Move to next element in the collection; return false if the next element does not exist

Implements P4::Util::Enumerator< T >.

◆ reset()

template<typename T >
void P4::Util::ConcatEnumerator< T >::reset ( )
inlineoverridevirtual

Move back to the beginning of the collection.

Reimplemented from P4::Util::Enumerator< T >.