|
bmv2
Designing your own switch target with bmv2
|
Public Member Functions | |
| ByteContainer (const size_t nbytes, const char c='\x00') | |
Constructs the container with nbytes copies of elements with value c. More... | |
| ByteContainer (const std::vector< char > &bytes) | |
Constructs the container by copying the bytes in vector bytes. More... | |
| ByteContainer (const char *bytes, size_t nbytes) | |
| Constructs the container by copying the bytes in this byte array. More... | |
| ByteContainer (const std::string &hexstring) | |
| size_type | size () const noexcept |
| Returns the number of bytes in the container. More... | |
| void | clear () |
| Clears the contents of the container. More... | |
| iterator | begin () |
| NC. More... | |
| const_iterator | begin () const |
| NC. More... | |
| iterator | end () |
| NC. More... | |
| const_iterator | end () const |
| NC. More... | |
| ByteContainer & | append (const ByteContainer &other) |
| ByteContainer & | append (const char *byte_array, size_t nbytes) |
| Appends a byte array to this container. More... | |
| ByteContainer & | append (const std::string &other) |
| Appends a binary string to this container. More... | |
| void | insert (iterator pos, const ByteContainer &other) |
Inserts another ByteContainer object into this container, before pos. More... | |
| void | push_back (char c) |
| Appends a character at the end of the container. More... | |
| reference | operator[] (size_type n) |
| const_reference | operator[] (size_type n) const |
| reference | back () |
| const_reference | back () const |
| reference | front () |
| const_reference | front () const |
| char * | data () noexcept |
| const char * | data () const noexcept |
| bool | operator== (const ByteContainer &other) const |
| Returns true is the contents of the containers are equal. More... | |
| bool | operator!= (const ByteContainer &other) const |
| Returns true is the contents of the containers are not equal. More... | |
| void | reserve (size_t n) |
| Increase the capacity of the container. More... | |
| void | resize (size_t n) |
Resizes the container to contain bytes. More... | |
| void | resize (size_t n, char c) |
| void | apply_mask (const ByteContainer &mask) |
| std::string | to_hex (size_t start, size_t s, bool upper_case=false) const |
| std::string | to_hex (bool upper_case=false) const |
| Returns the hexadecimal representation of the byte container as a string. More... | |
This class is used everytime a vector of bytes is needed in bmv2. It is most notably used by the Field class (to store the byte representation of a field) as well as to store match keys in tables.
|
inlineexplicit |
Constructs the container with nbytes copies of elements with value c.
|
inlineexplicit |
Constructs the container by copying the bytes in vector bytes.
|
inline |
Constructs the container by copying the bytes in this byte array.
|
inlineexplicit |
Constructs the container from a hexadecimal string. Parameter hexstring can optionally include the 0x prefix.
|
inline |
Appends another ByteContainer to this container. other has to be different from *this.
|
inline |
Appends a byte array to this container.
|
inline |
Appends a binary string to this container.
|
inline |
Perform a byte-by-byte masking of the container. Will assert if size() != mask.size().
|
inline |
Access the last byte of the container. Undefined if the container is empty.
|
inline |
Access the last byte of the container. Undefined if the container is empty.
|
inline |
NC.
|
inline |
NC.
|
inline |
Clears the contents of the container.
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
NC.
|
inline |
NC.
|
inline |
Access the first byte of the container. Undefined if the container is empty.
|
inline |
Access the first byte of the container. Undefined if the container is empty.
|
inline |
Inserts another ByteContainer object into this container, before pos.
|
inline |
Returns true is the contents of the containers are not equal.
|
inline |
Returns true is the contents of the containers are equal.
|
inline |
Access the character at position n. Will assert if n is greater or equal than the number of elements in the container.
|
inline |
Access the character at position n. Will assert if n is greater or equal than the number of elements in the container.
|
inline |
Appends a character at the end of the container.
|
inline |
Increase the capacity of the container.
|
inline |
Resizes the container to contain bytes.
|
inline |
Resizes the container to contain bytes, initializing the new bytes to c
|
inlinenoexcept |
Returns the number of bytes in the container.
|
inline |
Returns the hexadecimal representation of the byte container as a string.
| std::string bm::ByteContainer::to_hex | ( | size_t | start, |
| size_t | s, | ||
| bool | upper_case = false |
||
| ) | const |
Returns the hexadecimal representation of the bytes with a position in the range [start, start + s) as a string
1.8.17