bmv2
Designing your own switch target with bmv2
|
Public Member Functions | |
Header * | get_valid_header () const |
size_t | get_num_headers () const |
Returns the number of headers included in the union. More... | |
Header & | at (size_t idx) |
const Header & | at (size_t idx) const |
bool | is_valid () const |
Returns true if one of the headers in the union is valid. 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... | |
Used to represent P4 header union instances. It stores references to the Header instances included in the union and ensures that at most one of these instances is valid at any given time.
A HeaderUnion reference can be used in an action primitive. For example:
|
inline |
Access the Header at index idx
in the union. If the index is invalid, an std::out_of_range exception will be thrown.
|
inline |
Access the Header at index idx
in the union. If the index is invalid, an std::out_of_range exception will be thrown.
|
inline |
Returns the number of headers included in the union.
|
inline |
Returns a pointer to the valid Header instance in the union, or nullptr if no header is valid.
|
inline |
Returns true if one of the headers in the union is valid.