Data slicing primitives.
Data slicer is a collection of primitives to get a series of blocks with bounds controled by the caller from a given nm_data iterator. More...
Data Structures | |
| struct | nm_data_coroutine_s |
| struct | nm_data_slicer_s |
| internal state of a data slicer. More... | |
Macros | |
| #define | NM_DATA_SLICER_NULL ((struct nm_data_slicer_s){ .kind = NM_DATA_SLICER_NONE }) |
| a slicer attached to no data | |
Typedefs | |
| typedef void(* | nm_data_coroutine_worker_t) (struct nm_data_coroutine_s *p_coroutine, void *_user_data) |
| typedef enum nm_data_coroutine_kind_e | nm_data_coroutine_kind_t |
| typedef struct nm_data_slicer_s | nm_data_slicer_t |
| internal state of a data slicer. | |
Enumerations | |
| enum | nm_data_coroutine_kind_e { NM_DATA_COROUTINE_NONE , NM_DATA_COROUTINE_UCONTEXT , NM_DATA_COROUTINE_LONGJMP } |
| enum | nm_data_slicer_kind_t { NM_DATA_SLICER_NONE = 0 , NM_DATA_SLICER_COROUTINE , NM_DATA_SLICER_CONTIG } |
| various kinds of slicer implementations More... | |
Functions | |
| void | nm_data_coroutine_yield_to_caller (struct nm_data_coroutine_s *p_coroutine) |
| void | nm_data_coroutine_yield_to_data (struct nm_data_coroutine_s *p_coroutine) |
| static int | nm_data_slicer_isnull (const nm_data_slicer_t *p_slicer) |
| tests whether a slicer is null | |
| void | nm_data_slicer_init (nm_data_slicer_t *p_slicer, const struct nm_data_s *p_data) |
| void | nm_data_slicer_copy_from (nm_data_slicer_t *p_slicer, void *dest_ptr, nm_len_t slice_len) |
| void | nm_data_slicer_copy_to (nm_data_slicer_t *p_slicer, const void *src_ptr, nm_len_t slice_len) |
| void | nm_data_slicer_forward (nm_data_slicer_t *p_slicer, nm_len_t offset) |
| void | nm_data_slicer_destroy (nm_data_slicer_t *p_slicer) |
Detailed Description
Data slicer is a collection of primitives to get a series of blocks with bounds controled by the caller from a given nm_data iterator.
Two flavors are available:
- contig, for contiguous data types
- coroutine, as a general case Additionally, two implementations are avilable for coroutines, depending on platform:
- setjmp/longjmp, as a general case
- ucontext-based coroutine, on platforms where stack jumping is not permitted by longjmp (ia64)
Macro Definition Documentation
◆ NM_DATA_SLICER_NULL
| #define NM_DATA_SLICER_NULL ((struct nm_data_slicer_s){ .kind = NM_DATA_SLICER_NONE }) |
Typedef Documentation
◆ nm_data_coroutine_kind_t
| typedef enum nm_data_coroutine_kind_e nm_data_coroutine_kind_t |
◆ nm_data_coroutine_worker_t
| typedef void(* nm_data_coroutine_worker_t) (struct nm_data_coroutine_s *p_coroutine, void *_user_data) |
◆ nm_data_slicer_t
| typedef struct nm_data_slicer_s nm_data_slicer_t |
internal state of a data slicer.
Opaque structure for the user.
Enumeration Type Documentation
◆ nm_data_coroutine_kind_e
◆ nm_data_slicer_kind_t
Function Documentation
◆ nm_data_coroutine_yield_to_caller()
| void nm_data_coroutine_yield_to_caller | ( | struct nm_data_coroutine_s * | p_coroutine | ) |
Referenced by nm_data_op_apply_slicer_coroutine().
◆ nm_data_coroutine_yield_to_data()
| void nm_data_coroutine_yield_to_data | ( | struct nm_data_coroutine_s * | p_coroutine | ) |
◆ nm_data_slicer_copy_from()
| void nm_data_slicer_copy_from | ( | nm_data_slicer_t * | p_slicer, |
| void * | dest_ptr, | ||
| nm_len_t | slice_len | ||
| ) |
◆ nm_data_slicer_copy_to()
| void nm_data_slicer_copy_to | ( | nm_data_slicer_t * | p_slicer, |
| const void * | src_ptr, | ||
| nm_len_t | slice_len | ||
| ) |
◆ nm_data_slicer_destroy()
| void nm_data_slicer_destroy | ( | nm_data_slicer_t * | p_slicer | ) |
◆ nm_data_slicer_forward()
| void nm_data_slicer_forward | ( | nm_data_slicer_t * | p_slicer, |
| nm_len_t | offset | ||
| ) |
◆ nm_data_slicer_init()
| void nm_data_slicer_init | ( | nm_data_slicer_t * | p_slicer, |
| const struct nm_data_s * | p_data | ||
| ) |
◆ nm_data_slicer_isnull()
|
inlinestatic |
tests whether a slicer is null
Definition at line 783 of file nm_data.h.
References nm_data_slicer_s::kind, and NM_DATA_SLICER_NONE.