X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Flib%2Fgraph%2Fcomponent.h;h=387996aac4ad5e592a8a35a3ebdbc57101898f2c;hb=157a98edd5aebe1b6ab7f60a49d8430450fabe76;hp=4125453979bb0dc8e6e3ff66f3953f3ef47a3b7e;hpb=5d9ef4cb64e5bd7793d443cbfcc0248bb8804580;p=babeltrace.git diff --git a/src/lib/graph/component.h b/src/lib/graph/component.h index 41254539..387996aa 100644 --- a/src/lib/graph/component.h +++ b/src/lib/graph/component.h @@ -22,6 +22,14 @@ #include "component-class.h" #include "port.h" +#define BT_ASSERT_PRE_INPUT_PORT_NAME_UNIQUE(comp, name) \ + BT_ASSERT_PRE(bt_component_port_name_is_unique(comp->input_ports, name), \ + "Input port name is not unique: name=\"%s\", %![comp-]c", name, comp); + +#define BT_ASSERT_PRE_OUTPUT_PORT_NAME_UNIQUE(comp, name) \ + BT_ASSERT_PRE(bt_component_port_name_is_unique(comp->output_ports, name), \ + "Output port name is not unique: name=\"%s\", %![comp-]c", name, comp); + typedef void (*bt_component_destroy_listener_func)( struct bt_component *class, void *data); @@ -111,6 +119,9 @@ enum bt_self_component_add_port_status bt_component_add_output_port( struct bt_component *component, const char *name, void *user_data, struct bt_port **port); +BT_HIDDEN +bool bt_component_port_name_is_unique(GPtrArray *ports, const char *name); + BT_HIDDEN void bt_component_remove_port(struct bt_component *component, struct bt_port *port);