|
bmv2
Designing your own switch target with bmv2
|

Public Types | |
| using | Notifier = std::function< void(size_t idx)> |
Public Member Functions | |
| Register & | operator[] (size_t idx) |
Access the register at position idx, asserts if bad idx. More... | |
| const Register & | operator[] (size_t idx) const |
Access the register at position idx, asserts if bad idx. More... | |
| Register & | at (size_t idx) |
| const Register & | at (size_t idx) const |
| iterator | begin () |
| NC. More... | |
| const_iterator | begin () const |
| NC. More... | |
| iterator | end () |
| NC. More... | |
| const_iterator | end () const |
| NC. More... | |
| size_t | size () const |
| void | register_notifier (Notifier notifier) |
| UniqueLock | unique_lock () const |
Public Member Functions inherited from bm::NamedP4Object | |
| 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... | |
RegisterArray corresponds to the register standard P4 v1.02 object. A RegisterArray reference can be used as a P4 primitive parameter. For example:
| using bm::RegisterArray::Notifier = std::function<void(size_t idx)> |
Used to notify listeners that a write occurred in the array at idx. You can register your own notifier function by calling register_notifier().
|
inline |
Access the register at position idx, throws a std::out_of_range exception if idx is invalid
|
inline |
Access the register at position idx, throws a std::out_of_range exception if idx is invalid
|
inline |
NC.
|
inline |
NC.
|
inline |
NC.
|
inline |
NC.
|
inline |
Access the register at position idx, asserts if bad idx.
|
inline |
Access the register at position idx, asserts if bad idx.
| void bm::RegisterArray::register_notifier | ( | Notifier | notifier | ) |
Register your own notifier function. Every time a write operation is performed on the register array, your notifier will be called, with the index at which the write happened as an argument. This method is not thread-safe. Please request the lock using unique_lock() if needed.
|
inline |
Return the size of the RegisterArray (i.e. number of registers it includes)
|
inline |
Request exclusive access to this register array. This method needs to be called when the target needs to read or write a register. Note that it is never necessary to call this method in a primitive action, since when an action is executed, it is guaranteed exclusive access to all the register arrays it reads or writes.
1.8.17