Lib Sub-System: List |
01 | Nearly every component that manages more than one object simultaneously needs to arrange them somehow. Using arrays would be one option, but if the objects come and go without any specific order, things become complicated. |
02 | Using double linked lists is the best solution for managing any arbitrary list of data structures. ("Best solution" has to be understood according to the applications within the Semys Library.) |
03 | The design behind the Semys list system is based on the assumption that the objects that need to be stored are all structures. The List Sub-System defines a small structure ListEntry that acts both as entry point for the list and as link for the object to be added. |
04 | Structures that need to be added into a list need to have the ListEntry as their first member. This furthermore limits that a listed structure can be primarily in only one list at a time. |
05 | Since there are a few scenarios where a listed object needs to be in another list as well, an additional helper structure has been defined: SemysAnyReference |
06 |
Usage of this sub-system is meant to be only within the Semys Library. Higher languages have more convenient container classes. |
07 | Structures: |
08 | Functions: | As the Semys Library uses lists nearly everywhere, these functions don't have the common 'Semys' prefix - lazy programmer that I am. |
09 | Note that the list functions are either defines or inline functions because of their simplicity and performance requirements. |
10 |
Reference: SemysList.h Implementation: Semys Library |
Goto: Main Page; This page is part of the Semys software documentation. See About: Documentation for details. |