You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
913 B

#include "blobtree.hpp"
11 months ago
EXTERN_C_BEGIN
11 months ago
blobtree_t::iterator blobtree_t::push_primitive_node(const primitive *primitive_ptr)
11 months ago
{
auto iter = nodes.emplace();
iter->node_data.set_ptr(const_cast<primitive *>(primitive_ptr));
11 months ago
return iter;
11 months ago
}
void blobtree_t::pop_node(blobtree_t::iterator node) { nodes.erase(node); }
11 months ago
blobtree_t::iterator blobtree_t::push_operation_node(internal::eNodeOperation op, iterator lhs, iterator rhs)
11 months ago
{
if (!lhs->is_parent_null() || !rhs->is_parent_null()) {
throw std::runtime_error("Cannot set operation node with non-null parent.");
11 months ago
}
auto iter = nodes.emplace();
11 months ago
iter->node_data.set_mark(static_cast<size_t>(op));
iter->left_child = make_pointer_wrapper(*lhs);
iter->right_child = make_pointer_wrapper(*rhs);
lhs->parent = make_pointer_wrapper(*iter);
rhs->parent = make_pointer_wrapper(*iter);
11 months ago
return iter;
11 months ago
}
EXTERN_C_END