P4C
The P4 Compiler
Loading...
Searching...
No Matches
P4::ControlPlaneAPI::Helpers::Counterlike< Kind > Struct Template Reference

#include <p4RuntimeArchHandler.h>

Static Public Member Functions

static std::optional< Counterlike< Kind > > from (const IR::ExternBlock *instance, const ReferenceMap *refMap, P4::TypeMap *typeMap, ::p4::config::v1::P4TypeInfo *p4RtTypeInfo)
 
static std::optional< Counterlike< Kind > > fromDirect (const ExternInstance &instance, const IR::P4Table *table)
 

Public Attributes

const IR::IAnnotated * annotations
 If non-null, the instance's annotations.
 
const cstring index_type_name
 
const cstring name
 The name of the instance.
 
const int64_t size
 The size parameter to the instance.
 
const std::optional< cstringtable
 If not none, the instance is a direct resource associated with @table.
 
const cstring unit
 The units parameter to the instance; valid values vary depending on @Kind.
 

Detailed Description

template<typename Kind>
struct P4::ControlPlaneAPI::Helpers::Counterlike< Kind >

The information about a counter or meter instance which is necessary to serialize it. @Kind must be a class with a CounterlikeTraits<> specialization. This can be useful for different architectures as many define extern types for counter / meter. The architecture-specific code must specialize CounterlikeTraits<> appropriately.

Member Function Documentation

◆ from()

template<typename Kind >
static std::optional< Counterlike< Kind > > P4::ControlPlaneAPI::Helpers::Counterlike< Kind >::from ( const IR::ExternBlock * instance,
const ReferenceMap * refMap,
P4::TypeMap * typeMap,
::p4::config::v1::P4TypeInfo * p4RtTypeInfo )
inlinestatic
Returns
the information required to serialize an explicit @instance of @Kind, which is defined inside a control block.

◆ fromDirect()

template<typename Kind >
static std::optional< Counterlike< Kind > > P4::ControlPlaneAPI::Helpers::Counterlike< Kind >::fromDirect ( const ExternInstance & instance,
const IR::P4Table * table )
inlinestatic
Returns
the information required to serialize an @instance of @Kind which is either defined in or referenced by a property value of @table. (This implies that @instance is a direct resource of @table.)

Member Data Documentation

◆ index_type_name

template<typename Kind >
const cstring P4::ControlPlaneAPI::Helpers::Counterlike< Kind >::index_type_name

If the type of the index is a user-defined type, this is the name of the type. Otherwise it is nullptr.