1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | METHOD ClaimNextFreeKey : REFERENCE TO LinkedListWStringElement VAR_OUTPUT eError : ERROR; END_VAR VAR //Try and get an Object from the existing pool KeysPool.ItterateNext( itfElement => _COL_Element, HasNext => ); IF _COL_Element <> 0 THEN IF __QUERYPOINTER( _COL_Element, pObject ) THEN ClaimNextFreeKey REF= pObject^; ClaimNextFreeKey.WStringValue := ""; ELSE eError := ERROR.PayloadNotACollectionOfStorage; END_IF ELSE //No free object? No worries, we will just create one //Better add it to the Pool and "itterate" it, so future generations of payload can use it KeysPool.AppendElem(itfElement := ClaimNextFreeKey); KeysPool.ItterateNext(); END_IF |