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.IElementis 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
HashTablefunction block.SimpleLinkedListExample
Shows how to use the
LinkedListfunction block. TheLinkedListfunction block does not have index access and can be extended dynamically.SimpleListExample
Shows how to use the
Listfunction block. TheListfunction block has methods with index access to the following elements:GetElementAt,InsertElementAt,RemoveElementAt, andSetElementAt.SimpleQueueExample
Shows how to use
Queuefunction block. TheQueuefunction block works according to the FIFO principle (first in, first out).SimpleSortedListExample
Shows how to use the
SortedListfunction block. The elements of aSortedListare sorted by theElementCompareTomethod ofIElement.SimpleStackExample
Shows how to use the
Stackfunction block. TheStackfunction block works according to the LIFO principle (last in, first out).SimpleTreeNodeExample
Shows how to use the
TreeNodefunction block. You can use theTreeNodefunction block to build tree structures.DynamicListExample
Shows how to use the
ListFactoryfunction block. You can use theListFactoryfunction 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, andTreeNodeFactorywork 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