X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=include%2Fbabeltrace%2Fobjects.h;h=3d02b2571df4113adb241606510e926ca7888f8a;hb=4a512e75f455ca7c095c07a020cd77a3f04a1e22;hp=f030424f283d6ead079eb999a2af4726746308df;hpb=5a5029c6ef4f3c425e5ebe9e50f945462bf0c244;p=babeltrace.git diff --git a/include/babeltrace/objects.h b/include/babeltrace/objects.h index f030424f..3d02b257 100644 --- a/include/babeltrace/objects.h +++ b/include/babeltrace/objects.h @@ -161,6 +161,20 @@ enum bt_object_type { BT_OBJECT_TYPE_MAP = 6, }; +/** + * Status (return value of some functions). + */ +enum bt_object_status { + /** Operation cancelled. */ + BT_OBJECT_STATUS_CANCELLED = -2, + + /** Error. */ + BT_OBJECT_STATUS_ERROR = -1, + + /** Okay, no error. */ + BT_OBJECT_STATUS_OK = 0, +}; + /** * Object. */ @@ -716,12 +730,21 @@ extern struct bt_object *bt_object_map_get(const struct bt_object *map_obj, * @param map_obj Map object * @param cb User function to call back * @param data User data passed to the user function - * @returns 0 on success, or a negative value on error - * (the user function breaking the loop is \b not - * considered an error here) - */ -extern int bt_object_map_foreach(const struct bt_object *map_obj, - bt_object_map_foreach_cb cb, void *data); + * @returns \link bt_object_status::BT_OBJECT_STATUS_OK + * BT_OBJECT_STATUS_OK\endlink if + * there's no error and the traversal was not + * cancelled by the user function, + * \link bt_object_status::BT_OBJECT_STATUS_CANCELLED + * BT_OBJECT_STATUS_CANCELLED\endlink + * if the function was cancelled by the user + * function, or + * \link bt_object_status::BT_OBJECT_STATUS_ERROR + * BT_OBJECT_STATUS_ERROR\endlink on + * any other error + */ +extern enum bt_object_status bt_object_map_foreach( + const struct bt_object *map_obj, bt_object_map_foreach_cb cb, + void *data); /** * Returns whether or not the map object \p map_obj contains the