Transformer SDK For C  8.0.2.290852-a608fcd3
Manipulation of a ds_data_t

Functions

ds_data_tpacket_clone (ds_data_t *pkt)
 Duplicate a DataSource packet. More...
 
int packet_delete_field (ds_data_t *pkt, int index)
 Remove a field in a dsdata. More...
 
char * packet_get_field (ds_data_t *pkt, int fieldnum)
 Find a field within a packet. More...
 
char * packet_get_field_byname (ds_data_t *pkt, const char *field)
 Find a field within a packet. More...
 
int packet_merge (ds_data_t *pkt2, ds_data_t *pkt, int *newnum)
 Merge the contents of one packet into the other. More...
 
int packet_update (ds_data_t *pkt2, ds_data_t *pkt)
 Update the contents of one packet based on the contents of the other. More...
 
int packet_update_field (ds_data_t *pkt, int fieldnum, const char *value)
 Update a field within a packet. More...
 
int packet_update_field_byname (ds_data_t *pkt, const char *field, const char *value)
 Update a field within a packet by name. More...
 

Detailed Description

After an update has been received by a module, it is useful to be able to inspect the contents of the dsdata_t that is contains the update.

Rather than directly manipulate the contents of the structure directly, the Transformer provides a number of functions that can perform this manipulating. This provides a level of abstraction from the internal representation of a ds_data_t which may be subject to change.

Function Documentation

ds_data_t* packet_clone ( ds_data_t pkt)

Duplicate a DataSource packet.

Parameters
pkt- Packet to be duplicated
Returns
A copy of the input packet
int packet_delete_field ( ds_data_t pkt,
int  index 
)

Remove a field in a dsdata.

The index should be in the range 0 ... pkt->count

Parameters
pkt- Packet to have the field removed
index- Index to remove
Return values
0- Field was not removed (this can occur if index was invalid)
1- Field was removed
char* packet_get_field ( ds_data_t pkt,
int  fieldnum 
)

Find a field within a packet.

The return value of this function should not be freed.

Parameters
pkt- Packet to search
fieldnum- Fieldnumber of the field to find
Returns
Ptr to value held in the field, or NULL if not found
Note
For a container objects, the fieldnumber is interpreted as being an index into the the constituent list.
char* packet_get_field_byname ( ds_data_t pkt,
const char *  field 
)

Find a field within a packet.

The return value of this function should not be freed.

Parameters
pkt- Packet to search
field- Name of the field to find
Returns
Ptr to value held in the field, or NULL if not found
int packet_merge ( ds_data_t pkt2,
ds_data_t pkt,
int *  newnum 
)

Merge the contents of one packet into the other.

Parameters
pkt2The packet to take the merged data
pktPacket for the new data to come from
newnumPointer to store the number of new fields in
Returns
Number of updated fields
int packet_update ( ds_data_t pkt2,
ds_data_t pkt 
)

Update the contents of one packet based on the contents of the other.

Parameters
pkt2- Packet to update
pkt- Packet to take updated field values from
Returns
Number of updated fields
int packet_update_field ( ds_data_t pkt,
int  fieldnum,
const char *  value 
)

Update a field within a packet.

If the field doesn't exist then it will be added to the supplied packet

Parameters
pkt- Packet to update field within
fieldnum- Fieldnumber to update
value- Value to update
Return values
0- Added new field
1- Updated field
int packet_update_field_byname ( ds_data_t pkt,
const char *  field,
const char *  value 
)

Update a field within a packet by name.

If the field doesn't exist then it will be added to the supplied packet

Parameters
pkt- Packet to update field within
field- Fieldname to update
value- Value to update
Return values
-1- Unknown fieldname
0- Added new field
1- Updated field

Generated on Wed Jul 31 2024 18:00:14 for Transformer SDK For C