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

Public Member Functions

color_t execute_meter (const Packet &pkt, size_t idx, color_t pre_color=0)
 
Meterget_meter (size_t idx)
 Access the meter at position idx, asserts if bad idx. More...
 
const Meterget_meter (size_t idx) const
 Access the meter at position idx, asserts if bad idx. More...
 
Meterat (size_t idx)
 
const Meterat (size_t idx) const
 
Meteroperator[] (size_t idx)
 Access the meter at position idx, asserts if bad idx. More...
 
const Meteroperator[] (size_t idx) const
 Access the meter 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
 Returns the size of the MeterArray (i.e. number of meters 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

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

: public ActionPrimitive<MeterArray &, const Data &, Field &> {
void operator ()(MeterArray &meter_array, const Data &idx, Field &dst) {
dst.set(meter_array.execute_meter(get_packet(), idx.get_uint()));
}
};

Member Function Documentation

◆ at() [1/2]

Meter& bm::MeterArray::at ( size_t  idx)
inline

Access the meter at position idx, with bound-checking. If pos not within the range of the array, an exception of type std::out_of_range is thrown.

◆ at() [2/2]

const Meter& bm::MeterArray::at ( size_t  idx) const
inline

Access the meter at position idx, with bound-checking. If pos not within the range of the array, an exception of type std::out_of_range is thrown.

◆ begin() [1/2]

iterator bm::MeterArray::begin ( )
inline

NC.

◆ begin() [2/2]

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

NC.

◆ end() [1/2]

iterator bm::MeterArray::end ( )
inline

NC.

◆ end() [2/2]

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

NC.

◆ execute_meter()

color_t bm::MeterArray::execute_meter ( const Packet pkt,
size_t  idx,
color_t  pre_color = 0 
)

Executes the meter at index idx on the given packet and returns the correct integral color value. See Meter::execute() for more information.

◆ get_meter() [1/2]

Meter& bm::MeterArray::get_meter ( size_t  idx)
inline

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

◆ get_meter() [2/2]

const Meter& bm::MeterArray::get_meter ( size_t  idx) const
inline

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

◆ operator[]() [1/2]

Meter& bm::MeterArray::operator[] ( size_t  idx)
inline

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

◆ operator[]() [2/2]

const Meter& bm::MeterArray::operator[] ( size_t  idx) const
inline

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

◆ size()

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

Returns the size of the MeterArray (i.e. number of meters it includes)


The documentation for this class was generated from the following file:
bm::MeterArray::execute_meter
color_t execute_meter(const Packet &pkt, size_t idx, color_t pre_color=0)