|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Singly linked list base class. More...
Go to the source code of this file.
Classes | |
| class | Aleph::Slink |
| Singly linked handle to list nodes. More... | |
Namespaces | |
| namespace | Aleph |
| Main namespace for Aleph-w library functions. | |
Macros | |
| #define | SLINK_TO_TYPE(type_name, link_name) |
| Generate a conversion function from the link name to the enclosing structure. | |
Singly linked list base class.
Low-level singly linked node without data. Base for Snode.
Definition in file slink.H.
| #define SLINK_TO_TYPE | ( | type_name, | |
| link_name | |||
| ) |
Generate a conversion function from the link name to the enclosing structure.
The function name is literally the parameter provided as link_name.
This macro is useful whenever a structure stores two or more Slink members and we need to retrieve the owning structure from a given link pointer.
For example: struct Registro { ... Slink l1; Slink l2; ... };
Then SLINK_TO_TYPE(Registro, l1) and SLINK_TO_TYPE(Registro, l2) produce the following functions:
Registro * l1_to_type(Slink * link), which receives a pointer to the field l1 and returns the pointer to the owning record.Registro * l2_to_type(Slink * link), which receives a pointer to the field l2 and returns the pointer to the owning record.The goal is to have naming schemes that allow distinguishing the different link fields.
| type_name | type of the enclosing structure (struct or class) |
| link_name | name of the link field inside the structure |