gStore/KVstore/ISTree/node/ISLeafNode.h

50 lines
1.4 KiB
C
Raw Normal View History

/*=============================================================================
2017-01-16 14:12:57 +08:00
# Filename: ISLeafNode.h
# Author: syzz
# Mail: 1181955272@qq.com
# Last Modified: 2015-04-26 16:39
# Description: the leaf-node of a B+ tree
=============================================================================*/
2017-01-16 14:12:57 +08:00
#ifndef _KVSTORE_ISTREE_NODE_ISLEAFNODE_H
#define _KVSTORE_ISTREE_NODE_ISLEAFNODE_H
2017-01-16 14:12:57 +08:00
#include "ISNode.h"
2017-01-16 14:12:57 +08:00
class ISLeafNode : public ISNode
{
protected:
ISNode* prev; //LeafNode
ISNode* next;
Bstr* values;
void AllocValues();
//void FreeValues();
public:
ISLeafNode();
ISLeafNode(bool isVirtual);
//LeafNode(Storage* TSM);
void Virtual();
void Normal();
ISNode* getPrev() const;
ISNode* getNext() const;
2017-01-16 14:12:57 +08:00
const Bstr* getValue(int _index) const;
bool setValue(const Bstr* _value, int _index, bool ifcopy = false);
bool addValue(const Bstr* _value, int _index, bool ifcopy = false);
bool subValue(int _index, bool ifdel = false);
void setPrev(ISNode* _prev);
void setNext(ISNode* _next);
unsigned getSize() const;
ISNode* split(ISNode* _father, int _index);
ISNode* coalesce(ISNode* _father, int _index);
2017-01-16 14:12:57 +08:00
void release();
~ISLeafNode();
void print(std::string s); //DEBUG
/*non-sense virtual function
Node* getChild(int _index) const;
bool addChild(Node* _child, int _index);
bool subChild(int _index);
*/
};
//BETTER: prev isn't a must, and reverse-range can be achieved using recursive-next
2017-01-16 14:12:57 +08:00
#endif