ALib C++ Library
Library Version: 2312 R0
Documentation generated by doxygen
Public Fields | Public Methods | List of all members
StringTreeBase< T, TNodeMaintainer, TRecycling >::Node Struct Reference
Inheritance diagram for StringTreeBase< T, TNodeMaintainer, TRecycling >::Node:
[legend]
Collaboration diagram for StringTreeBase< T, TNodeMaintainer, TRecycling >::Node:
[legend]

Class Description

template<typename T, typename TNodeMaintainer, typename TRecycling>
struct aworx::lib::monomem::detail::StringTreeBase< T, TNodeMaintainer, TRecycling >::Node

This is the "final" internal node type, which is created and stored for every node of the tree. It adds field data of template type T to store custom container data.

Objects of this type can not be received directly and all interface is available via public type StringTree::NodePtr only, which holds a pointer to an object of this class.

Note that the templated allocator type TAllocator is declared as a friend of this class to be able to access the otherwise protected constructor.

Definition at line 196 of file stringtreebase.inl.

Public Fields

NodeList children
 
data
 
uinteger qtyChildren
 
- Public Fields inherited from BidiNodeBase< Node >
Node * pprev
 
- Public Fields inherited from SidiNodeBase< Node >
Node * pnext
 
- Public Fields inherited from StringTreeBase< T, TNodeMaintainer, TRecycling >::NodeKey
NameType name
 
Nodeparent
 

Public Methods

 Node (const Node &)=delete
 
template<typename... TArgs>
 Node (const NodeKey &pKey, TArgs &&... args)
 
 Node (Node &&)=delete
 
template<typename... TArgs>
 Node (Node *pParent, const NameType &pName, TArgs &&... args)
 
AStringassemblePath (AString &target, character separatorChar) const
 
uinteger deleteChild (StringTreeBase *tree, Node *child)
 
uinteger deleteChildren (StringTreeBase *tree)
 
int depth () const
 
NodefindChild (StringTreeBase *tree, const NameType &childName)
 
template<typename... TArgs>
std::pair< Node *, bool > findOrCreateChild (StringTreeBase *tree, const NameType &childName, TArgs &&... args)
 
bool isRoot () const
 
- Public Methods inherited from BidiNodeBase< Node >
 BidiNodeBase () noexcept=default
 
 BidiNodeBase (BidiNodeBase &&) noexcept=default
 
 BidiNodeBase (const BidiNodeBase &)=delete
 
 BidiNodeBase (Node *next, Node *prev) noexcept
 
void addBefore (Node *elem)
 
void addBehind (Node *elem)
 
BidiNodeBaseoperator= (BidiNodeBase &&) noexcept=default
 
BidiNodeBaseoperator= (const BidiNodeBase &)=delete
 
Node * prev () const
 
void prev (BidiNodeBase *newPrev)
 
void remove ()
 
void remove (Node *last)
 
- Public Methods inherited from SidiNodeBase< Node >
 SidiNodeBase () noexcept=default
 
 SidiNodeBase (const SidiNodeBase &)=delete
 
 SidiNodeBase (Node *next) noexcept
 
 SidiNodeBase (SidiNodeBase &&) noexcept=default
 
Node * addBehind (Node *elem)
 
integer count (SidiNodeBase *end=nullptr) const
 
bool hasNext () const
 
Node * next () const
 
void next (SidiNodeBase *p)
 
SidiNodeBaseoperator= (const SidiNodeBase &)=delete
 
SidiNodeBaseoperator= (SidiNodeBase &&) noexcept=default
 
bool pointsTo (const SidiNodeBase *elem) const
 
Node * removeNext ()
 
Node * removeRangeBehind (Node *last)
 
- Public Methods inherited from StringTreeBase< T, TNodeMaintainer, TRecycling >::NodeKey
 NodeKey (Node *pParent, const NameType &pName)
 

Additional Inherited Members

- Public Types inherited from BidiNodeBase< Node >
using FWDNode = SidiNodeBase< Node >
 

Constructor & Destructor Documentation

◆ Node() [1/4]

Node ( const Node )
delete

Deleted copy constructor.

◆ Node() [2/4]

Node ( Node &&  )
delete

Deleted move constructor.

◆ Node() [3/4]

Node ( const NodeKey pKey,
TArgs &&...  args 
)
inline

Constructor. Custom data is default-initialized.

Template Parameters
TArgsTypes of variadic parameters given with parameter args.
Parameters
pKeyThe key portion of the node.
argsVariadic parameters to be forwarded to constructor of custom type T.

Definition at line 221 of file stringtreebase.inl.

◆ Node() [4/4]

Node ( Node pParent,
const NameType pName,
TArgs &&...  args 
)
inline

Constructor. Custom data is default-initialized.

Template Parameters
TArgsTypes of variadic parameters given with parameter args.
Parameters
pParentParent node to search a child for.
pNameChild name to search
argsVariadic parameters to be forwarded to constructor of custom type T.

Definition at line 235 of file stringtreebase.inl.

Member Function Documentation

◆ assemblePath()

AString& assemblePath ( AString target,
character  separatorChar 
) const
inline

Implementation of StringTree::NodePtr::AssemblePath.

Parameters
targetThe target to append the path to.
separatorCharThe separator character as defined with the template parameter of class StringTree.
Returns
The given AString to allow concatenated operations on it.

Definition at line 402 of file stringtreebase.inl.

Here is the call graph for this function:

◆ deleteChild()

uinteger deleteChild ( StringTreeBase tree,
Node child 
)
inline

Deletes a given child node.

Note
If the given node is not a child of this node, the behavior is undefined. With debug builds, in this case an ALib assertion is raised.
Parameters
treeThe tree this node belongs to.
childA pointer to a child of this node that is to be deleted.
Returns
The total number of nodes deleted.

Definition at line 350 of file stringtreebase.inl.

Here is the call graph for this function:

◆ deleteChildren()

uinteger deleteChildren ( StringTreeBase tree)
inline

Deletes all child nodes.

Parameters
treeThe tree this node belongs to.
Returns
The number of children that were deleted.

Definition at line 372 of file stringtreebase.inl.

Here is the call graph for this function:

◆ depth()

int depth ( ) const
inline

Iterates over the parent nodes to the root node and returns the this node's depth.

Returns
The depth of the this node.

Definition at line 256 of file stringtreebase.inl.

◆ findChild()

Node* findChild ( StringTreeBase tree,
const NameType childName 
)
inline

Searches a child with a given name. The name is not checked for ., .. or if separation characters.

Parameters
treeThe tree this node belongs to.
childNameThe name of the child to search.
Returns
The child or nullptr if not found.

Definition at line 276 of file stringtreebase.inl.

Here is the call graph for this function:

◆ findOrCreateChild()

std::pair<Node*,bool> findOrCreateChild ( StringTreeBase tree,
const NameType childName,
TArgs &&...  args 
)
inline

Searches a child with a given name, if not found, one is created. The name is not checked for ., .. or if separation characters.

Template Parameters
TArgsTypes of variadic parameters given with parameter args.
Parameters
treeThe tree this node belongs to.
childNameThe name of the child to search.
argsVariadic parameters to be forwarded to constructor of custom type T in the case a child is created.
Returns
A pair containing an iterator referencing either the element found or the new element added. The bool component is true if the insertion took place and false nothing was changed.

Definition at line 322 of file stringtreebase.inl.

Here is the call graph for this function:

◆ isRoot()

bool isRoot ( ) const
inline

Returns true if this is the root node, false otherwise.

Returns
true if this is the root node, false otherwise.

Definition at line 247 of file stringtreebase.inl.

Member Data Documentation

◆ children

NodeList children

The hook to the doubly linked list of children.

Definition at line 203 of file stringtreebase.inl.

◆ data

T data

The templated custom data object stored with each node.

Definition at line 206 of file stringtreebase.inl.

◆ qtyChildren

uinteger qtyChildren

The number of children currently stored in this node.

Definition at line 200 of file stringtreebase.inl.


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