// // Created by YuhangQ on 2021/10/25. // #include "btree_node.h" std::map NodeUUID::map; NodeUUID *NodeUUID::getNode(const int &address) { if(map.count(address) == 0) { delete map[address]; map[address] = new NodeUUID(address); } return map[address]; } NodeUUID::NodeUUID(const int& address):address(address) { clear(); StoragePage page = PageManager::Instance().getPage(address); int p = 0; size = page.getIntStartFrom(p); p += 4; parent = page.getIntStartFrom(p); p += 4; left = page.getIntStartFrom(p); p += 4; right = page.getIntStartFrom(p); p += 4; leaf = !page.getIntStartFrom(p); p += 4; for(int i=0; i key[pos]) pos++; val[size + 1] = val[size]; for(int i=size; i>pos; i--) { val[i] = val[i - 1]; key[i] = key[i - 1]; } key[pos] = uuid; size++; return pos; } void NodeUUID::print() { printf("---------BTreeNode---------\n"); for(int i=0; iaddress); } NodeUUID *NodeUUID::release(const int &address) { return nullptr; }