bmv2
Designing your own switch target with bmv2
|
Public Member Functions | |
virtual size_t | pop_front ()=0 |
virtual size_t | pop_front (size_t num)=0 |
virtual size_t | push_front ()=0 |
virtual size_t | push_front (size_t num)=0 |
virtual size_t | get_depth () const =0 |
Returns the maximum capacity of the stack. More... | |
virtual size_t | get_count () const =0 |
Returns the current occupancy of the stack. More... | |
virtual bool | is_full () const =0 |
Returns true if the header stack is full. More... | |
Interface to a P4 stack (of headers or header unions). A StackIface reference can be used in an action primitive. For example:
|
pure virtual |
Returns the current occupancy of the stack.
Implemented in bm::Stack< T, ShiftImpl >.
|
pure virtual |
Returns the maximum capacity of the stack.
Implemented in bm::Stack< T, ShiftImpl >.
|
pure virtual |
Returns true if the header stack is full.
Implemented in bm::Stack< T, ShiftImpl >.
|
pure virtual |
Removes the first element of the stack. Returns the number of elements removed. The second element of the stack becomes the first element, and so on...
Implemented in bm::Stack< T, ShiftImpl >, bm::Stack< T, StackP4_16< T > >, and bm::Stack< T, StackLegacy< T > >.
|
pure virtual |
Removes the first num
element of the stack. Returns the number of elements removed. Calling this function is more efficient than calling pop_front() multiple times.
Implemented in bm::Stack< T, ShiftImpl >, bm::Stack< T, StackP4_16< T > >, and bm::Stack< T, StackLegacy< T > >.
|
pure virtual |
Pushes an element to the front of the stack. If the stack is already full, the last element of the stack will be discarded. This function returns the number of elements pushed, which is guaranteed to be always 1. The first element of the stack is marked valid (note that it was already valid if the stack was not empty).
Implemented in bm::Stack< T, ShiftImpl >, bm::Stack< T, StackP4_16< T > >, and bm::Stack< T, StackLegacy< T > >.
|
pure virtual |
Pushes num
elements to the front of the stack. If the stack becomes full, the extra elements at the bottom of the stack will be discarded. This function returns the number of elements pushed, which is guaranteed to be min(get_depth(), num
)`. All inserted elements are guaranteed to be marked valid. Calling this function is more efficient that calling push_front() multiple times.
Implemented in bm::Stack< T, ShiftImpl >, bm::Stack< T, StackP4_16< T > >, and bm::Stack< T, StackLegacy< T > >.