X-Git-Url: https://git.llucax.com/z.facultad/75.52/treemulator.git/blobdiff_plain/ab25c0cf9c5ccacbdb8940112562fc2d3e57086c..57dbb7df8973a3e0c0c570c1eae9d84802e02bd9:/src/btree.h?ds=sidebyside diff --git a/src/btree.h b/src/btree.h index ec81903..ef9f242 100644 --- a/src/btree.h +++ b/src/btree.h @@ -73,6 +73,7 @@ #include "clave_fija.h" #include "clave_variable.h" #include "btree_data.h" +#include "exception.h" /* alias para codear menos :) */ @@ -121,7 +122,7 @@ struct BTreeFindResult { */ class BTree { public: - BTree (const std::string &filename, unsigned int block_size, int k_t = KEY_FIXED, bool create_new_file = false); + BTree (const std::string &filename, unsigned int block_size, int t_t = TYPE_UNIQUE, int k_t = KEY_FIXED, bool create_new_file = false); ~BTree (); /** Tipos de clave a usar */ @@ -130,6 +131,11 @@ class BTree { KEY_VARIABLE /**< Utilización de clave de longitud variable */ }; + enum { + TYPE_UNIQUE, + TYPE_SELECTIVE + }; + /** Agrega una nueva clave al árbol. */ void AddKey (const Clave &k); /** Elimina una clave del árbol. */ @@ -149,11 +155,11 @@ class BTree { /* Funciones de Baja */ void DelKeyR (BTreeData *k, uint node, uint padre); void DelKeyFromLeaf (Clave *k, uint node_num, uint padre); - void DelKeyFromOther (const Clave &k, BTreeFindResult *r); + void DelKeyFromNode (Clave *k, uint node_num, uint padre, uint left, uint right); void FindBrothers (uint node_num, uint padre, uint &left, uint &right); Clave *ReplaceKeyInFather (uint node_num, uint padre, Clave *k); Clave *GetKey (uint node_num, char maxmin); - void JoinNodes (uint node1, uint node2, uint padre); + void JoinNodes (uint node1, uint node2, uint padre, int); /* Funciones de Búsqueda */ BTreeFindResult *FindKeyR (const Clave *k, uint node); @@ -175,9 +181,14 @@ class BTree { void WriteKeys (uchar *node, BTreeNodeHeader &node_header, std::list &keys); void DeleteKeys (std::list &keys); + /* Abreviacion de Claves */ + void AbrevKey (std::list &lst); + void DeAbrevKey (std::list &lst); + std::string filename; BTreeFileHeader header; int key_type; + int tree_type; /** Apunta al archivo de datos, asi se abre solo 1 vez *