P4C
The P4 Compiler
|
#include <p4RuntimeSymbolTable.h>
Public Member Functions | |
void | add (P4RuntimeSymbolType type, const IR::IDeclaration *declaration) override |
Add a @type symbol, extracting the name and id from @declaration. | |
and possibly an explicit P4 '@id'. | |
Add a @type symbol with | |
void | add (P4RuntimeSymbolType type, cstring name, std::optional< p4rt_id_t > id=std::nullopt) override |
p4rt_id_t | getId (P4RuntimeSymbolType type, const IR::IDeclaration *declaration) const override |
Public Member Functions inherited from P4::ControlPlaneAPI::P4RuntimeSymbolTableIface |
Static Public Member Functions | |
template<typename Func > | |
static P4RuntimeSymbolTable * | create (Func function) |
static P4RuntimeSymbolTable * | generateSymbols (const IR::P4Program *program, const IR::ToplevelBlock *evaluatedProgram, ReferenceMap *refMap, TypeMap *typeMap, P4RuntimeArchHandlerIface *archHandler) |
. | |
| |
p4rt_id_t | getId (P4RuntimeSymbolType type, cstring name) const override |
cstring | getAlias (cstring name) const override |
A table which tracks the symbols which are visible to P4Runtime and their ids.
|
overridevirtual |
Add a @type symbol, extracting the name and id from @declaration.
Implements P4::ControlPlaneAPI::P4RuntimeSymbolTableIface.
|
overridevirtual |
Implements P4::ControlPlaneAPI::P4RuntimeSymbolTableIface.
|
inlinestatic |
This approach of constructing the symbol table is intended to encourage correct usage. The symbol table should be used in phases: first, we collect symbols and populate the table. Then, ids are assigned. Finally, the P4Runtime serialization code can read the ids from the table as needed. To ensure that no code accidentally adds new symbols after ids are assigned, create() enforces that only code that runs before id assignment has access to a non-const reference to the symbol table.
Implements P4::ControlPlaneAPI::P4RuntimeSymbolTableIface.
|
overridevirtual |
Implements P4::ControlPlaneAPI::P4RuntimeSymbolTableIface.
|
overridevirtual |
Implements P4::ControlPlaneAPI::P4RuntimeSymbolTableIface.