NAME

Tibco::Rv::Msg::Field - Manipulate a Tibco message field

SYNOPSIS

my ( $field ) = $msg->createField( name => 'myField' );
$field->i8( 123 );
$field->opaque( "abc\0abc" );
$field->ipaddr32( '66.35.250.150' );
$field->u64array( [ 1, 123, 3030 ] );
print "U64Array\n" if ( $field->type == Tibco::Rv::Msg::U64ARRAY );
print "Count: ", $field->count, "; size: ", $field->size, "\n";

DESCRIPTION

Message Field-manipulating class. Holds a single value, like a C enum, along with a name and an id.

CONSTRUCTOR

$field = new Tibco::Rv::Msg::Field( %args )
%args:
   name => $name,
   id => $id

Creates a Tibco::Rv::Msg::Field, with name and id as given in %args (name defaults to undef and id defaults to 0, if not specified). $field is initialized with boolean value Tibco::Rv::FALSE.

METHODS

$name = $field->name

Returns $field's name.

$field->name( $name )

Sets $field's name.

$id = $field->id

Returns $field's id.

$field->id( $id )

Sets $field's id.

$count = $field->count

Returns $field's count. For array types, $count is the number of elements in the array. For all other types, $count is 1.

$size = $field->size

Returns $field's size. For array types, $size is the size in bytes of one element of the array. For all other types, $size is the size in bytes of the data (for strings, this includes the NULL terminator, and for xml or opaque fields, this is the total number of bytes).

$type = $field->type

Returns the Tibco::Rv::Msg Message Type Constant representing the type of data contained in the field.

$value = $field-><type>

Gets the $value currently held in $field. Dies with a Tibco::Rv::ARG_CONFLICT Status message if <type> does not match the type of data currently held by $field.

$field-><type>( $value )
<type> can be:
   bool, str, opaque, xml,
   f32, f64, i8, i16, i32, i64, u8, u16, u32, u64,
   ipaddr32, ipport16, date, or msg

Sets the value of $field to $value, changing $field to type <type> if it is not already.

$valueAryRef = $field-><type>array

Same as <type>, except it returns an array reference of values.

$field-><type>array( [ $val1, $val2, ... ] )
<type> can be:
   f32, f64, i8, i16, i32, i64, u8, u16, u32, u64

Some as <type>, except it must be given an array reference of values.

AUTHOR

Paul Sturm <sturm@branewave.com>