#include <stateful.h>
|
| using | Notifier = std::function< void(size_t idx)> |
| |
RegisterArray corresponds to the register standard P4 v1.02 object. A RegisterArray reference can be used as a P4 primitive parameter. For example:
class register_write
void operator ()(
RegisterArray &dst,
const Data &idx,
const Data &src) {
dst[idx.get_uint()].set(src);
}
};
◆ Notifier
Used to notify listeners that a write occurred in the array at idx. You can register your own notifier function by calling register_notifier().
◆ at() [1/2]
| Register & bm::RegisterArray::at |
( |
size_t |
idx | ) |
|
|
inline |
Access the register at position idx, throws a std::out_of_range exception if idx is invalid
◆ at() [2/2]
| const Register & bm::RegisterArray::at |
( |
size_t |
idx | ) |
const |
|
inline |
Access the register at position idx, throws a std::out_of_range exception if idx is invalid
◆ begin() [1/2]
| iterator bm::RegisterArray::begin |
( |
| ) |
|
|
inline |
◆ begin() [2/2]
| const_iterator bm::RegisterArray::begin |
( |
| ) |
const |
|
inline |
◆ end() [1/2]
| iterator bm::RegisterArray::end |
( |
| ) |
|
|
inline |
◆ end() [2/2]
| const_iterator bm::RegisterArray::end |
( |
| ) |
const |
|
inline |
◆ operator[]() [1/2]
| Register & bm::RegisterArray::operator[] |
( |
size_t |
idx | ) |
|
|
inline |
Access the register at position idx, asserts if bad idx.
◆ operator[]() [2/2]
| const Register & bm::RegisterArray::operator[] |
( |
size_t |
idx | ) |
const |
|
inline |
Access the register at position idx, asserts if bad idx.
◆ register_notifier()
| 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.
◆ size()
| size_t bm::RegisterArray::size |
( |
| ) |
const |
|
inline |
Return the size of the RegisterArray (i.e. number of registers it includes)
◆ unique_lock()
| UniqueLock bm::RegisterArray::unique_lock |
( |
| ) |
const |
|
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.
The documentation for this class was generated from the following file: