Skip to content

Commit

Permalink
Created build 1.0.4.24
Browse files Browse the repository at this point in the history
+ Created I_Iterable interface that provides structure and improved safety for iterable data structures.
  • Loading branch information
fisothemes committed Mar 24, 2024
1 parent 152dd76 commit 3f54fd4
Show file tree
Hide file tree
Showing 14 changed files with 210 additions and 8 deletions.
Binary file added builds/1.0.4.24/TcDynCollections.library
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@
<Declaration><![CDATA[// Interface for a static array.
INTERFACE I_Array EXTENDS I_Collection
]]></Declaration>
<Property Name="_Begin" Id="{cd5ae7e8-0cb7-0227-358a-d6072233549a}">
<Declaration><![CDATA[// Index of the first element.
PROPERTY _Begin : T_Position]]></Declaration>
<Get Name="Get" Id="{c2a94db4-c1cc-0b8a-20c5-0c959a425973}">
<Declaration><![CDATA[]]></Declaration>
</Get>
</Property>
<Property Name="_End" Id="{4e4643cf-8bc4-0705-1a2f-f19d620401fe}">
<Declaration><![CDATA[// Index of the last element.
PROPERTY _End : T_Position]]></Declaration>
<Get Name="Get" Id="{1f4763b3-dbe2-094c-0851-740b18c0c6ee}">
<Declaration><![CDATA[]]></Declaration>
</Get>
</Property>
<Method Name="Contains" Id="{b8832831-361b-0743-2d41-3ef7680718ad}">
<Declaration><![CDATA[// Checks if item is contained in array.
METHOD Contains : BOOL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@
<Declaration><![CDATA[// Interface for a list.
INTERFACE I_List EXTENDS I_Collection
]]></Declaration>
<Property Name="_Begin" Id="{7481a6d8-072c-09fd-220e-703bd3bd918e}">
<Declaration><![CDATA[// Index of the first element.
PROPERTY _Begin : T_Position]]></Declaration>
<Get Name="Get" Id="{e1cab879-f7e3-0325-02aa-372e98c56413}">
<Declaration><![CDATA[]]></Declaration>
</Get>
</Property>
<Property Name="_End" Id="{934e0946-8f08-056a-32bf-441d38883175}">
<Declaration><![CDATA[// Index of the last element.
PROPERTY _End : T_Position]]></Declaration>
<Get Name="Get" Id="{8cf8a269-af83-0f4d-316f-6ad786052675}">
<Declaration><![CDATA[]]></Declaration>
</Get>
</Property>
<Method Name="Append" Id="{b5545aee-8b95-0f2c-2b82-71ec520c8f46}">
<Declaration><![CDATA[// Adds an item to the end of the list.
METHOD Append : I_List
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@
<Declaration><![CDATA[// Interface for an immutable array.
INTERFACE I_Immutable_Array EXTENDS I_Immutable_Collection
]]></Declaration>
<Property Name="_Begin" Id="{a7e11838-6892-0b0c-2d28-a4ae0b84eb3b}">
<Declaration><![CDATA[// Index of the first element.
PROPERTY _Begin : T_Position]]></Declaration>
<Get Name="Get" Id="{a0311419-27b3-07c4-083f-e9d11c345028}">
<Declaration><![CDATA[]]></Declaration>
</Get>
</Property>
<Property Name="_End" Id="{a8c7bc32-11d4-05dc-1f7d-868df4f363c7}">
<Declaration><![CDATA[// Index of the last element.
PROPERTY _End : T_Position]]></Declaration>
<Get Name="Get" Id="{2d1ca9be-bc2e-0e9f-2610-cf8852127dbc}">
<Declaration><![CDATA[]]></Declaration>
</Get>
</Property>
<Method Name="Contains" Id="{7972bd38-585d-001c-1f22-1332255bb95f}">
<Declaration><![CDATA[// Checks if item is contained in array.
METHOD Contains : BOOL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@
<Declaration><![CDATA[// Interface for an immutable list.
INTERFACE I_Immutable_List EXTENDS I_Immutable_Collection
]]></Declaration>
<Property Name="_Begin" Id="{aaeeb2e1-b285-0c5f-0dbc-d5df781571a3}">
<Declaration><![CDATA[// Index of the first element.
PROPERTY _Begin : T_Position]]></Declaration>
<Get Name="Get" Id="{4e2297ff-c645-02b4-34b4-cd9ea55198db}">
<Declaration><![CDATA[]]></Declaration>
</Get>
</Property>
<Property Name="_End" Id="{844b8ef7-b517-049c-3c35-e43ade0f7a40}">
<Declaration><![CDATA[// Index of the last element.
PROPERTY _End : T_Position]]></Declaration>
<Get Name="Get" Id="{a2186c43-6bee-0611-1757-9fa4c7c83090}">
<Declaration><![CDATA[]]></Declaration>
</Get>
</Property>
<Method Name="Contains" Id="{6b004137-d7bc-04e1-0420-33618d82fb2e}">
<Declaration><![CDATA[(* Checks if item is contained in list *)
METHOD Contains : BOOL
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1">
<Itf Name="I_Iterable" Id="{1bb73574-f693-03e6-321d-522590609df2}">
<Declaration><![CDATA[// Interface that defines the standard structure for indexable collections
INTERFACE I_Iterable EXTENDS __SYSTEM.IQueryInterface
]]></Declaration>
<Property Name="_Begin" Id="{73321905-0f2e-0407-00aa-91048e6eff82}">
<Declaration><![CDATA[// Index of the first element.
PROPERTY _Begin : T_Position]]></Declaration>
<Get Name="Get" Id="{8d8c254e-4b6e-0859-2854-cb761631fcfe}">
<Declaration><![CDATA[]]></Declaration>
</Get>
</Property>
<Property Name="_End" Id="{fd9a7466-3c98-02f5-23f1-a7caf2aecf29}">
<Declaration><![CDATA[// Index of the last element.
PROPERTY _End : T_Position]]></Declaration>
<Get Name="Get" Id="{0fcaa15c-f86d-066b-2610-50d35d581457}">
<Declaration><![CDATA[]]></Declaration>
</Get>
</Property>
</Itf>
</TcPlcObject>
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,37 @@
{attribute 'enable_dynamic_creation'}
{attribute 'no_assign'}
{attribute 'no_explicit_call' := 'direct call for this function block is not allowed'}
FUNCTION_BLOCK FB_Array EXTENDS FB_Collection IMPLEMENTS I_Array //, I_Enumerable, I_Copyable
FUNCTION_BLOCK FB_Array EXTENDS FB_Collection IMPLEMENTS I_Array, I_Iterable //, I_Enumerable, I_Copyable
VAR
pBuffer : POINTER TO T_Generic;
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
<Property Name="_Begin" Id="{b74e99db-b2fb-0bb1-33b0-cf7c6b963f96}">
<Declaration><![CDATA[// Index of the first element.
PROPERTY _Begin : T_Position]]></Declaration>
<Get Name="Get" Id="{f27e093b-17aa-05d9-0f2b-e8c25acd7a12}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[_Begin := 0;]]></ST>
</Implementation>
</Get>
</Property>
<Property Name="_End" Id="{25a9ea61-542c-0d22-3c33-302131a27727}">
<Declaration><![CDATA[// Index of the last element.
PROPERTY _End : T_Position]]></Declaration>
<Get Name="Get" Id="{1dd98d53-87e8-06dc-2805-a629f5cba32f}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[_End := TO_DINT(THIS^._Count) - 1;]]></ST>
</Implementation>
</Get>
</Property>
<Method Name="Contains" Id="{335eaf07-5e94-0c80-1cbd-38a03a0ac891}">
<Declaration><![CDATA[// Checks if item is contained in array.
METHOD Contains : BOOL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,26 @@
{attribute 'enable_dynamic_creation'}
{attribute 'no_assign'}
{attribute 'no_explicit_call' := 'direct call for this function block is not allowed'}
FUNCTION_BLOCK FB_Array_List EXTENDS FB_Collection IMPLEMENTS I_Array_List//, I_Enumerable, I_Copyable
FUNCTION_BLOCK FB_Array_List EXTENDS FB_Collection IMPLEMENTS I_Array_List, I_Iterable//, I_Enumerable, I_Copyable
VAR
pBuffer : POINTER TO T_Generic;
Capacity : T_Capacity;
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
<Property Name="_Begin" Id="{452a98be-81b3-0838-3a57-5198d1bcb8df}">
<Declaration><![CDATA[// Index of the first element.
PROPERTY _Begin : T_Position]]></Declaration>
<Get Name="Get" Id="{8ed92476-1c39-020f-008a-ff1d5b797763}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[_Begin := 0;]]></ST>
</Implementation>
</Get>
</Property>
<Property Name="_Capacity" Id="{b2e77887-a303-0a7c-32b2-2dc7214f6a40}">
<Declaration><![CDATA[// Size of the storage space currently allocated for the array list.
PROPERTY FINAL _Capacity : T_Capacity]]></Declaration>
Expand All @@ -34,6 +46,18 @@ END_VAR
</Implementation>
</Set>
</Property>
<Property Name="_End" Id="{4c9c0f03-0ce1-0f71-19a3-33908ab076c6}">
<Declaration><![CDATA[// Index of the last element.
PROPERTY _End : T_Position]]></Declaration>
<Get Name="Get" Id="{c9db604c-1be0-0620-1dab-46a056ac279f}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[_End := TO_DINT(THIS^._Count) - 1;]]></ST>
</Implementation>
</Get>
</Property>
<Method Name="Append" Id="{e00fa025-7623-0844-0d20-c53ad23cd352}">
<Declaration><![CDATA[// Adds an item to the end of the list.
METHOD Append : I_List
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{attribute 'enable_dynamic_creation'}
{attribute 'no_assign'}
{attribute 'no_explicit_call' := 'direct call for this function block is not allowed'}
FUNCTION_BLOCK FB_List EXTENDS FB_Collection IMPLEMENTS I_List//, I_Enumerable, I_Copyable
FUNCTION_BLOCK FB_List EXTENDS FB_Collection IMPLEMENTS I_List, I_Iterable//, I_Enumerable, I_Copyable
VAR
pHead, pTail, pLast_Accessed : POINTER TO T_List_Node;
Last_Accessed_Index : T_Position := -1;
Expand All @@ -17,6 +17,30 @@ END_VAR]]></Declaration>
<ST><![CDATA[]]></ST>
</Implementation>
<Folder Name="Internal" Id="{f1a4dbb5-4494-000f-0ffb-7997f7a89e00}" />
<Property Name="_Begin" Id="{5f751032-f278-0e1e-34da-a4632387a180}">
<Declaration><![CDATA[// Index of the first element.
PROPERTY _Begin : T_Position]]></Declaration>
<Get Name="Get" Id="{92fc758e-8e68-0222-097a-e691af09a58a}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[_Begin := 0;]]></ST>
</Implementation>
</Get>
</Property>
<Property Name="_End" Id="{5f8b204e-79fd-0600-23cc-a0e702090fe5}">
<Declaration><![CDATA[// Index of the last element.
PROPERTY _End : T_Position]]></Declaration>
<Get Name="Get" Id="{46f26b88-ae3e-0d05-11fe-a680d5f69cc7}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[_End := TO_DINT(THIS^._Count) - 1;]]></ST>
</Implementation>
</Get>
</Property>
<Method Name="Append" Id="{4fc84931-a6ae-08e7-36de-592518bdadd3}">
<Declaration><![CDATA[// Adds an item to the end of the list.
METHOD Append : I_List
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<POU Name="FB_Immutable_Array" Id="{73f571b4-60ce-0a01-0a00-4968c563837d}" SpecialFunc="None">
<Declaration><![CDATA[// Collection that exposes only immutable methods and properties of a collection that implements I_Array.
{attribute 'enable_dynamic_creation'}
FUNCTION_BLOCK FB_Immutable_Array IMPLEMENTS I_Immutable_Array
FUNCTION_BLOCK FB_Immutable_Array IMPLEMENTS I_Immutable_Array, I_Iterable
VAR_INPUT
ipArray : I_Array;
END_VAR
Expand All @@ -12,6 +12,18 @@ END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
<Property Name="_Begin" Id="{6d6a04fe-08b3-0371-2da5-5214a59b1a0b}">
<Declaration><![CDATA[// Index of the first element.
PROPERTY _Begin : T_Position]]></Declaration>
<Get Name="Get" Id="{fd4518a9-0c36-0c12-2fd3-231911788de3}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[_Begin := 0;]]></ST>
</Implementation>
</Get>
</Property>
<Property Name="_Count" Id="{30f84f30-18a4-0cc7-1a47-0d61a5ae06d0}">
<Declaration><![CDATA[// Number of items in the collection.
PROPERTY _Count : T_Capacity]]></Declaration>
Expand All @@ -38,6 +50,18 @@ _Empty := THIS^.ipArray._Empty;]]></ST>
</Implementation>
</Get>
</Property>
<Property Name="_End" Id="{ac9b80f1-d2ea-02e0-13ff-35a97f8ae98a}">
<Declaration><![CDATA[// Index of the last element.
PROPERTY _End : T_Position]]></Declaration>
<Get Name="Get" Id="{74452c24-1636-0024-34d4-ce9d912ccca8}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[_End := TO_DINT(THIS^._Count) - 1;]]></ST>
</Implementation>
</Get>
</Property>
<Property Name="_Error_Status" Id="{2f157328-2a26-00a9-06c6-c955fbb25e32}">
<Declaration><![CDATA[// Error status of the collection.
PROPERTY _Error_Status : T_Error]]></Declaration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<POU Name="FB_Immutable_List" Id="{220e23e9-4352-0626-30cb-dc4b94c4bdc6}" SpecialFunc="None">
<Declaration><![CDATA[// Collection that exposes only immutable methods and properties of a collection that implements I_List.
{attribute 'enable_dynamic_creation'}
FUNCTION_BLOCK FB_Immutable_List IMPLEMENTS I_Immutable_List
FUNCTION_BLOCK FB_Immutable_List IMPLEMENTS I_Immutable_List, I_Iterable
VAR_INPUT
ipList : I_List;
END_VAR
Expand All @@ -12,6 +12,18 @@ END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
<Property Name="_Begin" Id="{92207b48-1c7e-052f-361b-9758d0c8e12d}">
<Declaration><![CDATA[// Index of the first element.
PROPERTY _Begin : T_Position]]></Declaration>
<Get Name="Get" Id="{32205f63-0231-075c-2d59-081222e30b0e}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[_Begin := 0;]]></ST>
</Implementation>
</Get>
</Property>
<Property Name="_Count" Id="{3fde1b6b-a6e6-0058-32dd-40a19f857027}">
<Declaration><![CDATA[// Number of items in the collection.
PROPERTY _Count : T_Capacity]]></Declaration>
Expand Down Expand Up @@ -40,6 +52,18 @@ _Empty := THIS^.ipList._Empty;]]></ST>
</Implementation>
</Get>
</Property>
<Property Name="_End" Id="{768f4f4d-05ee-0069-211d-f8b5b8cd62fe}">
<Declaration><![CDATA[// Index of the last element.
PROPERTY _End : T_Position]]></Declaration>
<Get Name="Get" Id="{c6ab8748-9c3d-05f5-3c6d-fe2bcfcc2b91}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[_End := TO_DINT(THIS^._Count) - 1;]]></ST>
</Implementation>
</Get>
</Property>
<Property Name="_Error_Status" Id="{7ce093dc-ff00-0dd4-1ee4-11602912d52f}">
<Declaration><![CDATA[// Error status of the collection.
PROPERTY _Error_Status : T_Error]]></Declaration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ END_VAR]]></Declaration>
<ST><![CDATA[F_GetVersion.iMajor := 1;
F_GetVersion.iMinor := 0;
F_GetVersion.iBuild := 4;
F_GetVersion.iRevision := 23;
F_GetVersion.iRevision := 24;
]]></ST>
</Implementation>
</POU>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<Title>TwinCat Dynamic Collections</Title>
<Author>Goodwill Mzumala</Author>
<DefaultNamespace>TcDynCollections</DefaultNamespace>
<ProjectVersion>1.0.4.23</ProjectVersion>
<ProjectVersion>1.0.4.24</ProjectVersion>
<DocFormat>reStructuredText</DocFormat>
<Description>A library for handling collections of data dynamically in TwinCAT.</Description>
<CombineIds>true</CombineIds>
Expand Down Expand Up @@ -164,6 +164,9 @@
<Compile Include="ITFs\Enumerators\I_Enumerator.TcIO">
<SubType>Code</SubType>
</Compile>
<Compile Include="ITFs\Iterable\I_Iterable.TcIO">
<SubType>Code</SubType>
</Compile>
<Compile Include="ITFs\Misc\I_Copyable.TcIO">
<SubType>Code</SubType>
</Compile>
Expand Down Expand Up @@ -320,6 +323,7 @@
<Folder Include="ITFs\Collections\Immutable" />
<Folder Include="ITFs\Enumerators" />
<Folder Include="ITFs\Misc" />
<Folder Include="ITFs\Iterable" />
<Folder Include="POUs" />
<Folder Include="POUs\Examples" />
<Folder Include="POUs\Function Blocks" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// This function has been automatically generated from the project information.
VAR_GLOBAL CONSTANT
{attribute 'const_non_replaced'}
stLibVersion_TwinCat_Dynamic_Collections : ST_LibVersion := (iMajor := 1, iMinor := 0, iBuild := 4, iRevision := 23, nFlags := 0, sVersion := '1.0.4.23');
stLibVersion_TwinCat_Dynamic_Collections : ST_LibVersion := (iMajor := 1, iMinor := 0, iBuild := 4, iRevision := 24, nFlags := 0, sVersion := '1.0.4.24');
END_VAR
]]></Declaration>
</GVL>
Expand Down

0 comments on commit 3f54fd4

Please sign in to comment.