prt_api_unload_regionlist

Name

prt_api_unload_regionlist

Purpose

Unload list of tracking region data.

Description

This routine provides a mechanism to unload the list of Tracking Regions obtained through the prt_api_req_regionlist routine.  If the request is a success the calling routine will receive back an array populated with the Tracking Region Data.  This array contains a pointer to another array (allocated by the application interface routine) which contains an element for each type of item in the region and the total number of items of that type in the region.  The caller is responsible for de-allocating the PRT_ITEM_COUNTS array when it is no longer needed.  If the request fails, the calling routine will receive back status information on the reason for the failure.

Syntax

int prt_api_unload_regionlist (list_size, region_list, retstat)

COR_I4             list_size;

PRT_REGION_STRUCT  region_list[list_size];

COR_STATUS         *retstat;

Data Structures

typedef struct {

  COR_I4 item_type_count - number of items of that type in region

  char   item_type_id[PRT_ITEM_TYPE_ID_LEN] - item type identifier

} PRT_ITEM_COUNTS;

typedef struct {

  char   region_id[PRT_REGION_ID_LEN + 1] - unique identifier

                                            of tracking region.

  COR_U4 region_status - region status.

  COR_I4 total_items - total number of items in region

  COR_I2 region_cap - number of item carriers in region

  char   stat_ptid[POINT_ID_LEN + 1] - status point identifier

  char   item_qty_ptid[POINT_ID_LEN + 1] - item quantity point id

  COR_I2 total_item_counts - tells how many PRT_ITEM_COUNTS

                             elements are in the array pointed

                             to by type_totals.

  PRT_ITEM_COUNTS *type_totals - pointer to array of PRT_ITEM_COUNTS

                                 structures (array must be

                                 deallocated by the user)

} PRT_REGION_STRUCT, *PRT_REGION_STRUCT_PTR;

Arguments

Argument

Description

Input

 

list_size

Number of array elements allocated for region_list array (required)

region_list

Pointer to a buffer to receive tracking region data (required)

Output

 

region_list

Populated array of Tracking Region Data

*retstat

pointer to COR_STATUS structure

Return Value

Either COR_SUCCESS, COR_WARNING or COR_FAILURE.  

If the function returns COR_WARNING or COR_FAILURE, additional error information can be found in the COR_STATUS structure.

Error Codes

PRTI_TOO_MANY_REQ

Total number in list less than number requested  (Warning)

The following code example shows how to de-allocate the user memory:

PRT_REGION_STRUCT region_struct, *region_struct_ptr;

COR_STATUS retstat;

if (prt_api_unload_regionlist (1, &region_struct, &retstat) == COR_SUCCESS)

{

  egion_struct_ptr = &region_struct;

  /* Deallocate PRT_ITEM_COUNTS structure */

  if ( region_struct_ptr->total_item_counts > 0 )

  {

    cor_mfree ( region_struct_ptr->type_totals, 0 );

  }

}

More information

Application subroutines.