Add Scalar

Convenience Methods

Declaration

TibrvStatus addtype(
    const char*    fieldName,
    tibrv_type    value,
    tibrv_u16      fieldId=0);

Purpose

Add a field containing a scalar value.

Method Name

Field Value Type

Type Description

addBool

tibrv_bool

boolean

addF32

tibrv_f32

32-bit floating point

addF64

tibrv_f64

64-bit floating point

addI8

tibrv_i8

8-bit integer

addI16

tibrv_i16

16-bit integer

addI32

tibrv_i32

32-bit integer

addI64

tibrv_i64

64-bit integer

addU8

tibrv_u8

8-bit unsigned integer

addU16

tibrv_u16

16-bit unsigned integer

addU32

tibrv_u32

32-bit unsigned integer

addU64

tibrv_u64

64-bit unsigned integer

addIPAddr32

tibrv_ipaddr32

4-byte IP address

addIPPort16

tibrv_ipport16

2-byte IP port

Parameter

Description

fieldName

Create the field with this name.

NULL is a legal name. However, if fieldId is non-zero, then fieldName must be non-NULL.

value

Add a new field with this value (which may be a literal or stored in a variable).

The convenience method must correspond to the datatype of this value. We recommend casting the data to match the convenience method.

The method copies the value into the new message field.

fieldId

Create the new field with this identifier. Zero is a special value that signifies no field identifier. All non-zero field identifiers must be unique within each message.

It is illegal to add a field that has both a NULL field name, and a non-zero field identifier.