![]() |
P4C
The P4 Compiler
|
Public Member Functions | |
| JsonObjects () | |
| Constructs a new JsonObjects instance. Initializes the top-level JsonObject and other member arrays. | |
| unsigned | add_action (const cstring &name, Util::JsonArray *¶ms, Util::JsonArray *&body) |
| Adds an action to the JSON representation. | |
| void | add_enum (const cstring &enum_name, const cstring &entry_name, const unsigned entry_value) |
| Adds a single enum entry to the JSON representation. | |
| void | add_error (const cstring &name, const unsigned type) |
| Adds an error to the JSON representation. | |
| void | add_extern (const cstring &name, const cstring &type, Util::JsonArray *attributes) |
| Adds an extern instance to the JSON representation. | |
| void | add_extern_attribute (const cstring &name, const cstring &type, const cstring &value, Util::JsonArray *attributes) |
| Adds an extern attribute to the JSON representation. | |
| unsigned | add_header (const cstring &type, const cstring &name) |
| Creates a header instance in JSON. | |
| void | add_header_field (const cstring &name, Util::JsonArray *&field) |
| Adds a set of fields to an existing header type. | |
| void | add_header_stack (const cstring &type, const cstring &name, const unsigned size, const std::vector< unsigned > &header_ids) |
| Adds a header stack to the JSON representation. | |
| unsigned | add_header_type (const cstring &name) |
| Create a header type with empty field list. | |
| unsigned | add_header_type (const cstring &name, Util::JsonArray *&fields, unsigned max_length) |
| Create a header type in json. | |
| void | add_header_union_stack (const cstring &type, const cstring &name, const unsigned size, const std::vector< unsigned > &header_ids) |
| Adds a header union stack to the JSON representation. | |
| void | add_meta_info () |
| Adds meta information to the JsonObject. | |
| unsigned | add_metadata (const cstring &type, const cstring &name) |
| Creates a metadata header instance in JSON. | |
| void | add_parse_vset (const cstring &name, const unsigned bitwidth, const big_int &size) |
| Adds a parse vset to the JSON representation. | |
| unsigned | add_parser (const cstring &name) |
| Adds a parser to the JSON representation. | |
| void | add_parser_op (const unsigned id, Util::IJson *op) |
| Adds a parser operation to an existing parser state in the JSON representation. | |
| unsigned | add_parser_state (const unsigned id, const cstring &state_name) |
| Adds a parser state to an existing parser in the JSON representation. | |
| void | add_parser_transition (const unsigned id, Util::IJson *transition) |
| Adds a parser transition to an existing parser state in the JSON representation. | |
| void | add_parser_transition_key (const unsigned id, Util::IJson *key) |
| Adds a parser transition key to an existing parser state in the JSON representation. | |
| void | add_program_info (const cstring &name) |
| Adds program information to the top-level JsonObject. | |
| unsigned | add_union (const cstring &type, Util::JsonArray *&fields, const cstring &name) |
| Creates a header union instance in JSON. | |
| unsigned | add_union_type (const cstring &name, Util::JsonArray *&fields) |
| Creates a union type in JSON. | |
| Util::JsonArray * | append_array (Util::JsonArray *parent) |
| Appends a JSON array to a parent JSON array. | |
| Util::JsonArray * | create_parameters (Util::JsonObject *object) |
| Creates a JSON array named 'parameters' in a parent JsonObject. | |
| Util::JsonObject * | create_primitive (Util::JsonArray *parent, cstring name) |
| Creates a primitive JsonObject in a parent JsonArray with the given name. | |
| Util::JsonArray * | get_field_list_contents (unsigned id) const |
| Retrieves the contents of a field list identified by its ID. | |
| Util::JsonArray * | insert_array_field (Util::JsonObject *parent, cstring name) |
| Inserts a JSON array into a parent object under a specified key. | |
Static Public Member Functions | |
| static Util::JsonObject * | find_object_by_name (Util::JsonArray *array, const cstring &name) |
| Finds an object in a JSON array by its name. | |
Public Attributes | |
| Util::JsonArray * | actions |
| Util::JsonArray * | calculations |
| Util::JsonArray * | checksums |
| Util::JsonArray * | counters |
| Util::JsonArray * | deparsers |
| Util::JsonArray * | enums |
| Util::JsonArray * | errors |
| Util::JsonArray * | externs |
| Util::JsonArray * | field_aliases |
| Util::JsonArray * | field_lists |
| Util::JsonArray * | force_arith |
| Util::JsonArray * | header_stacks |
| ordered_map< std::string, unsigned > | header_type_id |
| Util::JsonArray * | header_types |
| Util::JsonArray * | header_union_stacks |
| Util::JsonArray * | header_union_types |
| Util::JsonArray * | header_unions |
| Util::JsonArray * | headers |
| Util::JsonArray * | learn_lists |
| std::map< unsigned, Util::JsonObject * > | map_parser |
| std::map< unsigned, Util::JsonObject * > | map_parser_state |
| Util::JsonObject * | meta |
| Util::JsonArray * | meter_arrays |
| Util::JsonArray * | parse_vsets |
| Util::JsonArray * | parsers |
| Util::JsonArray * | pipelines |
| Util::JsonArray * | register_arrays |
| Util::JsonObject * | toplevel |
| ordered_map< std::string, unsigned > | union_type_id |
| unsigned P4::BMV2::JsonObjects::add_action | ( | const cstring & | name, |
| Util::JsonArray *& | params, | ||
| Util::JsonArray *& | body ) |
Adds an action to the JSON representation.
| name | The name of the action. |
| params | The runtime data parameters of the action. |
| body | The primitives body of the action. |
| void P4::BMV2::JsonObjects::add_enum | ( | const cstring & | enum_name, |
| const cstring & | entry_name, | ||
| const unsigned | entry_value ) |
Adds a single enum entry to the JSON representation.
| enum_name | The name of the enum. |
| entry_name | The name of the enum entry. |
| entry_value | The value of the enum entry. |
| void P4::BMV2::JsonObjects::add_error | ( | const cstring & | name, |
| const unsigned | type ) |
Adds an error to the JSON representation.
| name | The name of the error. |
| type | The type of the error. |
| void P4::BMV2::JsonObjects::add_extern | ( | const cstring & | name, |
| const cstring & | type, | ||
| Util::JsonArray * | attributes ) |
Adds an extern instance to the JSON representation.
| name | The name of the extern instance. |
| type | The type of the extern instance. |
| attributes | The attributes array of the extern instance. |
| void P4::BMV2::JsonObjects::add_extern_attribute | ( | const cstring & | name, |
| const cstring & | type, | ||
| const cstring & | value, | ||
| Util::JsonArray * | attributes ) |
Adds an extern attribute to the JSON representation.
| name | The name of the attribute. |
| type | The type of the attribute. |
| value | The value of the attribute. |
| attributes | The attributes array to add the new attribute to. |
Creates a header instance in JSON.
| type | The type of the header. |
| name | The name of the header instance. |
| void P4::BMV2::JsonObjects::add_header_field | ( | const cstring & | name, |
| Util::JsonArray *& | field ) |
Adds a set of fields to an existing header type.
| name | The name of the header type. |
| field | The JsonArray containing the fields to add. |
| void P4::BMV2::JsonObjects::add_header_stack | ( | const cstring & | type, |
| const cstring & | name, | ||
| const unsigned | size, | ||
| const std::vector< unsigned > & | header_ids ) |
Adds a header stack to the JSON representation.
| type | The type of the headers in the stack. |
| name | The name of the header stack. |
| size | The size of the header stack. |
| ids | The vector of header IDs in the stack. |
| unsigned P4::BMV2::JsonObjects::add_header_type | ( | const cstring & | name | ) |
Create a header type with empty field list.
| name | header name |
| type | header type |
| fields | a JsonArray for the fields in the header |
| max_length | maximum length for a header with varbit fields; if 0 header does not |
| unsigned P4::BMV2::JsonObjects::add_header_type | ( | const cstring & | name, |
| Util::JsonArray *& | fields, | ||
| unsigned | max_length ) |
Create a header type in json.
| name | header name |
| type | header type |
| fields | a JsonArray for the fields in the header |
| max_length | maximum length for a header with varbit fields; if 0 header does not |
Create a header type in json.
| name | header name |
| type | header type |
| max_length | maximum length for a header with varbit fields; if 0 header does not contain varbit fields |
| fields | a JsonArray for the fields in the header |
| void P4::BMV2::JsonObjects::add_header_union_stack | ( | const cstring & | type, |
| const cstring & | name, | ||
| const unsigned | size, | ||
| const std::vector< unsigned > & | header_ids ) |
Adds a header union stack to the JSON representation.
| type | The type of the header unions in the stack. |
| name | The name of the header union stack. |
| size | The size of the header union stack. |
| ids | The vector of header union IDs in the stack. |
Creates a metadata header instance in JSON.
| type | The type of the metadata. |
| name | The name of the metadata header instance. |
| void P4::BMV2::JsonObjects::add_parse_vset | ( | const cstring & | name, |
| const unsigned | bitwidth, | ||
| const big_int & | size ) |
Adds a parse vset to the JSON representation.
| name | The name of the parse vset. |
| bitwidth | The compressed bit width of the parse vset. |
| size | The maximum size of the parse vset. |
| unsigned P4::BMV2::JsonObjects::add_parser | ( | const cstring & | name | ) |
Adds a parser to the JSON representation.
| name | The name of the parser. |
| void P4::BMV2::JsonObjects::add_parser_op | ( | const unsigned | id, |
| Util::IJson * | op ) |
Adds a parser operation to an existing parser state in the JSON representation.
| state_id | The ID of the parser state. |
| op | The operation to add. |
| unsigned P4::BMV2::JsonObjects::add_parser_state | ( | const unsigned | id, |
| const cstring & | state_name ) |
Adds a parser state to an existing parser in the JSON representation.
| parser_id | The ID of the parser. |
| state_name | The name of the parser state. |
| void P4::BMV2::JsonObjects::add_parser_transition | ( | const unsigned | id, |
| Util::IJson * | transition ) |
Adds a parser transition to an existing parser state in the JSON representation.
| state_id | The ID of the parser state. |
| transition | The transition to add. |
| void P4::BMV2::JsonObjects::add_parser_transition_key | ( | const unsigned | id, |
| Util::IJson * | key ) |
Adds a parser transition key to an existing parser state in the JSON representation.
| state_id | The ID of the parser state. |
| newKey | The new transition key to add. |
| void P4::BMV2::JsonObjects::add_program_info | ( | const cstring & | name | ) |
Adds program information to the top-level JsonObject.
| name | The name of the program. |
| unsigned P4::BMV2::JsonObjects::add_union | ( | const cstring & | type, |
| Util::JsonArray *& | fields, | ||
| const cstring & | name ) |
Creates a header union instance in JSON.
| type | The type of the header union. |
| fields | A JsonArray containing the header IDs in the union. |
| name | The name of the header union instance. |
| unsigned P4::BMV2::JsonObjects::add_union_type | ( | const cstring & | name, |
| Util::JsonArray *& | fields ) |
Creates a union type in JSON.
| name | The name of the union type. |
| fields | A JsonArray containing the headers in the union type. |
| Util::JsonArray * P4::BMV2::JsonObjects::append_array | ( | Util::JsonArray * | parent | ) |
Appends a JSON array to a parent JSON array.
| parent | The parent JsonArray to which the array will be appended. |
| Util::JsonArray * P4::BMV2::JsonObjects::create_parameters | ( | Util::JsonObject * | object | ) |
Creates a JSON array named 'parameters' in a parent JsonObject.
| object | The parent JsonObject in which the 'parameters' array will be created. |
| Util::JsonObject * P4::BMV2::JsonObjects::create_primitive | ( | Util::JsonArray * | parent, |
| cstring | name ) |
Creates a primitive JsonObject in a parent JsonArray with the given name.
| parent | The parent JsonArray in which the primitive will be created. |
| name | The name of the primitive. |
|
static |
Finds an object in a JSON array by its name.
| array | The JSON array to search in. |
| name | The name of the object to find. |
| Util::JsonArray * P4::BMV2::JsonObjects::get_field_list_contents | ( | unsigned | id | ) | const |
Retrieves the contents of a field list identified by its ID.
Given a field list id returns the array of values called "elements".
| id | The ID of the field list. |
| Util::JsonArray * P4::BMV2::JsonObjects::insert_array_field | ( | Util::JsonObject * | parent, |
| cstring | name ) |
Inserts a JSON array into a parent object under a specified key.
| parent | The parent JsonObject to insert the array into. |