bmv2
Designing your own switch target with bmv2
|
Public Member Functions | |
size_t | pop_front () override |
size_t | pop_front (size_t num) override |
size_t | push_front () override |
size_t | push_front (size_t num) override |
size_t | get_depth () const override |
Returns the maximum capacity of the stack. More... | |
size_t | get_count () const override |
Returns the current occupancy of the stack. More... | |
bool | is_full () const override |
Returns true if the header stack is full. More... | |
![]() | |
const std::string & | get_name () const |
Get the name of the P4 instance. More... | |
p4object_id_t | get_id () const |
Get the compiler-provided id. More... | |
NamedP4Object (const NamedP4Object &other)=delete | |
Deleted copy constructor. More... | |
NamedP4Object & | operator= (const NamedP4Object &other)=delete |
Deleted copy assignment operator. More... | |
NamedP4Object (NamedP4Object &&other)=default | |
Default move constructor. More... | |
NamedP4Object & | operator= (NamedP4Object &&other)=default |
Default assignment operator. More... | |
Stack is used to represent header and union stacks in P4. The Stack class itself does not store any union / header / field data itself, but stores references to the HeaderUnion / Header instances which constitute the stack, as well as the stack's internal state (e.g. number of valid headers in the stack).
|
overridevirtual |
Returns the current occupancy of the stack.
Implements bm::StackIface.
|
overridevirtual |
Returns the maximum capacity of the stack.
Implements bm::StackIface.
|
overridevirtual |
Returns true if the header stack is full.
Implements bm::StackIface.
|
overridevirtual |
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...
Implements bm::StackIface.
|
overridevirtual |
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.
Implements bm::StackIface.
|
overridevirtual |
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).
Implements bm::StackIface.
|
overridevirtual |
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.
Implements bm::StackIface.