Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update closure handlers documentation #736

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 48 additions & 3 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,16 @@ See details at :ref:`owned_types_concept`
.. c:type:: z_owned_closure_sample_t
.. c:type:: z_loaned_closure_sample_t
.. c:type:: z_moved_closure_sample_t


.. c:type:: void (* z_sample_handler_t)(z_loaned_sample_t * sample, void * arg);

Function pointer type for handling samples.
Represents a callback function that is invoked when a sample is available for processing.

Parameters:
- **sample** - Pointer to a :c:type:`z_loaned_sample_t` representing the sample to be processed.
- **arg** - A user-defined pointer to additional data that can be used during the processing of the sample.

Functions
^^^^^^^^^
.. autocfunction:: primitives.h::z_closure_sample
Expand All @@ -486,7 +495,16 @@ See details at :ref:`owned_types_concept`
.. c:type:: z_owned_closure_query_t
.. c:type:: z_loaned_closure_query_t
.. c:type:: z_moved_closure_query_t


.. c:type:: void (* z_query_handler_t)(z_loaned_query_t * query, void * arg);

Function pointer type for handling queries.
Represents a callback function that is invoked when a query is available for processing.

Parameters:
- **query** - Pointer to a :c:type:`z_loaned_query_t` representing the query to be processed.
- **arg** - A user-defined pointer to additional data that can be used during the processing of the query.

Functions
^^^^^^^^^
.. autocfunction:: primitives.h::z_closure_query
Expand All @@ -511,7 +529,16 @@ See details at :ref:`owned_types_concept`
.. c:type:: z_owned_closure_reply_t
.. c:type:: z_loaned_closure_reply_t
.. c:type:: z_moved_closure_reply_t


.. c:type:: void (* z_reply_handler_t)(z_loaned_reply_t * reply, void * arg);

Function pointer type for handling replies.
Represents a callback function that is invoked when a reply is available for processing.

Parameters:
- **reply** - Pointer to a :c:type:`z_loaned_reply_t` representing the reply to be processed.
- **arg** - A user-defined pointer to additional data that can be used during the processing of the reply.

Functions
^^^^^^^^^
.. autocfunction:: primitives.h::z_closure_reply
Expand All @@ -536,6 +563,15 @@ See details at :ref:`owned_types_concept`
.. c:type:: z_owned_closure_hello_t
.. c:type:: z_loaned_closure_hello_t
.. c:type:: z_moved_closure_hello_t

.. c:type:: void (* z_hello_handler_t)(z_loaned_hello_t * hello, void * arg);

Function pointer type for handling scouting response.
Represents a callback function that is invoked when a hello is available for processing.

Parameters:
- **hello** - Pointer to a :c:type:`z_loaned_hello_t` representing the hello to be processed.
- **arg** - A user-defined pointer to additional data that can be used during the processing of the hello.

Functions
^^^^^^^^^
Expand All @@ -561,6 +597,15 @@ See details at :ref:`owned_types_concept`
.. c:type:: z_owned_closure_zid_t
.. c:type:: z_loaned_closure_zid_t
.. c:type:: z_moved_closure_zid_t

.. c:type:: void (* z_zid_handler_t)(z_loaned_zid_t * zid, void * arg);

Function pointer type for handling Zenoh ID routers response.
Represents a callback function that is invoked when a zid is available for processing.

Parameters:
- **zid** - Pointer to a :c:type:`z_loaned_zid_t` representing the zid to be processed.
- **arg** - A user-defined pointer to additional data that can be used during the processing of the zid.

Functions
^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion include/zenoh-pico/api/primitives.h
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ void z_closure_hello_call(const z_loaned_closure_hello_t *closure, z_loaned_hell
* It consists on a structure that contains all the elements for stateful, memory-leak-free callbacks.
*
* Parameters:
* closure: Pointer to an uninitialized :c:type:`z_owned_closure_zit_t`.
* closure: Pointer to an uninitialized :c:type:`z_owned_closure_zid_t`.
* call: Pointer to the callback function. ``context`` will be passed as its last argument.
* drop: Pointer to the function that will free the callback state. ``context`` will be passed as its last argument.
* context: Pointer to an arbitrary state.
Expand Down
Loading