MCPcopy Create free account
hub / github.com/FastLED/FastLED / list

Class list

src/fl/stl/list.h:21–671  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19/// @tparam T The type of elements stored in the list
20template <typename T>
21class list {
22private:
23 struct Node {
24 T data;
25 Node* next;
26 Node* prev;
27
28 template<typename... Args>
29 Node(Args&&... args) : data(fl::forward<Args>(args)...), next(nullptr), prev(nullptr) {}
30 };
31
32 Node* mHead; // Sentinel node (circular list)
33 fl::size mSize;
34 memory_resource* mResource = default_memory_resource();
35
36 void init_sentinel() {
37 mHead = static_cast<Node*>(mResource->allocate(sizeof(Node)));
38 mHead->next = mHead;
39 mHead->prev = mHead;
40 mSize = 0;
41 }
42
43 void destroy_sentinel() {
44 if (mHead) {
45 mResource->deallocate(mHead, sizeof(Node));
46 mHead = nullptr;
47 }
48 }
49
50 Node* create_node(const T& value) {
51 Node* node = static_cast<Node*>(mResource->allocate(sizeof(Node)));
52 new (node) Node(value);
53 return node;
54 }
55
56 Node* create_node(T&& value) {
57 Node* node = static_cast<Node*>(mResource->allocate(sizeof(Node)));
58 new (node) Node(fl::move(value));
59 return node;
60 }
61
62 void destroy_node(Node* node) {
63 if (node && node != mHead) {
64 node->~Node();
65 mResource->deallocate(node, sizeof(Node));
66 }
67 }
68
69 void link_before(Node* pos, Node* node) {
70 node->next = pos;
71 node->prev = pos->prev;
72 pos->prev->next = node;
73 pos->prev = node;
74 }
75
76 void unlink(Node* node) {
77 node->prev->next = node->next;
78 node->next->prev = node->prev;

Callers 15

list_test_casesFunction · 0.85
list_examplesFunction · 0.85
make_diffFunction · 0.85
run_clang_format_diffFunction · 0.85
print_diffFunction · 0.85
validate_requestMethod · 0.85
list_methodsMethod · 0.85
to_platformio_iniMethod · 0.85
mainFunction · 0.85
scan_fl_headersFunction · 0.85
mainFunction · 0.85

Calls 3

push_backFunction · 0.85
clearFunction · 0.70
swapFunction · 0.70

Tested by 12

scanFunction · 0.68
check_single_fileFunction · 0.68
__init__Method · 0.68
setUpMethod · 0.68
setUpClassMethod · 0.68
test_analyze_map_fileMethod · 0.68