nmad internal data representation is an iterator, ie the user essentially has to write a nm_data_traversal_t function which applies a function to every contiguous chunk of the data type. More...
Modules | |
| Data descriptors | |
| Core types to define data descriptors. | |
| Built-in data types | |
| A collection of pre-defined data iterators for common data types such as: | |
| Data helper functions | |
| A collection of helper function to help manipulating nm_data. | |
| 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. | |
Detailed Description
nmad internal data representation is an iterator, ie the user essentially has to write a nm_data_traversal_t function which applies a function to every contiguous chunk of the data type.
The iterator may use an internal state of size up to _NM_DATA_CONTENT_SIZE. The types must then be declared using macro NM_DATA_TYPE which associate the iterator function with the type for its internal state, the given name, and generates some typed accessor functions.
The main patterns to access data are:
- traversal: apply a given function to every chunk of data. The API is function nm_data_traversal_apply(), using a user-supplied nm_data_apply_t.
- generator: iterator (init/next/destroy) that returns a pointer to every chunk of data. The API is nm_data_generator_init(), nm_data_generator_next(), nm_data_generator_destroy().
- slicer: copy blocks of data with user-defined bounds for blocks, not necessary following in-memory data layout. The API is: nm_data_slicer_init(), nm_data_slicer_forward(), nm_data_slicer_copy_from(), nm_data_slicer_copy_to(), nm_data_slicer_destroy().
For a user-defined data type descriptor, user must define a traversal function nm_data_traversal_t, and optionnaly an optimized generator with nm_data_generator_init_t, nm_data_generator_next_t, nm_data_generator_destroy_t.
There is a collection of Built-in data types for common cases. Manipulation of such data representation is usually done through Data helper functions in higher layers, and Data slicing primitives. in drivers.