Arrays and Buffers

Allocate a Carrier Slot

medium

Stores a part in the first empty carrier slot and reports whether it was accepted.

What it teaches

A storage rack may have holes, so appending to its end is not enough. Search for the first empty position, then claim only that position. A fresh request must search the current rack rather than reuse the previous match.

Parameters

TagDirectionTypeDefaultDescription
In_StoreInputBOOL0Request to store a part
In_PartIdInputDINT101Positive ID to store
Sts_AcceptedOutputBOOL0One-scan successful store indication
Out_IndexOutputDINT0Last requested slot, or -1 on rejection
Ref_SlotsInOutDINT[8]Caller-owned rack: 0 means empty; positive values identify parts

Required behavior