17#ifndef BACKENDS_BMV2_COMMON_JSONOBJECTS_H_
18#define BACKENDS_BMV2_COMMON_JSONOBJECTS_H_
23#include "lib/ordered_map.h"
94 const std::vector<unsigned> &header_ids);
102 const std::vector<unsigned> &header_ids);
198 std::map<unsigned, Util::JsonObject *> map_parser;
199 std::map<unsigned, Util::JsonObject *> map_parser_state;
Definition JsonObjects.h:27
void add_extern(const cstring &name, const cstring &type, Util::JsonArray *attributes)
Adds an extern instance to the JSON representation.
Definition JsonObjects.cpp:379
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.
Definition JsonObjects.cpp:217
void add_header_field(const cstring &name, Util::JsonArray *&field)
Adds a set of fields to an existing header type.
Definition JsonObjects.cpp:169
Util::JsonArray * create_parameters(Util::JsonObject *object)
Creates a JSON array named 'parameters' in a parent JsonObject.
Definition JsonObjects.cpp:89
void add_parse_vset(const cstring &name, const unsigned bitwidth, const big_int &size)
Adds a parse vset to the JSON representation.
Definition JsonObjects.cpp:345
void add_program_info(const cstring &name)
Adds program information to the top-level JsonObject.
Definition JsonObjects.cpp:93
void add_parser_op(const unsigned id, Util::IJson *op)
Adds a parser operation to an existing parser state in the JSON representation.
Definition JsonObjects.cpp:324
Util::JsonArray * append_array(Util::JsonArray *parent)
Appends a JSON array to a parent JSON array.
Definition JsonObjects.cpp:83
void add_error(const cstring &name, const unsigned type)
Adds an error to the JSON representation.
Definition JsonObjects.cpp:249
unsigned add_metadata(const cstring &type, const cstring &name)
Creates a metadata header instance in JSON.
Definition JsonObjects.cpp:204
unsigned add_header(const cstring &type, const cstring &name)
Creates a header instance in JSON.
Definition JsonObjects.cpp:177
unsigned add_action(const cstring &name, Util::JsonArray *¶ms, Util::JsonArray *&body)
Adds an action to the JSON representation.
Definition JsonObjects.cpp:356
unsigned add_parser_state(const unsigned id, const cstring &state_name)
Adds a parser state to an existing parser in the JSON representation.
Definition JsonObjects.cpp:293
unsigned add_header_type(const cstring &name, Util::JsonArray *&fields, unsigned max_length)
Create a header type in json.
Definition JsonObjects.cpp:110
static Util::JsonObject * find_object_by_name(Util::JsonArray *array, const cstring &name)
Finds an object in a JSON array by its name.
Definition JsonObjects.cpp:66
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.
Definition JsonObjects.cpp:333
unsigned add_parser(const cstring &name)
Adds a parser to the JSON representation.
Definition JsonObjects.cpp:279
void add_enum(const cstring &enum_name, const cstring &entry_name, const unsigned entry_value)
Adds a single enum entry to the JSON representation.
Definition JsonObjects.cpp:255
Util::JsonObject * create_primitive(Util::JsonArray *parent, cstring name)
Creates a primitive JsonObject in a parent JsonArray with the given name.
Util::JsonArray * insert_array_field(Util::JsonObject *parent, cstring name)
Inserts a JSON array into a parent object under a specified key.
Definition JsonObjects.cpp:77
void add_meta_info()
Adds meta information to the JsonObject.
Definition JsonObjects.cpp:95
Util::JsonArray * get_field_list_contents(unsigned id) const
Retrieves the contents of a field list identified by its ID.
Definition JsonObjects.cpp:55
void add_extern_attribute(const cstring &name, const cstring &type, const cstring &value, Util::JsonArray *attributes)
Adds an extern attribute to the JSON representation.
Definition JsonObjects.cpp:370
unsigned add_union(const cstring &type, Util::JsonArray *&fields, const cstring &name)
Creates a header union instance in JSON.
Definition JsonObjects.cpp:190
unsigned add_union_type(const cstring &name, Util::JsonArray *&fields)
Creates a union type in JSON.
Definition JsonObjects.cpp:133
JsonObjects()
Constructs a new JsonObjects instance. Initializes the top-level JsonObject and other member arrays.
Definition JsonObjects.cpp:27
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.
Definition JsonObjects.cpp:233
void add_parser_transition(const unsigned id, Util::IJson *transition)
Adds a parser transition to an existing parser state in the JSON representation.
Definition JsonObjects.cpp:313
Definition ordered_map.h:32
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition action.cpp:21