8template <
class X1,
template<
typename>
class pred_type>
class CMMTree;
21 static std::vector<T> vec;
22 static typename std::vector<T>::const_iterator it = vec.begin();
47 using data_addr =
typename std::vector<X1>::const_iterator ;
52 std::vector< node<X1>* >* children;
55 static unsigned n_count;
56 static inline std::mutex _mutex;
58 static inline std::mutex &mutex() {
return _mutex; }
103 : parent( std::move(other.parent) ), d_iterator( std::move(other.d_iterator) ), children( std::move(other.children ) )
112 parent = std::move(other.parent); d_iterator = std::move(other.d_iterator); children = std::move(other.children );
166 void data_on_path(std::vector< data_addr > & vec)
const;
207 if(!children)
throw std::runtime_error(
"ERROR ! node<T>::operator[]()\nThe current node is a leaf - it has no any children.\n");
208 if(i>=children->size())
throw std::runtime_error(
"ERROR ! node<T>::operator[]()\nIndex out of range.\n");
209 return children->operator[](i);
217 std::vector< node<X1>* >
const&
childrenVec()
const {
return *children;}
239 if(
isNULLit(d_iterator) )
throw std::runtime_error(
"ERROR ! node<T>::node_value()\nYou can not use this function for root node\nwhen you have decided beforehand that root will not refer to any element of the input dataset.\n");
249 std::cout <<
"Number of nodes<" <<
typeid(X1).name() <<
"> = ";
251 std::cout << n_count << std::endl;
254 std::cout <<
"Information about the number of node objects is not available.\nUncomment the NODE_COUNTER directive to start object counting." << std::endl;
266 println(
"Information about the number of node objects is not available.\nUncomment the NODE_COUNTER directive to start object counting.");
271 template <
class T1,
template<
typename>
class T2>
friend class CMMTree;
The Conditional Multiway Mapped Tree (CMMTree) class definition.
The node class definition. This is a template of a class whose objects are used to build a tree of re...
node< X1 > & operator=(node< X1 > const &)=delete
Copy assignment operator.
static unsigned n_Count()
The function returns a number of objects of type node<X1>.
static void n_counter_info()
The function displays information about the total number of node<X1> objects.
size_t node_level() const
This function returns the level of the CMMTree where a given node is located.
node< X1 > *const & parent_node_address() const
This function returns the address of the parent node.
typename std::vector< X1 >::const_iterator data_addr
data_addr & data_address()
This function returns the const_iterator to a vector<X1> element (dataset element).
node< X1 > & operator=(node< X1 > &&other) noexcept
Move assignment operator.
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 ...
void change_children_capacity() const
A function that reduces the size of the vector of parent's children's addresses - from capacity() to ...
node(node< X1 > *const &prev, const data_addr &pos)
This is the constructor designed to create the next node of the CMMTree.
node(node< X1 > &&other) noexcept
Move constructor.
node()
Dfefault constructor.
node< X1 > *const & operator[](size_t i) const
The index operator for a vector of children of a given node.
size_t children_number() const
The function returns the number of children of a given node.
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.
node(node< X1 > const &)=delete
Copy constructor.
void add_new_node(data_addr const &pos)
This function is used to create another CMMTree node.
data_addr const & data_address() const
This function returns the const_iterator to a vector<X1> element (dataset element).
std::vector< node< X1 > * > & childrenVec()
Function that allows direct access to a child vector.
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 r...
size_t siblings_number() const
The function returns the number of children of the parent of a given node.
X1 const & node_value() const
The function allows you to retrieve (for reading) the value of an element of the input data set to wh...
std::vector< node< X1 > * > const & childrenVec() const
Function that allows direct access to a child vector.
node< X1 > const * this_node_address() const
The function returns the address of the node calling this function.
std::vector< T >::const_iterator const & Null_iterator(T)
An iterator that is supposed to point to "nothing" of specified type ;).
constexpr void println(auto const &a)