bmv2
Designing your own switch target with bmv2
|
Public Member Functions | |
template<typename T > | |
bool | add_component (std::shared_ptr< T > ptr) |
template<typename T > | |
std::shared_ptr< T > | get_component () |
Pipeline * | get_pipeline (const std::string &name) |
Parser * | get_parser (const std::string &name) |
Deparser * | get_deparser (const std::string &name) |
FieldList * | get_field_list (const p4object_id_t field_list_id) |
ExternSafeAccess | get_extern_instance (const std::string &name) |
Private Member Functions | |
ConfigOptionMap | get_config_options () const |
ErrorCodeMap | get_error_codes () const |
Implements a switch within a switch.
See context.h description for more information.
|
inline |
Add a component to this Context. Each Context maintains a map T
-> shared_ptr<T>
, which maps a type (using typeid
) to a shared pointer to an object of the same type. The pointer can be retrieved at a later time by using get_component().
|
inline |
Retrieve the shared pointer to an object of type T
previously added to the Context using add_component().
|
private |
Return string-to-string map of the target-specific options included in the input config JSON for this context.
|
inline |
Get a raw, non-owning pointer to the Deparser object with P4 name name
. Return a nullptr if there is no deparser with this name.
|
private |
Return a copy of the error codes map (a bi-directional map between an error code's integral value and its name / description).
ExternSafeAccess bm::Context::get_extern_instance | ( | const std::string & | name | ) |
Obtain a pointer to an extern instance, wrapped inside an ExternSafeAccess object. The wrapper holds a shared mutex, to make sure that accessing the extern is safe (in the case where a P4 swap occurs).
|
inline |
Get a raw, non-owning pointer to the FieldList object with id field_list_id
|
inline |
Get a raw, non-owning pointer to the Parser object with P4 name name
. Return a nullptr if there is no parser with this name.
|
inline |
Get a raw, non-owning pointer to the Pipeline object with P4 name name
. Return a nullptr if there is no pipeline with this name.