[r920]: / branches / develop / mqttsparkplug / mqttsparkplug / Sparkplug™ MQTT edge and host / Function Blocks / FB_Payload_1 / FB_Payload / Pool / ClaimNextFreeColumn / svnobj  Maximize  Restore  History

Download this file

18 lines (17 with data), 3.5 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
//Try and get an Object from the existing pool
ColumnsPool.ItterateNext( itfElement => _COL_Element,
                          HasNext => );
IF _COL_Element <> 0 THEN
    IF __QUERYPOINTER( _COL_Element,
                         pObject ) THEN
        ClaimNextFreeColumn REF= pObject^;
        ClaimNextFreeColumn.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
		ColumnsPool.AppendElem(itfElement := ClaimNextFreeColumn);
		ColumnsPool.ItterateNext();
END_IF