OS  v1.7.5
Documentation
Loading...
Searching...
No Matches
Generic double-linked lists

The provided list implementation uses a generic doubly-linked approach in which each node, apart from storing its data, has two link pointers. The first link points to the previous node in the list and the second link, points to the next node in the list. The first node of the list has its previous link pointing to nullptr, similarly, the last node of the list has its next node pointing to nullptr. More...

Collaboration diagram for Generic double-linked lists:

Classes

class  qOS::node
 A list-node object (Used internally) More...
 
class  qOS::list
 A list object (Generic double-linked) More...
 
class  qOS::listIterator
 A list iterator. More...
 

Typedefs

using qOS::listCompareFcn_t
 Pointer to a function used by the list::sort() method to compare nodes of a list.
 

Enumerations

enum  qOS::listPosition : int32_t { qOS::AT_FRONT , qOS::AT_BACK }
 An enum with the possible options to specify a target position for a list. More...
 
enum class  qOS::listDirection { qOS::listDirection::FORWARD , qOS::listDirection::BACKWARD }
 An enum with the possible options to transverse a list. More...
 

Detailed Description

The provided list implementation uses a generic doubly-linked approach in which each node, apart from storing its data, has two link pointers. The first link points to the previous node in the list and the second link, points to the next node in the list. The first node of the list has its previous link pointing to nullptr, similarly, the last node of the list has its next node pointing to nullptr.

The list data-structure, referenced through an object of type qList_t also has a head and a tail pointer, to allow fast operations on boundary nodes.

qlist
Doubly-linked list implementation

Nodes should be an user-defined class inherited fromt he node class

class mynode : public node {
int a;
int b;
float y;
};

Typedef Documentation

◆ listCompareFcn_t

Pointer to a function used by the list::sort() method to compare nodes of a list.

Example :

bool myNode_CompareFcn( const void *n1, const void *n2 ) {
mydata_t *node1 = (mydata_t *)n1;
mydata_t *node2 = (mydata_t *)n2;
return ( node1->x > node2->x );
}
Parameters
[in]hThe handler object containing the objects being compared.
Returns
true value indicates that element pointed by node1 goes after the element pointed to by node2

Enumeration Type Documentation

◆ listDirection

enum class qOS::listDirection
strong

An enum with the possible options to transverse a list.

Enumerator
FORWARD 
BACKWARD 

◆ listPosition

enum qOS::listPosition : int32_t

An enum with the possible options to specify a target position for a list.

Enumerator
AT_FRONT 
AT_BACK