0001 BVSTOF(3)
0002 =========
0003 :doctype: manpage
0004
0005
0006 NAME
0007 ----
0008 Bvstof - Transfer data from View (C structure) to UBF buffer
0009
0010
0011 SYNOPSIS
0012 --------
0013
0014 #include <ubf.h>
0015
0016 int Bvstof(UBFH *'p_ub', char *'cstruct', int 'mode', char *'view');
0017
0018 Link with '-lubf -lnstd -lm -lpthread'
0019
0020 DESCRIPTION
0021 -----------
0022 Function is used to transfer data from view C structure ('cstruct') to UBF buffer
0023 ('p_ub'). The view type is passed into 'view' variable which must correspond to
0024 the actual C structure behind 'cstruct' pointer. The 'mode' flag indicates the
0025 data merge mode into UBF buffer (because UBF may already contain some fields).
0026
0027 For 'mode' have defined following constants:
0028
0029 . BUPDATE - Uses *Bupdate(3)* mechanism to merge the data into 'p_ub'. In this mode
0030 if field in C structure corresponds to NULL value defined in view, then data is
0031 not transfered to UBF.
0032
0033 . BOJOIN - Uses Bojoin() mechanism to merge data into 'p_ub'. Bojoin() is not yet
0034 supported, thus it is reserved for future use. And this mode will not change
0035 the target UBF buffer.
0036
0037 . BJOIN - Uses Bjoin() function to merge structure data to UBF buffer. Bjoin() is
0038 not yet implemented, thus this mode will not add/change any data in target UBF
0039 buffer.
0040
0041 . BCONCAT - Uses *Bconcat(3)* function to merge data into target UBF. In this
0042 mode even if field corresponds to NULL value in view, the NULL value is copied
0043 to target UBF.
0044
0045 The mode functions are supported thanks to approach that firstly structure data
0046 is loaded into temporary UBF buffer, and then this temp buffer is merged with
0047 target 'p_ub' buffer.
0048
0049 If *C* (count indicator) was set for the field, then during data transfer this
0050 number of elements are copied to UBF. If *C* flag was not used, then all elements
0051 are staged to copy. If count field is greater than count defined in VIEW, the operation
0052 will be terminated with error *TPEINVAL*
0053
0054 If *L* flag was set, then for *carray* buffers this will
0055 indicate number of bytes to copy to UBF field.
0056
0057
0058 RETURN VALUE
0059 ------------
0060 On success, *Bvftos()* return zero; on error, -1 is returned, with *Berror* set to
0061 indicate the error.
0062
0063 ERRORS
0064 ------
0065 Note that *Bstrerror()* returns generic error message plus custom message with
0066 debug info from last function call.
0067
0068 *BALIGNERR* Corrupted buffer or pointing to not aligned memory area.
0069
0070 *BEINVAL* Invalid value passed to function. Count indicator is greater than count
0071 specified in view or length indicator is greater than size specified for field in
0072 view.
0073
0074 *BNOTFLD* Buffer not fielded, not correctly allocated or corrupted.
0075
0076 *BBADFLD* Invalid field id passed.
0077
0078 *BBADVIEW* View is not found, object file is defective or system error.
0079
0080 *BVFSYNTAX* Defective object file, cannot load.
0081
0082 *BMALLOC* Malloc failed, out of memory.
0083
0084 *BNOSPACE* Not enough space in target buffer (pointed by 'p_ub').
0085
0086 EXAMPLE
0087 -------
0088 See *atmitest/test040_typedview/viewunit1.c* for sample code.
0089
0090 BUGS
0091 ----
0092 Report bugs to support@mavimax.com
0093
0094 SEE ALSO
0095 --------
0096 *viewc(8)* *Bvstof(3)* *Bvsinit(3)* *Bvselinit(3)* *Bvnull(3)* *Bvopt(3)* *ex_env(5)*
0097 *Bupdate(3)* *Bconcat(3)*
0098
0099 COPYING
0100 -------
0101 (C) Mavimax, Ltd
0102