141#ifndef CONTAINERS_MANYMANY_H
142#define CONTAINERS_MANYMANY_H
148template <
class R,
class N, ContainerThreadSafety s,
int n,
class L>
class ManyManyLink;
149template <
class R,
class N, ContainerThreadSafety s = ContainerNoSafety,
int n = 0,
class L = ManyManyLink<R, N, s, n,
void>>
class ManyManyLink;
150template <
class R,
class N, ContainerThreadSafety s = ContainerNoSafety,
int n = 0,
class L = ManyManyLink<R, N, s, n,
void>>
class ManyManyRoot;
151template <
class R,
class N, ContainerThreadSafety s = ContainerNoSafety,
int n = 0,
class L = ManyManyLink<R, N, s, n,
void>>
class ManyManyNode;
183 void add(N& node, L& link);
184 void add(N& node, L* link =
nullptr);
185 void add(N* node, L& link);
186 void add(N* node, L* link =
nullptr);
188 void addFirst(N& node, L* link =
nullptr);
190 void addFirst(N* node, L* link =
nullptr);
191 void addLast(N& node, L& link);
192 void addLast(N& node, L* link =
nullptr);
193 void addLast(N* node, L& link);
194 void addLast(N* node, L* link =
nullptr);
200 L*
first()
const {
return Base::first();}
201 L*
last()
const {
return Base::last(); }
203 bool check()
const override {
return Base::check(); }
242 void add(R& root, L* link =
nullptr);
243 void add(R* root, L* link =
nullptr);
244 void addFirst(R& root, L* link =
nullptr);
245 void addFirst(R* root, L* link =
nullptr);
246 void addLast(R& root, L* link =
nullptr);
247 void addLast(R* root, L* link =
nullptr);
249 void add(R& root, L& link);
250 void add(R* root, L& link);
253 void addLast(R& root, L& link);
254 void addLast(R* root, L& link);
259 L*
first()
const {
return Base::first();}
260 L*
last()
const {
return Base::last(); }
262 bool check()
const override {
return Base::check(); }
311template <
class R,
class N, ContainerThreadSafety s,
int n,
class L>
class ManyManyLink :
public DListInNode<R, L, s, 2*n>,
public DListInNode<N, L, s, 2*n+1> {
326 R*
root()
const {
return BaseRoot::root(); }
327 N*
node()
const {
return BaseNode::root(); }
333 void add(R*
root, N*
node, L* link1 =
nullptr, L* link2 =
nullptr);
337 bool check()
const override;
348template <
class R,
class N, ContainerThreadSafety s,
int n>
class ManyManyLink<R, N, s, n, void> :
public ManyManyLink<R, N, s, n, ManyManyLink<R, N, s, n, void> > {
Intrusive Container Documentation and Base Class.
Intrusive Double Linked List.
unsigned writeLock(bool upgrade) const
Obtain a write lock.
unsigned readLock(bool upgradable) const
Obtain a read lock.
void readUnlock(unsigned code) const
Release the read lock that was held.
void writeUnlock(unsigned code) const
Release write lock.
Intrusive Doubly Linked List, Node.
Definition DListIn.h:204
Intrusive Doubly Linked List, List.
Definition DListIn.h:137
Intermediate Link for a many-many relationship.
Definition ManyMany.h:311
static L & getLink(L *link)
Convert a possible link pointer into an actual link object.
Definition ManyMany.hpp:323
L * prevNode() const
Definition ManyMany.h:330
class ManyManyRoot< R, N, s, n, L > Root
Definition ManyMany.h:312
bool m_dynamic
Definition ManyMany.h:342
friend Root
Definition ManyMany.h:321
void remove()
Definition ManyMany.hpp:445
L * nextRoot() const
Definition ManyMany.h:329
friend Node
Definition ManyMany.h:320
class ManyManyLink< R, N, s, n, L > Link
Definition ManyMany.h:314
void add(R *root, N *node, L *link1=nullptr, L *link2=nullptr)
Link a Root to a Node with this Lisk.
Definition ManyMany.hpp:391
class DListInRoot< R, L, s, 2 *n > RootRoot
Definition ManyMany.h:317
class DListInNode< N, L, s, 2 *n+1 > BaseNode
Definition ManyMany.h:316
ManyManyLink(R *root=nullptr, N *node=nullptr, L *link1=nullptr, L *link2=nullptr)
Definition ManyMany.hpp:304
R * root() const
Definition ManyMany.h:326
N * node() const
Definition ManyMany.h:327
class DListInNode< R, L, s, 2 *n > BaseRoot
Definition ManyMany.h:315
L * prevRoot() const
Definition ManyMany.h:328
class DListInRoot< N, L, s, 2 *n+1 > RootNode
Definition ManyMany.h:318
class ManyManyNode< R, N, s, n, L > Node
Definition ManyMany.h:313
virtual ~ManyManyLink()
Definition ManyMany.hpp:311
L * nextNode() const
Definition ManyMany.h:331
bool check() const override
Check a DListInNode.
Definition ManyMany.hpp:333
Node side of a many-many relationship.
Definition ManyMany.h:230
class DListInRoot< N, L, s, 2 *n+1 > Base
Definition ManyMany.h:234
void addLast(R &root, L *link=nullptr)
Definition ManyMany.hpp:269
class ManyManyNode< R, N, s, n, L > Node
Definition ManyMany.h:232
L * last() const
Definition ManyMany.h:260
bool check() const override
Check a DListInRoot and the list connected.
Definition ManyMany.h:262
ManyManyNode(R *root=nullptr, L *link=nullptr)
Definition ManyMany.hpp:205
~ManyManyNode()
Definition ManyMany.hpp:212
void addFirst(R &root, L *link=nullptr)
Definition ManyMany.hpp:248
friend Link
Definition ManyMany.h:237
class ManyManyLink< R, N, s, n, L > Link
Definition ManyMany.h:233
unsigned readLock() const
Definition ManyMany.h:268
unsigned writeLock() const
Definition ManyMany.h:265
class ManyManyRoot< R, N, s, n, L > Root
Definition ManyMany.h:231
bool remove(R &node)
Definition ManyMany.hpp:279
void readUnlock(unsigned save) const
Definition ManyMany.h:269
void add(R &root, L *link=nullptr)
Definition ManyMany.hpp:227
friend Root
Definition ManyMany.h:236
L * first() const
Definition ManyMany.h:259
void writeUnlock(unsigned save) const
Definition ManyMany.h:266
Root side of a many-many relationship.
Definition ManyMany.h:171
bool check() const override
Check a DListInRoot and the list connected.
Definition ManyMany.h:203
class ManyManyLink< R, N, s, n, L > Link
Definition ManyMany.h:174
class ManyManyNode< R, N, s, n, L > Node
Definition ManyMany.h:173
ManyManyRoot(N *node=nullptr, L *link=nullptr)
Definition ManyMany.hpp:76
void writeUnlock(unsigned save) const
Definition ManyMany.h:207
void readUnlock(unsigned save) const
Definition ManyMany.h:210
bool remove(N &node)
Remove Node for list.
Definition ManyMany.hpp:170
class ManyManyRoot< R, N, s, n, L > Root
Definition ManyMany.h:172
unsigned readLock() const
Definition ManyMany.h:209
friend Node
Definition ManyMany.h:177
void add(N &node, L &link)
Remove Node for list.
Definition ManyMany.hpp:98
L * first() const
Definition ManyMany.h:200
L * last() const
Definition ManyMany.h:201
void addFirst(N &node, L &link)
Definition ManyMany.hpp:118
~ManyManyRoot()
Definition ManyMany.hpp:83
unsigned writeLock() const
Definition ManyMany.h:206
class DListInRoot< R, L, s, 2 *n > Base
Definition ManyMany.h:175
friend Link
Definition ManyMany.h:178
void addLast(N &node, L &link)
Definition ManyMany.hpp:139