CMMTree v1.0
node< X1 > Class Template Reference

The node class definition. This is a template of a class whose objects are used to build a tree of relationships between processed data. More...

#include <node.hpp>

Public Types

using data_addr = typename std::vector<X1>::const_iterator
 

Public Member Functions

 node (node< X1 > *const &prev, const data_addr &pos)
 This is the constructor designed to create the next node of the CMMTree.
 
 node ()
 Dfefault constructor.
 
 node (node< X1 > const &)=delete
 Copy constructor.
 
node< X1 > & operator= (node< X1 > const &)=delete
 Copy assignment operator.
 
 node (node< X1 > &&other) noexcept
 Move constructor.
 
node< X1 > & operator= (node< X1 > &&other) noexcept
 Move assignment operator.
 
 ~node ()
 Destructor.
 
bool isNULLit (data_addr const &r) const
 This function is used when there is a need to check whether it is possible to use the data to which root refers.
 
void add_new_node (data_addr const &pos)
 This function is used to create another CMMTree node.
 
size_t node_level () const
 This function returns the level of the CMMTree where a given node is located.
 
data_addr const & data_address () const
 This function returns the const_iterator to a vector<X1> element (dataset element).
 
data_addr & data_address ()
 This function returns the const_iterator to a vector<X1> element (dataset element).
 
void data_on_path (std::vector< data_addr > &vec) const
 This function allows you to find a set of elements on a path - starting from the current node to the root.
 
node< X1 > *const & parent_node_address () const
 This function returns the address of the parent node.
 
node< X1 > const * this_node_address () const
 The function returns the address of the node calling this function.
 
size_t children_number () const
 The function returns the number of children of a given node.
 
size_t siblings_number () const
 The function returns the number of children of the parent of a given node.
 
void change_children_capacity () const
 A function that reduces the size of the vector of parent's children's addresses - from capacity() to size().
 
node< X1 > *const & operator[] (size_t i) const
 The index operator for a vector of children of a given node.
 
std::vector< node< X1 > * > const & childrenVec () const
 Function that allows direct access to a child vector.
 
std::vector< node< X1 > * > & childrenVec ()
 Function that allows direct access to a child vector.
 
void all_siblings_addresses (std::vector< const node< X1 > * > &vec) const
 This function allows you to obtain the addresses of all children of a parent.
 
X1 const & node_value () const
 The function allows you to retrieve (for reading) the value of an element of the input data set to which a given node is associated.
.
 

Static Public Member Functions

static void n_counter_info ()
 The function displays information about the total number of node<X1> objects.
 
static unsigned n_Count ()
 The function returns a number of objects of type node<X1>.
 

Friends

template<class T1 , template< typename > class T2>
class CMMTree
 

Detailed Description

template<class X1>
class node< X1 >

The node class definition. This is a template of a class whose objects are used to build a tree of relationships between processed data.

Template Parameters
X1- a type parameter, that is, the type of input data being processed.

Each node has three data members dedicated to storing addresses, and these are:

  • the pointer to the parent node,
  • pointer to the dynamic vector of the children node pointers,
  • the iterator to a single element of the vector<X1> (input data vector).

Only the root node always has the null value (nullptr) for the pointer to the parent node.
Only the root may have the iterator (d_iterator) not assigned to the data, which in this case means that root does not represent any element of the input data vector. In this case CMMTree will describe not a single tree but a forest of trees.
For each other node of the CMMTree, the member d_iterator must point a specific element of the input data vector.
If the children pointer has a null value, the node is a leaf.

More information - see: https://ieeexplore.ieee.org/document/9069220

Definition at line 45 of file node.hpp.

Member Typedef Documentation

◆ data_addr

template<class X1 >
using node< X1 >::data_addr = typename std::vector<X1>::const_iterator

Definition at line 47 of file node.hpp.

Constructor & Destructor Documentation

◆ node() [1/4]

template<class X1 >
node< X1 >::node ( node< X1 > *const & prev,
const data_addr & pos )
inline

This is the constructor designed to create the next node of the CMMTree.

This constructor must be private.
It is called only by the function node<X1>::add_new_node().

Definition at line 69 of file node.hpp.

◆ node() [2/4]

template<class X1 >
node< X1 >::node ( )
inline

Dfefault constructor.

Definition at line 78 of file node.hpp.

◆ node() [3/4]

template<class X1 >
node< X1 >::node ( node< X1 > const & )
delete

Copy constructor.

Creating copies of nodes is prohibited.

◆ node() [4/4]

template<class X1 >
node< X1 >::node ( node< X1 > && other)
inlinenoexcept

Move constructor.

Parameters
other

Definition at line 102 of file node.hpp.

◆ ~node()

template<class X1 >
node< X1 >::~node ( )
inline

Destructor.

Definition at line 39 of file node.cpp.

Member Function Documentation

◆ add_new_node()

template<class X1 >
void node< X1 >::add_new_node ( data_addr const & pos)
inline

This function is used to create another CMMTree node.

Parameters
pos- the iterator to the element of the vector<X1> with which this node will be associated.

Definition at line 19 of file node.cpp.

◆ all_siblings_addresses()

template<class X1 >
void node< X1 >::all_siblings_addresses ( std::vector< const node< X1 > * > & vec) const

This function allows you to obtain the addresses of all children of a parent.

The vector passed by reference is modified.

Definition at line 61 of file node.cpp.

◆ change_children_capacity()

template<class X1 >
void node< X1 >::change_children_capacity ( ) const
inline

A function that reduces the size of the vector of parent's children's addresses - from capacity() to size().

Definition at line 199 of file node.hpp.

◆ children_number()

template<class X1 >
size_t node< X1 >::children_number ( ) const
inline

The function returns the number of children of a given node.

Returns
size_t

Definition at line 188 of file node.hpp.

◆ childrenVec() [1/2]

template<class X1 >
std::vector< node< X1 > * > & node< X1 >::childrenVec ( )
inline

Function that allows direct access to a child vector.

Returns
std::vector< node<X1>* > &

Definition at line 224 of file node.hpp.

◆ childrenVec() [2/2]

template<class X1 >
std::vector< node< X1 > * > const & node< X1 >::childrenVec ( ) const
inline

Function that allows direct access to a child vector.

Returns
std::vector< node<X1>* > const&

Definition at line 217 of file node.hpp.

◆ data_address() [1/2]

template<class X1 >
data_addr & node< X1 >::data_address ( )
inline

This function returns the const_iterator to a vector<X1> element (dataset element).

This function allows you to modify d_iterator (the value of the node class field), but not the data it points to.

Returns
std::vector<X1>::const_iterator

Definition at line 158 of file node.hpp.

◆ data_address() [2/2]

template<class X1 >
data_addr const & node< X1 >::data_address ( ) const
inline

This function returns the const_iterator to a vector<X1> element (dataset element).

Returns
std::vector<X1>::const_iterator

Definition at line 150 of file node.hpp.

◆ data_on_path()

template<class X1 >
void node< X1 >::data_on_path ( std::vector< data_addr > & vec) const
inline

This function allows you to find a set of elements on a path - starting from the current node to the root.

The vector passed by reference is first cleared().
Then, it inserts subsequent iterators to the appropriate elements of the input data vector.
vector of "data on path"

Definition at line 6 of file node.cpp.

◆ isNULLit()

template<class X1 >
bool node< X1 >::isNULLit ( data_addr const & r) const
inline

This function is used when there is a need to check whether it is possible to use the data to which root refers.

When root does not point to any data, its value cannot be expected.

Parameters
r- the const_iterator to a vector<X1> element.
Returns
true or false.

Definition at line 127 of file node.hpp.

◆ n_Count()

template<class X1 >
static unsigned node< X1 >::n_Count ( )
inlinestatic

The function returns a number of objects of type node<X1>.

Returns
unsigned

Definition at line 262 of file node.hpp.

◆ n_counter_info()

template<class X1 >
static void node< X1 >::n_counter_info ( )
inlinestatic

The function displays information about the total number of node<X1> objects.

Definition at line 246 of file node.hpp.

◆ node_level()

template<class X1 >
size_t node< X1 >::node_level ( ) const
inline

This function returns the level of the CMMTree where a given node is located.

Returns
size_t

Definition at line 51 of file node.cpp.

◆ node_value()

template<class X1 >
X1 const & node< X1 >::node_value ( ) const
inline

The function allows you to retrieve (for reading) the value of an element of the input data set to which a given node is associated.
.

The function throws an exception when trying to retrieve the value of the root node, which is not associated with any element of the input data set.

Definition at line 238 of file node.hpp.

◆ operator=() [1/2]

template<class X1 >
node< X1 > & node< X1 >::operator= ( node< X1 > && other)
inlinenoexcept

Move assignment operator.

Parameters
other
Returns
node<X1>&

Definition at line 111 of file node.hpp.

◆ operator=() [2/2]

template<class X1 >
node< X1 > & node< X1 >::operator= ( node< X1 > const & )
delete

Copy assignment operator.

Copying of node values is prohibited.

◆ operator[]()

template<class X1 >
node< X1 > *const & node< X1 >::operator[] ( size_t i) const
inline

The index operator for a vector of children of a given node.

Returns
The address of the child node (node<X1>*) is returned.

Definition at line 206 of file node.hpp.

◆ parent_node_address()

template<class X1 >
node< X1 > *const & node< X1 >::parent_node_address ( ) const
inline

This function returns the address of the parent node.

Returns
node<X1>*

Definition at line 173 of file node.hpp.

◆ siblings_number()

template<class X1 >
size_t node< X1 >::siblings_number ( ) const
inline

The function returns the number of children of the parent of a given node.

Returns
size_t

Definition at line 195 of file node.hpp.

◆ this_node_address()

template<class X1 >
node< X1 > const * node< X1 >::this_node_address ( ) const
inline

The function returns the address of the node calling this function.

Returns
node<X1>*

Definition at line 180 of file node.hpp.

Friends And Related Symbol Documentation

◆ CMMTree

template<class X1 >
template<class T1 , template< typename > class T2>
friend class CMMTree
friend

Definition at line 271 of file node.hpp.


The documentation for this class was generated from the following files: