lib: simplify the public notification iterator interfaces
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 6 Jun 2018 20:52:03 +0000 (16:52 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 2 May 2019 04:05:45 +0000 (00:05 -0400)
Simplify the public notification iterator interfaces so as to remove:

* bt_notification_iterator_borrow_notification()
* bt_notification_iterator_get_notification()
* bt_notification_iterator_next()

in favor of:

    enum bt_notification_iterator_status
    bt_output_port_notification_iterator_next(struct
        bt_notification_iterator *iterator,
        struct bt_notification **notification);

    enum bt_notification_iterator_status
    bt_private_connection_notification_iterator_next(
        struct bt_notification_iterator *iterator,
        struct bt_notification **notification);

Those two new functions:

* Move the notification received from the user method to the
  `notification` output variable directly without modifying the
  reference count.

* Do not need to check the notification iterator type of notification to
  perform the appropriate specific operation and have precondition
  checks to ensure `iterator` has the right type.

This API is also in line with some popular iterator interfaces where the
"next" function returns the iteration status and the element at the same
time, for example:

* g_hash_table_iter_next()
* Python's next()

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>

No differences found
This page took 0.028134 seconds and 4 git commands to generate.