TSDuck v3.40-4033
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::RingNode Class Reference

Base class for objects being part of a ring, ie. More...

#include <tsRingNode.h>

Inheritance diagram for ts::RingNode:

Public Member Functions

 RingNode ()=default
 Default constructor.
 
virtual ~RingNode ()
 Destructor.
 
bool ringAlone () const
 Check if the node is alone in its own ring.
 
void ringInsertAfter (RingNode *o)
 Insert this object in a ring after the specified node.
 
void ringInsertBefore (RingNode *o)
 Insert this object in a ring before the specified node.
 
template<typename T >
T * ringNext ()
 Get the next node in the ring.
 
template<typename T >
const T * ringNext () const
 Get the next node in the ring.
 
template<typename T >
T * ringPrevious ()
 Get the previous node in the ring.
 
template<typename T >
const T * ringPrevious () const
 Get the previous node in the ring.
 
void ringRemove ()
 Remove the node from the ring it belongs to and creates its own ring.
 
size_t ringSize () const
 Count the number of element in the ring.
 
void ringSwap (RingNode *o)
 Swap this object and another one in their rings.
 

Detailed Description

Base class for objects being part of a ring, ie.

a double-linked list with no begin or end.

This class is not thread-safe. Access to all objects which are part of the same ring shall be synchronized.

Member Function Documentation

◆ ringAlone()

bool ts::RingNode::ringAlone ( ) const
inline

Check if the node is alone in its own ring.

Returns
True if the node is alone in its own ring.

◆ ringInsertAfter()

void ts::RingNode::ringInsertAfter ( RingNode o)

Insert this object in a ring after the specified node.

Parameters
[in]oA node of a ring. This object is inserted after o in the ring.

◆ ringInsertBefore()

void ts::RingNode::ringInsertBefore ( RingNode o)

Insert this object in a ring before the specified node.

Parameters
[in]oA node of a ring. This object is inserted before o in the ring.

◆ ringSwap()

void ts::RingNode::ringSwap ( RingNode o)

Swap this object and another one in their rings.

If the two objects belong to the same ring, their positions are swapped. If they belong to distinct rings, they also move to each other's ring.

Parameters
[in]oThe node to swap with.

◆ ringNext() [1/2]

template<typename T >
T * ts::RingNode::ringNext ( )
inline

Get the next node in the ring.

Template Parameters
TA superclass of RingNode, the expected type of the next object in the ring.
Returns
Address of the next node in the ring or zero if the next node is not a subclass of T.

◆ ringNext() [2/2]

template<typename T >
const T * ts::RingNode::ringNext ( ) const
inline

Get the next node in the ring.

Template Parameters
TA superclass of RingNode, the expected type of the next object in the ring.
Returns
Address of the next node in the ring or zero if the next node is not a subclass of T.

◆ ringPrevious() [1/2]

template<typename T >
T * ts::RingNode::ringPrevious ( )
inline

Get the previous node in the ring.

Template Parameters
TA superclass of RingNode, the expected type of the previous object in the ring.
Returns
Address of the previous node in the ring or zero if the previous node is not a subclass of T.

◆ ringPrevious() [2/2]

template<typename T >
const T * ts::RingNode::ringPrevious ( ) const
inline

Get the previous node in the ring.

Template Parameters
TA superclass of RingNode, the expected type of the previous object in the ring.
Returns
Address of the previous node in the ring or zero if the previous node is not a subclass of T.

◆ ringSize()

size_t ts::RingNode::ringSize ( ) const

Count the number of element in the ring.

Warning: This method has a linear response time, avoid using it when possible.

Returns
The number of nodes in the ring.

The documentation for this class was generated from the following file: