NewMadeleine

Documentation

« back to PM2 home.

Core types to define data descriptors. More...

Data Structures

struct  nm_data_properties_s
 block of static properties for a given data descriptor More...
 
struct  nm_data_op_context_nop_s
 
struct  nm_data_op_context_copy_from_s
 
struct  nm_data_op_context_copy_to_s
 
struct  nm_data_op_context_dynamic_s
 
struct  nm_data_op_context_getprops_s
 
struct  nm_data_op_context_chunk_s
 
struct  nm_data_op_context_slicer_coroutine_s
 
struct  nm_data_op_s
 
struct  nm_data_ops_s
 set of operations available on data type. More...
 
struct  nm_data_s
 a data descriptor, used to pack/unpack data from app layout to/from contiguous buffers More...
 
struct  nm_datav_s
 encapsulate a dynamic vector of nm_data More...
 

Macros

#define _NM_DATA_CONTENT_SIZE   64
 maximum size of content descriptor for nm_data
 
#define NM_DATA_TYPE(ENAME, CONTENT_TYPE, OPS)
 macro to generate typed functions to init/access data fields.
 
#define NM_DATAV_INIT_SIZE   4
 initial size of an nm_datav
 

Typedefs

typedef void(* nm_data_apply_t) (void *ptr, nm_len_t len, void *_context)
 function to apply to each data chunk upon traversal
 
typedef enum nm_data_op_kind_e nm_data_op_t
 operation to apply to data in traversal & slicer
 
typedef void(* nm_data_traversal_t) (const void *_data_content, struct nm_data_op_s *p_op)
 funtion to traverse data with app layout, i.e.
 
typedef void(* nm_data_properties_compute_t) (struct nm_data_s *p_data)
 function to compute data properties
 

Enumerations

enum  nm_data_op_kind_e {
  NM_DATA_OP_NONE = 0 , NM_DATA_OP_NOP , NM_DATA_OP_COPY_FROM , NM_DATA_OP_COPY_TO ,
  NM_DATA_OP_DYNAMIC , NM_DATA_OP_GETPROPS , NM_DATA_OP_CHUNK , NM_DATA_OP_SLICER_COROUTINE
}
 operation to apply to data in traversal & slicer More...
 

Functions

void nm_data_default_properties_compute (struct nm_data_s *p_data)
 
static void nm_data_propertie_gpu_preinit (struct nm_data_properties_s *p_props)
 pre-init GPU part of data properties
 
static void nm_data_propertie_gpu_postinit (const struct nm_data_properties_s *p_props)
 post-init GPU part of data properties: check that p_properties_compute function actually filled the GPU part.
 
void nm_data_properties_gpu_fill (struct nm_data_properties_s *p_props, const void *p_ptr)
 fill in the GPU part of data properties, following pointer 'p_ptr'
 
static void nm_datav_init (struct nm_datav_s *p_datav)
 initialize a datav
 
static void nm_datav_destroy (struct nm_datav_s *p_datav)
 destroys a datav
 
static void nm_datav_add_chunk_data (struct nm_datav_s *p_datav, const struct nm_data_s *p_data)
 add a chunk of data to datav; given p_data content is copied.
 
static void nm_datav_add_chunk (struct nm_datav_s *p_datav, const void *ptr, nm_len_t len)
 add a chunk of contiguous data to a datav
 
static void nm_datav_add_chunk_excerpt (struct nm_datav_s *p_datav, struct nm_data_s *p_data, nm_len_t chunk_offset, nm_len_t chunk_len)
 add an excerpt of data to datav; given p_data content is not copied.
 
static nm_len_t nm_datav_size (struct nm_datav_s *p_datav)
 get the size (number of bytes) of data contained in the datav
 
static void nm_datav_uncommit (struct nm_datav_s *p_datav)
 'uncommit' a datav: explicitely declare that nm_data pointing to this datav has been destroyed.
 

Detailed Description

Core types to define data descriptors.

Macro Definition Documentation

◆ _NM_DATA_CONTENT_SIZE

#define _NM_DATA_CONTENT_SIZE   64

maximum size of content descriptor for nm_data

Definition at line 81 of file nm_data.h.

◆ NM_DATA_TYPE

#define NM_DATA_TYPE (   ENAME,
  CONTENT_TYPE,
  OPS 
)
Value:
__attribute__((unused)) \
static inline void nm_data_##ENAME##_set(struct nm_data_s*p_data, CONTENT_TYPE value) \
{ \
p_data->ops = *(OPS); \
assert(p_data->ops.p_traversal != NULL); \
if(p_data->ops.p_properties_compute == NULL) \
{ \
p_data->ops.p_properties_compute = nm_data_default_properties_compute; \
} \
assert(sizeof(CONTENT_TYPE) <= _NM_DATA_CONTENT_SIZE); \
CONTENT_TYPE*p_content = (CONTENT_TYPE*)&p_data->_content[0]; \
p_data->props.blocks = -1; \
nm_data_propertie_gpu_preinit(&p_data->props); \
(*p_data->ops.p_properties_compute)(p_data); \
nm_data_propertie_gpu_postinit(&p_data->props); \
} \
__attribute__((unused)) \
static inline CONTENT_TYPE*nm_data_##ENAME##_content(const struct nm_data_s*p_data) \
{ \
return (CONTENT_TYPE*)p_data->_content; \
}
struct nm_data_contiguous_s __attribute__
#define _NM_DATA_CONTENT_SIZE
maximum size of content descriptor for nm_data
Definition nm_data.h:81
void nm_data_default_properties_compute(struct nm_data_s *p_data)
struct nm_data_null_s * p_content
Definition nm_data.h:538
nm_data_propertie_gpu_preinit & p_data
Definition nm_data.h:538
a data descriptor, used to pack/unpack data from app layout to/from contiguous buffers
Definition nm_data.h:199
p_data props blocks
Definition nm_data.h:538

macro to generate typed functions to init/access data fields.

Parameters
ENAMEis the base name used to build symbols (must be a valid C token)
CONTENT_TYPEis the iterator internal state
OPSis a collection of operations of type nm_data_ops_s for the given type. At least nm_data_ops_s::p_traversal field must be non-NULL; other fields may be NULL and will be filled with default values.
Examples
nm_sr_custom_data.c.

Definition at line 222 of file nm_data.h.

◆ NM_DATAV_INIT_SIZE

#define NM_DATAV_INIT_SIZE   4

initial size of an nm_datav

Definition at line 250 of file nm_data.h.

Typedef Documentation

◆ nm_data_apply_t

typedef void(* nm_data_apply_t) (void *ptr, nm_len_t len, void *_context)

function to apply to each data chunk upon traversal

Definition at line 89 of file nm_data.h.

◆ nm_data_op_t

operation to apply to data in traversal & slicer

◆ nm_data_properties_compute_t

typedef void(* nm_data_properties_compute_t) (struct nm_data_s *p_data)

function to compute data properties

Definition at line 183 of file nm_data.h.

◆ nm_data_traversal_t

typedef void(* nm_data_traversal_t) (const void *_data_content, struct nm_data_op_s *p_op)

funtion to traverse data with app layout, i.e.

='map' functional operation

Parameters
_contentcontent description of data type
applyfunction to apply to all chunks
_contextcontext pointer given to apply function

Definition at line 180 of file nm_data.h.

Enumeration Type Documentation

◆ nm_data_op_kind_e

operation to apply to data in traversal & slicer

Enumerator
NM_DATA_OP_NONE 

no operation selected

NM_DATA_OP_NOP 

perform no operation on data (fast forward)

NM_DATA_OP_COPY_FROM 

copy from iterator to user buffer

NM_DATA_OP_COPY_TO 

copy to iterator, from user buffer

NM_DATA_OP_DYNAMIC 

dynamic function call

NM_DATA_OP_GETPROPS 

compute data properties

NM_DATA_OP_CHUNK 

apply op on chunk

NM_DATA_OP_SLICER_COROUTINE 

coroutine-based slicer

Definition at line 106 of file nm_data.h.

Function Documentation

◆ nm_data_default_properties_compute()

void nm_data_default_properties_compute ( struct nm_data_s p_data)

compute data properties; not for enduser, exported for use by inline function

◆ nm_data_propertie_gpu_postinit()

static void nm_data_propertie_gpu_postinit ( const struct nm_data_properties_s p_props)
inlinestatic

post-init GPU part of data properties: check that p_properties_compute function actually filled the GPU part.

◆ nm_data_propertie_gpu_preinit()

static void nm_data_propertie_gpu_preinit ( struct nm_data_properties_s p_props)
inlinestatic

pre-init GPU part of data properties

◆ nm_data_properties_gpu_fill()

void nm_data_properties_gpu_fill ( struct nm_data_properties_s p_props,
const void *  p_ptr 
)

fill in the GPU part of data properties, following pointer 'p_ptr'

Referenced by nm_data_op_apply_getprops().

◆ nm_datav_add_chunk()

static void nm_datav_add_chunk ( struct nm_datav_s p_datav,
const void *  ptr,
nm_len_t  len 
)
inlinestatic

add a chunk of contiguous data to a datav

Definition at line 850 of file nm_data.h.

References len, nm_data_contiguous_build(), and nm_datav_add_chunk_data().

Here is the call graph for this function:

◆ nm_datav_add_chunk_data()

static void nm_datav_add_chunk_data ( struct nm_datav_s p_datav,
const struct nm_data_s p_data 
)
inlinestatic

add a chunk of data to datav; given p_data content is copied.

Definition at line 829 of file nm_data.h.

References nm_datav_s::allocated, assert(), nm_datav_s::commited, nm_datav_s::data, nm_datav_s::n_data, NM_DATAV_INIT_SIZE, nm_datav_s::p_data, and p_data.

Referenced by nm_datav_add_chunk(), nm_datav_add_chunk_excerpt(), nm_rpc_irecv_body_data(), and nm_rpc_recv_header_data().

Here is the call graph for this function:

◆ nm_datav_add_chunk_excerpt()

static void nm_datav_add_chunk_excerpt ( struct nm_datav_s p_datav,
struct nm_data_s p_data,
nm_len_t  chunk_offset,
nm_len_t  chunk_len 
)
inlinestatic

add an excerpt of data to datav; given p_data content is not copied.

Definition at line 857 of file nm_data.h.

References chunk_len, chunk_offset, nm_data_excerpt_build(), nm_datav_add_chunk_data(), and p_data.

Referenced by nm_coll_datav_descendants().

Here is the call graph for this function:

◆ nm_datav_destroy()

static void nm_datav_destroy ( struct nm_datav_s p_datav)
inlinestatic

destroys a datav

Definition at line 819 of file nm_data.h.

References assert(), nm_datav_s::data, and nm_datav_s::p_data.

Here is the call graph for this function:

◆ nm_datav_init()

static void nm_datav_init ( struct nm_datav_s p_datav)
inlinestatic

initialize a datav

Definition at line 811 of file nm_data.h.

References nm_datav_s::allocated, nm_datav_s::commited, nm_datav_s::data, nm_datav_s::n_data, and nm_datav_s::p_data.

◆ nm_datav_size()

static nm_len_t nm_datav_size ( struct nm_datav_s p_datav)
inlinestatic

get the size (number of bytes) of data contained in the datav

Definition at line 864 of file nm_data.h.

References nm_datav_s::n_data, nm_data_size(), nm_datav_s::p_data, and size.

Referenced by nm_rpc_recv_header_data().

Here is the call graph for this function:

◆ nm_datav_uncommit()

static void nm_datav_uncommit ( struct nm_datav_s p_datav)
inlinestatic

'uncommit' a datav: explicitely declare that nm_data pointing to this datav has been destroyed.

Use with care!

Definition at line 875 of file nm_data.h.

References assert(), and nm_datav_s::commited.

Referenced by nm_rpc_recv_header_data().

Here is the call graph for this function: