| ||||||||||||||
Reference/es_mbc_addfldmbuSyntaxint es_mbc_addfldmbu( struct es_mbc *cls, const char *fieldnm, struct es_mbu *cb ); Arguments
Return Codes
Descriptiones_mbc_addfldmbu defines the save, load and delete callback functions for a user-defined field (of type /* callback invoked as part of es_mb_save() */ typedef int (*es_mbu_save_t)( void *obj, void *udata, struct es_mbio *io ); /* callback invoked as part of es_mb_load() */ typedef int (*es_mbu_load_t)( void **objres, void *udata, struct es_mbio *io ); /* callback invoked as part of es_mb_delete */ typedef void (*es_mbu_delete_t)( void *obj, void *udata ); /* user-type callback interface */ struct es_mbu { void *udata; /* user-data passed as parameter to callback functions */ es_mbu_save_t savefn; /* save callback function called as part of es_mb_save */ es_mbu_load_t loadfn; /* load callback function called as part of es_mb_load */ es_mbu_delete_t delfn; /* delete callback called as part of es_mbn_delete */ };
Both /* read/write function prototype */ typedef int (*es_mb_io_t)( void *fndata, void *buf, unsigned numbytes ); /* handle for read/write functions and state-data */ struct es_mbio { void *fndata; /* user-specific data */ es_mb_io_t writefn; /* write (serialize) function */ es_mb_io_t readfn; /* read (deserialize) function */ }; The delete function Please note that duplicate user-defined fields are not recognised by es_mb_save(), es_mb_load() or es_mbn_delete() and must be managed by the supplied callback functions. Please note also that user-defined callback functions are not saved as part of database definition save via es_mbd_save(). | ||||||||||||||
Copyright © 2012 by Richard Brooks |