Platform.Data.Doublets C++
Loading...
Searching...
No Matches
InternalLinksSourcesLinkedListMethods.h
Go to the documentation of this file.
2{
3 template <typename TLinksOptions>
5 : public Platform::Collections::Methods::Lists::RelativeCircularDoublyLinkedListMethods<
6 InternalLinksSourcesLinkedListMethods<TLinksOptions>, typename TLinksOptions::LinkAddressType>
7 {
8 public:
9 using LinksOptionsType = TLinksOptions;
10 using LinkAddressType = typename LinksOptionsType::LinkAddressType;
11 using LinkType = typename LinksOptionsType::LinkType;
12 using WriteHandlerType = typename LinksOptionsType::WriteHandlerType;
13 using ReadHandlerType = typename LinksOptionsType::ReadHandlerType;
14
15 public:
16 static constexpr auto Constants = LinksOptionsType::Constants;
17
18 private:
19 std::byte* _linksDataParts;
20 std::byte* _linksIndexParts;
21
22 public:
25
26 public:
27 InternalLinksSourcesLinkedListMethods(std::byte* linksDataParts, std::byte* linksIndexParts)
28 {
29 _linksDataParts = linksDataParts;
30 _linksIndexParts = linksIndexParts;
31 }
32
33 public:
39
40 public:
46
47 public:
53
54 public:
60
61 public:
63 {
64 return this->GetLinkIndexPartReference(head).RootAsSource;
65 }
66
67 public:
69 {
70 auto first = this->GetLinkIndexPartReference(head).RootAsSource;
71 if (0 == first)
72 {
73 return first;
74 }
75 else
76 {
77 return this->GetPrevious(first);
78 }
79 }
80
81 public:
83 {
84 return this->GetLinkIndexPartReference(element).LeftAsSource;
85 }
86
87 public:
89 {
90 return this->GetLinkIndexPartReference(element).RightAsSource;
91 }
92
93 public:
95 {
96 return this->GetLinkIndexPartReference(head).SizeAsSource;
97 }
98
99 public:
101 {
102 this->GetLinkIndexPartReference(head).RootAsSource = element;
103 }
104
105 public:
107
108 public:
110 {
111 this->GetLinkIndexPartReference(element).LeftAsSource = previous;
112 }
113
114 public:
116 {
117 this->GetLinkIndexPartReference(element).RightAsSource = next;
118 }
119
120 public:
122 {
123 this->GetLinkIndexPartReference(head).SizeAsSource = size;
124 }
125
126 public:
128 {
129 return this->GetSize(head);
130 }
131
132 public:
133 Interfaces::CArray auto GetLinkValues(LinkAddressType linkIndex)
134 {
135 auto& link = this->GetLinkDataPartReference(linkIndex);
136 return Link{linkIndex, link.Source, link.Target};
137 }
138
139 public:
141 {
142 auto current = this->GetFirst(source);
143 auto first = current;
144 while (current != 0)
145 {
146 if (handler(this->GetLinkValues(current)) == (Break))
147 {
148 return Break;
149 }
150 current = this->GetNext(current);
151 if (current == first)
152 {
153 return Continue;
154 }
155 }
156 return Continue;
157 }
158 };
159} // namespace Platform::Data::Doublets::Memory::Split::Generic
void SetPrevious(LinkAddressType element, LinkAddressType previous)
Definition InternalLinksSourcesLinkedListMethods.h:109
LinkAddressType GetPrevious(LinkAddressType element)
Definition InternalLinksSourcesLinkedListMethods.h:82
void SetSize(LinkAddressType head, LinkAddressType size)
Definition InternalLinksSourcesLinkedListMethods.h:121
RawLinkDataPart< LinkAddressType > & GetLinkDataPartReference(LinkAddressType link)
Definition InternalLinksSourcesLinkedListMethods.h:41
typename LinksOptionsType::ReadHandlerType ReadHandlerType
Definition InternalLinksSourcesLinkedListMethods.h:13
const RawLinkIndexPart< LinkAddressType > & GetLinkIndexPartReference(LinkAddressType link) const
Definition InternalLinksSourcesLinkedListMethods.h:48
LinkAddressType EachUsage(LinkAddressType source, const ReadHandlerType &handler)
Definition InternalLinksSourcesLinkedListMethods.h:140
TLinksOptions LinksOptionsType
Definition InternalLinksSourcesLinkedListMethods.h:9
typename LinksOptionsType::WriteHandlerType WriteHandlerType
Definition InternalLinksSourcesLinkedListMethods.h:12
LinkAddressType GetNext(LinkAddressType element)
Definition InternalLinksSourcesLinkedListMethods.h:88
InternalLinksSourcesLinkedListMethods(std::byte *linksDataParts, std::byte *linksIndexParts)
Definition InternalLinksSourcesLinkedListMethods.h:27
typename LinksOptionsType::LinkAddressType LinkAddressType
Definition InternalLinksSourcesLinkedListMethods.h:10
LinkAddressType Break
Definition InternalLinksSourcesLinkedListMethods.h:23
LinkAddressType GetFirst(LinkAddressType head)
Definition InternalLinksSourcesLinkedListMethods.h:62
Interfaces::CArray auto GetLinkValues(LinkAddressType linkIndex)
Definition InternalLinksSourcesLinkedListMethods.h:133
LinkAddressType Continue
Definition InternalLinksSourcesLinkedListMethods.h:24
LinkAddressType GetSize(LinkAddressType head)
Definition InternalLinksSourcesLinkedListMethods.h:94
LinkAddressType CountUsages(LinkAddressType head)
Definition InternalLinksSourcesLinkedListMethods.h:127
void SetFirst(LinkAddressType head, LinkAddressType element)
Definition InternalLinksSourcesLinkedListMethods.h:100
static constexpr auto Constants
Definition InternalLinksSourcesLinkedListMethods.h:16
void SetLast(LinkAddressType, LinkAddressType)
Definition InternalLinksSourcesLinkedListMethods.h:106
typename LinksOptionsType::LinkType LinkType
Definition InternalLinksSourcesLinkedListMethods.h:11
LinkAddressType GetLast(LinkAddressType head)
Definition InternalLinksSourcesLinkedListMethods.h:68
void SetNext(LinkAddressType element, LinkAddressType next)
Definition InternalLinksSourcesLinkedListMethods.h:115
const RawLinkDataPart< LinkAddressType > & GetLinkDataPartReference(LinkAddressType link) const
Definition InternalLinksSourcesLinkedListMethods.h:34
RawLinkIndexPart< LinkAddressType > & GetLinkIndexPartReference(LinkAddressType link)
Definition InternalLinksSourcesLinkedListMethods.h:55
Definition ExternalLinksRecursionlessSizeBalancedTreeMethodsBase.h:2