P4C
The P4 Compiler
Loading...
Searching...
No Matches
P4::UniqueAttachedId Class Reference

#include <unique_id.h>

Public Types

enum  pre_placed_type_t { NO_PP , TIND_PP , ADATA_PP }
 
enum  type_t {
  INVALID , TERNARY_INDIRECT , IDLETIME , COUNTER ,
  METER , SELECTOR , STATEFUL_ALU , ACTION_DATA
}
 

Public Member Functions

 UniqueAttachedId (cstring n, bool direct, type_t t)
 
 UniqueAttachedId (pre_placed_type_t ppt)
 
std::string build_name () const
 
bool has_meter_type () const
 
bool name_valid () const
 
 operator bool () const
 
bool operator!= (const UniqueAttachedId &uai) const
 
bool operator< (const UniqueAttachedId &uai) const
 
bool operator== (const UniqueAttachedId &uai) const
 
void toJSON (P4::JSONGenerator &json) const
 

Static Public Member Functions

static UniqueAttachedId fromJSON (P4::JSONLoader &json)
 

Public Attributes

cstring name
 
enum P4::UniqueAttachedId::type_t type = INVALID
 

Detailed Description

The purpose of this class is to provide a unique identification of an BackendAttached table per IR::MAU::Table object. The only way to guarantee to uniqueness is both by name and by an associated type. For example, a P4 object could in theory have multiple counters, but these counters would have to have separate names. Also, let's say a selector and and action profile have the same name (which they do in P4-16). The types of these BackendAttached tables would be different.

This id can be generated by any IR::MAU::AttachedMemory object. Furthermore, it is used to associate per flow enable bits and meter types.