X-Git-Url: https://git.llucax.com/z.facultad/75.52/treemulator.git/blobdiff_plain/7e2e46230bf3206edcc153df27092bb2ad82af07..2c1d3ea3cf9a25e8f957587d4a1581fc292c831b:/src/btree.h?ds=inline diff --git a/src/btree.h b/src/btree.h index 540ac38..467ed6f 100644 --- a/src/btree.h +++ b/src/btree.h @@ -46,8 +46,11 @@ #include #include +#include #include "common.h" #include "clave.h" +#include "clave_fija.h" +#include "btree_data.h" /* alias para codear menos :) */ @@ -83,21 +86,26 @@ struct BTreeNodeHeader { */ class BTree { public: - BTree (const char *filename, unsigned int block_size, bool create_new_file = false); + BTree (const std::string &filename, unsigned int block_size, bool create_new_file = false); ~BTree (); - void AddKey (Clave &k); - void DelKey (Clave &k); + void AddKey (const Clave &k); + void DelKey (const Clave &k); private: - void write_tree_header (); - void write_block (uchar *block, uint num); + Clave* AddKeyR (const Clave *k, uint node_num); + void WriteFileHeader (); + + void WriteBlock (uchar *block, uint num); uchar *ReadBlock (uint num); void ReadNodoHeader (uchar *node, BTreeNodeHeader *header); void WriteNodoHeader (uchar *node, BTreeNodeHeader *header); + std::list ReadKeys (uchar *node, BTreeNodeHeader &node_header); + void WriteKeys (uchar *node, BTreeNodeHeader &node_header, std::list &keys); + std::string filename; BTreeFileHeader header;