]> git.llucax.com Git - z.facultad/75.52/treemulator.git/blobdiff - viewer/view_btree.cpp
Muestro los datos borrados y que son recuperables.
[z.facultad/75.52/treemulator.git] / viewer / view_btree.cpp
index eb2e067249ff5bcdaa1fa6a8a7ea74eaa6a88f50..760429323e512325ed47b7312c30ebd2f8e23506 100644 (file)
@@ -19,6 +19,35 @@ ViewBTree::ViewBTree (Canvas::Group *parent, std::string filename, uint block_si
        last_visited = 0;
 }
 
        last_visited = 0;
 }
 
+ViewBTree::ViewBTree (Canvas::Group *parent, const std::string filename)
+       :Canvas::Group (*parent, 0, 0), BTree (filename)
+{
+       /* Cada bytes lo hago de 5 units de ancho */
+       node_width = 4 * header.block_size;
+       node_height = 50;
+       byte_to_pixels  = node_width/header.block_size;
+
+       last_selected = NULL;
+       last_visited = 0;
+}
+
+ViewBTree* ViewBTree::Open (Canvas::Group *parent, const std::string &filename)
+{
+       ViewBTree *tree = new ViewBTree (parent, filename);
+
+       if (tree->fp == NULL) {
+               delete tree;
+               return NULL;
+       }
+
+       /* El magic no coincide!! */
+       if (strcmp (tree->header.magic, "DILUMA")) {
+               delete tree;
+               return NULL;
+       }
+       return tree;
+}
+
 void ViewBTree::GoBack ()
 {
        uint l = back.top ();
 void ViewBTree::GoBack ()
 {
        uint l = back.top ();