Руслан Урядинский / libuavcan

Dependents:   UAVCAN UAVCAN_Subscriber

Embed: (wiki syntax)

« Back to documentation index

LinkedListRoot< T > Class Template Reference

LinkedListRoot< T > Class Template Reference

Linked list root. More...

#include <linked_list.hpp>

Inherits uavcan::Noncopyable.

Public Member Functions

unsigned getLength () const
 Complexity: O(N)
void insert (T *node)
 Inserts the node to the beginning of the list.
template<typename Predicate >
void insertBefore (T *node, Predicate predicate)
 Inserts the node immediately before the node X where predicate(X) returns true.
void remove (const T *node)
 Removes only the first occurence of the node.

Detailed Description

template<typename T>
class uavcan::LinkedListRoot< T >

Linked list root.

Definition at line 44 of file linked_list.hpp.


Member Function Documentation

unsigned getLength (  ) const

Complexity: O(N)

Definition at line 89 of file linked_list.hpp.

void insert ( T *  node )

Inserts the node to the beginning of the list.

If the node is already present in the list, it will be relocated to the beginning. Complexity: O(N)

Definition at line 102 of file linked_list.hpp.

void insertBefore ( T *  node,
Predicate  predicate 
)

Inserts the node immediately before the node X where predicate(X) returns true.

If the node is already present in the list, it can be relocated to a new position. Complexity: O(2N) (calls remove())

Definition at line 116 of file linked_list.hpp.

void remove ( const T *  node )

Removes only the first occurence of the node.

Complexity: O(N)

Definition at line 148 of file linked_list.hpp.