P4C
The P4 Compiler
|
Transforms all elements from type T to type S. More...
#include <enumerator.h>
Public Member Functions | |
MapEnumerator (Enumerator< T > *input, Mapper map) | |
S | getCurrent () const |
Get current element in the collection. | |
bool | moveNext () |
void | reset () |
Move back to the beginning of the collection. | |
std::string | toString () const |
Public Member Functions inherited from P4::Util::Enumerator< S > | |
bool | any () |
True if the enumerator has at least one element. | |
Enumerator< S > * | as () |
Cast to an enumerator of S objects. | |
EnumeratorHandle< S > | begin () |
virtual Enumerator< S > * | concat (Enumerator< S > *other) |
Append all elements of other after all elements of this. | |
uint64_t | count () |
Enumerate all elements and return the count. | |
EnumeratorHandle< S > | end () |
Enumerator< std::invoke_result_t< Mapper, S > > * | map (Mapper map) |
Apply specified function to all elements of this enumerator. | |
S | next () |
Next element; throws if there are no elements. | |
S | nextOrDefault () |
Next element, or the default value if none exists. | |
S | single () |
The only next element; throws if the enumerator does not have exactly 1 element. | |
S | singleOrDefault () |
const char * | stateName () const |
std::vector< S > | toVector () |
Enumerator< S > * | where (Filter filter) |
Return an enumerator returning all elements that pass the filter. | |
Protected Attributes | |
S | current |
Enumerator< T > * | input |
Mapper | map |
Protected Attributes inherited from P4::Util::Enumerator< S > | |
EnumeratorState | state |
Additional Inherited Members | |
Public Types inherited from P4::Util::Enumerator< S > | |
using | value_type |
Static Public Member Functions inherited from P4::Util::Enumerator< S > | |
static Enumerator< S > * | concatAll (Enumerator< Enumerator< S > * > *inputs) |
Concatenate all these collections into a single one. | |
static Enumerator< typename Container::value_type > * | createEnumerator (const Container &data) |
static Enumerator< typename Iter::value_type > * | createEnumerator (Iter begin, Iter end) |
static Enumerator< typename Iter::value_type > * | createEnumerator (iterator_range< Iter > range) |
static Enumerator< S > * | emptyEnumerator () |
Static Protected Attributes inherited from P4::Util::Enumerator< S > | |
static std::vector< S > | emptyVector |
Transforms all elements from type T to type S.
|
inlinevirtual |
Get current element in the collection.
Implements P4::Util::Enumerator< S >.
|
inlinevirtual |
Move to next element in the collection; return false if the next element does not exist
Implements P4::Util::Enumerator< S >.
|
inlinevirtual |
Move back to the beginning of the collection.
Reimplemented from P4::Util::Enumerator< S >.