Example: Element Collections
Product: CODESYS Base Libraries
The CODESYS library Element Collections
contains function blocks for lists, queues, stacks, and hash tables. The elements of Collections
are instances of function blocks of type IElement
. The Element Collections Examples
sample project shows how to use individual function blocks.
Description
The sample project includes the following applications:
ElementExample
Shows the creation of instances of type
IElement
.IElement
is the basic interface for all elements of this collection.OnlineChangeSafeLinkedListExample
Shows linked lists which are protected from online change.
SimpleHashTableExample
Shows how to use the
HashTable
function block.SimpleLinkedListExample
Shows how to use the
LinkedList
function block. TheLinkedList
function block does not have index access and can be extended dynamically.SimpleListExample
Shows how to use the
List
function block. TheList
function block has methods with index access to the following elements:GetElementAt
,InsertElementAt
,RemoveElementAt
, andSetElementAt
.SimpleQueueExample
Shows how to use
Queue
function block. TheQueue
function block works according to the FIFO principle (first in, first out).SimpleSortedListExample
Shows how to use the
SortedList
function block. The elements of aSortedList
are sorted by theElementCompareTo
method ofIElement
.SimpleStackExample
Shows how to use the
Stack
function block. TheStack
function block works according to the LIFO principle (last in, first out).SimpleTreeNodeExample
Shows how to use the
TreeNode
function block. You can use theTreeNode
function block to build tree structures.DynamicListExample
Shows how to use the
ListFactory
function block. You can use theListFactory
function block to create lists at runtime. These lists can be parameterized with a fixed size and also with an initial size with growth factor. The example demonstrates the general handling of a collection factory. TheQueueFactory
,SortedListFactory
,StackFactory
, andTreeNodeFactory
work according to the same pattern.
System requirements and restrictions
Programming system | CODESYS Development System (version 3.5.14.0 or higher) |
Runtime system | CODESYS Control Win (version 3.5.14.0) |
Add-on components | - |
Note
DOWNLOAD Project