19template <
class X1,
template<
typename>
class predicate >
22 using firstborns = std::vector < node<X1>* > ;
23 using generations = std::vector < firstborns > ;
26 std::vector < X1 >
const* p_dataset ;
27 predicate<X1> condition ;
30 void add_next_firstborn(
size_t generation,
node<X1>*
const& node_adr);
31 void jagged_table_reconstruction(
size_t lev);
32 void find_new_generation(
size_t generation );
44 MTree.push_back( firstborns( 1, root ) );
57 CMMTree( std::vector < X1 >
const*
const& adr ): root( new
node<X1>() ), p_dataset(adr){
58 MTree.push_back( firstborns( 1, root ) );
72 CMMTree( std::vector < X1 >
const*
const& adr,
typename std::vector<X1>::const_iterator
const& pos ): root( new
node<X1>() ), p_dataset(adr){
74 MTree.push_back( firstborns( 1, root ) );
95 : root{std::move(other.root)}, p_dataset{std::move(other.p_dataset)}, condition{other.condition}, MTree{std::move(other.MTree)}
98 other.p_dataset =
nullptr;
99 other.MTree.emplace_back( firstborns( 1, other.root ) );
111 root = std::move(other.root);
112 p_dataset = std::move(other.p_dataset);
113 condition = other.condition;
114 MTree = std::move(other.MTree);
117 other.p_dataset =
nullptr;
118 other.MTree.emplace_back( firstborns( 1, other.root ) );
148 void join_data(std::vector < X1 >
const*
const& adr);
160 void join_data(std::vector < X1 >
const*
const& adr,
typename std::vector<X1>::const_iterator
const& pos);
200 for(
size_t i=0; i<MTree.size(); ++i)
281 std::vector < X1 >
const*
const&
P_dataset()
const {
return p_dataset; }
338 template <
class T1,
template<
typename>
class T2>
The Conditional Multiway Mapped Tree (CMMTree) class definition.
size_t firstborns_number(size_t i) const
This function returns the number of firstborn nodes of one generation of the CMMTree - at the level p...
X1 const & firstborn_value(size_t i, size_t j) const
A function that allows you to read the value of [i,j]-th firstborn node.
friend std::ostream & operator<<(std::ostream &out, CMMTree< T1, T2 > const &ref)
Overloaded output operator to the stream.
size_t generation_size(size_t i) const
This function returns the total number of nodes one generation of the CMMTree - at the level passed b...
void generation_addresses(size_t i, std::vector< const node< X1 > * > &vec) const
This function allows you to get all the addresses of the i-th generation firstborn nodes....
void tree_shape(std::ostream &out) const
This function allows you to represent a tree in a parametric form.
void join_data(std::vector< X1 >const *const &adr)
This function is used to connect the CMMTree object to the input data vector.
CMMTree(const CMMTree< X1, predicate > &)=delete
Copy constructor. Construct of copies of CMMTree object is prohibited.
~CMMTree()
Destructor. The allocated memory for all nodes in the tree is released.
auto operator=(CMMTree &&other) noexcept -> CMMTree< X1, predicate > &
Move assignment operator.
predicate< X1 > const & pred_value() const
A function that allows you to read the value of a predicate object.
void tree_clear()
This function clears the entire CMMTree object.
long long tree_create()
A function that starts the process of the CMMTree construction.
void delete_one_node(node< X1 > *&to_del)
This function deletes the node whose address is passed as an argument.
CMMTree(CMMTree &&other) noexcept
Move constructor.
const node< X1 > * brother_address(const node< X1 > *ptr, size_t i) const
This function allows you to obtain the address of the i-th brother of the firstborn node.
void create_subtrees_roots(std::vector< X1 > const &roots_data)
This function allows you to initialize the creation of a forest using a separate data set - different...
CMMTree(std::vector< X1 >const *const &adr)
Single-argument constructor.
predicate< X1 > & pred_value()
A function that allows you to modify the value of a predicate object.
CMMTree()
Dfefault constructor.
node< X1 > const *const & firstborn_address(size_t i, size_t j) const
The function returns the address of the j-th firstborn of the i-th generation.
size_t all_nodes_number() const
This function returns the number of all nodes in the CMMTree.
size_t tree_height() const
This function returns the CMMTree height.
CMMTree(std::vector< X1 >const *const &adr, typename std::vector< X1 >::const_iterator const &pos)
Two arguments constructor.
void delete_nodes(std::vector< node< X1 > * > &to_del, size_t lev)
Using this function you can delete more than one node from a specified node generation at once.
std::vector< X1 > const *const & P_dataset() const
The function returns the address of the input data vector.
void leaves_addresses(size_t i, std::vector< const node< X1 > * > &vec) const
This function allows you to get all the addresses of the i-th generation leaves.
CMMTree< X1, predicate > & operator=(const CMMTree< X1, predicate > &)=delete
Copy assignment operator. Copying a CMMTree object using the assignment operator is not allowed.
size_t leaves_number(size_t i) const
This function returns the number of leaves one generation of the CMMTree - at the level passed by the...
The node class definition. This is a template of a class whose objects are used to build a tree of re...
data_addr const & data_address() const
This function returns the const_iterator to a vector<X1> element (dataset element).