tibrvMsgData_SetSize()

Function

Declaration

tibrv_status tibrvMsgData_SetSize(
    char**       buffer,
    tibrv_u32    size);

Purpose

Write the size of data into a wire buffer for an encoder.

Remarks

This layer 1 function helps encoders write size information to a message’s wire buffer. It does only part of the work that tibrvMsgData_CopyBytes() does (see tibrvMsgData_SetSize):

Procedure 

1. Write the size information into the wire buffer, starting at the position *buffer.
2. Advance *buffer to point to the end of the size information, which will become the start of the actual data.
3. Return.

After tibrvMsgData_SetSize() returns, the encoder can continue by writing the data starting at the (advanced) position *buffer. We recommend using the more complete function tibrvMsgData_CopyBytes() to write the size and data with one call; when finer control is required, programmers can use this function instead, with corresponding responsibility.

When using this function, the encoder must first use tibrvMsgData_ByteSize() to measure the wire size from the data length.

Parameter

Description

buffer

The encoder supplies the address of a location within the message’s wire buffer. This function writes the size into the destination message, and advances this buffer pointer.

size

Size to copy into the wire buffer.

Figure 202: tibrvMsgData_SetSize

See Also

tibrvMsgData_ByteSize()

tibrvMsgData_CopyBytes()

tibrvMsgData_Encoder