bmv2
Designing your own switch target with bmv2
Public Member Functions | List of all members
bm::CounterArray Class Reference
Inheritance diagram for bm::CounterArray:
Inheritance graph
[legend]

Public Member Functions

Counterget_counter (size_t idx)
 Access the counter at position idx, asserts if bad idx. More...
 
const Counterget_counter (size_t idx) const
 Access the counter at position idx, asserts if bad idx. More...
 
Counteroperator[] (size_t idx)
 Access the counter at position idx, asserts if bad idx. More...
 
const Counteroperator[] (size_t idx) const
 Access the counter at position idx, asserts if bad idx. More...
 
iterator begin ()
 NC. More...
 
const_iterator begin () const
 NC. More...
 
iterator end ()
 NC. More...
 
const_iterator end () const
 NC. More...
 
size_t size () const
 Return the size of the CounterArray (i.e. number of counters it includes) More...
 
- 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...
 
NamedP4Objectoperator= (const NamedP4Object &other)=delete
 Deleted copy assignment operator. More...
 
 NamedP4Object (NamedP4Object &&other)=default
 Default move constructor. More...
 
NamedP4Objectoperator= (NamedP4Object &&other)=default
 Default assignment operator. More...
 

Detailed Description

CounterArray corresponds to the counter standard P4 v1.02 object. A CounterArray reference can be used as a P4 primitive parameter. For example:

class count : public ActionPrimitive<CounterArray &, const Data &> {
void operator ()(CounterArray &counter_array, const Data &idx) {
counter_array.get_counter(idx.get_uint()).increment_counter(
get_packet());
}
};

Member Function Documentation

◆ begin() [1/2]

iterator bm::CounterArray::begin ( )
inline

NC.

◆ begin() [2/2]

const_iterator bm::CounterArray::begin ( ) const
inline

NC.

◆ end() [1/2]

iterator bm::CounterArray::end ( )
inline

NC.

◆ end() [2/2]

const_iterator bm::CounterArray::end ( ) const
inline

NC.

◆ get_counter() [1/2]

Counter& bm::CounterArray::get_counter ( size_t  idx)
inline

Access the counter at position idx, asserts if bad idx.

◆ get_counter() [2/2]

const Counter& bm::CounterArray::get_counter ( size_t  idx) const
inline

Access the counter at position idx, asserts if bad idx.

◆ operator[]() [1/2]

Counter& bm::CounterArray::operator[] ( size_t  idx)
inline

Access the counter at position idx, asserts if bad idx.

◆ operator[]() [2/2]

const Counter& bm::CounterArray::operator[] ( size_t  idx) const
inline

Access the counter at position idx, asserts if bad idx.

◆ size()

size_t bm::CounterArray::size ( ) const
inline

Return the size of the CounterArray (i.e. number of counters it includes)


The documentation for this class was generated from the following file: