Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Toggle main menu visibility
Loading...
Searching...
No Matches
list_impl.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015 Roc Streaming authors
3
*
4
* This Source Code Form is subject to the terms of the Mozilla Public
5
* License, v. 2.0. If a copy of the MPL was not distributed with this
6
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
*/
8
9
//! @file roc_core/list_impl.h
10
//! @brief Intrusive doubly-linked list implementation.
11
12
#ifndef ROC_CORE_LIST_IMPL_H_
13
#define ROC_CORE_LIST_IMPL_H_
14
15
#include "
roc_core/list_node.h
"
16
#include "
roc_core/noncopyable.h
"
17
#include "
roc_core/stddefs.h
"
18
19
namespace
roc
{
20
namespace
core
{
21
22
//! Intrusive doubly-linked list implementation class.
23
//! Handles List infrastructure independent of templated type for List.
24
//! Ownership handling is left to the main List class.
25
class
ListImpl :
public
NonCopyable<> {
26
public
:
27
ListImpl();
28
~ListImpl();
29
30
//! Get number of nodes in list.
31
size_t
size
()
const
;
32
33
//! Check if node belongs to list.
34
bool
contains
(
const
ListData
*
node
)
const
;
35
36
//! Get list head (non-node node).
37
ListData
*
head
();
38
39
//! Get first list node.
40
ListData
*
front
()
const
;
41
42
//! Get last list node.
43
ListData
*
back
()
const
;
44
45
//! Get list node next to given one.
46
ListData
*
nextof
(
ListData
*
node
)
const
;
47
48
//! Get list node previous to given one.
49
ListData
*
prevof
(
ListData
*
node
)
const
;
50
51
//! Remove first node and return.
52
ListData
*
pop_front
();
53
54
//! Remove last node and return.
55
ListData
*
pop_back
();
56
57
//! Insert node into list.
58
void
insert
(
ListData
*
node
,
ListData
* before);
59
60
//! Remove node from list.
61
void
remove
(
ListData
*
node
);
62
63
private
:
64
static
void
check_is_member_(
const
ListData
*
node
,
const
ListImpl* list);
65
66
ListData
head_;
67
size_t
size_;
68
};
69
70
}
// namespace core
71
}
// namespace roc
72
73
#endif
// ROC_CORE_LIST_IMPL_H_
roc::core::ListImpl::nextof
ListData * nextof(ListData *node) const
Get list node next to given one.
roc::core::ListImpl::pop_back
ListData * pop_back()
Remove last node and return.
roc::core::ListImpl::head
ListData * head()
Get list head (non-node node).
roc::core::ListImpl::back
ListData * back() const
Get last list node.
roc::core::ListImpl::remove
void remove(ListData *node)
Remove node from list.
roc::core::ListImpl::front
ListData * front() const
Get first list node.
roc::core::ListImpl::insert
void insert(ListData *node, ListData *before)
Insert node into list.
roc::core::ListImpl::contains
bool contains(const ListData *node) const
Check if node belongs to list.
roc::core::ListImpl::prevof
ListData * prevof(ListData *node) const
Get list node previous to given one.
roc::core::ListImpl::pop_front
ListData * pop_front()
Remove first node and return.
roc::core::ListImpl::size
size_t size() const
Get number of nodes in list.
list_node.h
Linked list node.
roc::core
General-purpose building blocks and platform abstraction layer.
roc::node
High-level sender and receiver nodes.
roc
Root namespace.
noncopyable.h
Non-copyable object.
stddefs.h
Commonly used types and functions.
roc::core::ListData
List node internal data.
Definition
list_node.h:24
roc_core
list_impl.h
Generated by
1.17.0