delete [] node;
}
+BTree::BTree (const std::string &name)
+{
+ fp = fopen (name.c_str(), "rb+");
+ if (!fp) {
+ /* TODO : mandar una exception ? */
+ return;
+ }
+ ReadFileHeader ();
+}
+
BTree::~BTree ()
{
fclose (fp);
}
+void BTree::ReadFileHeader ()
+{
+ fseek (fp, 0L, SEEK_SET);
+ fread (&header, 1, sizeof (BTreeFileHeader), fp);
+}
+
void BTree::WriteFileHeader ()
{
fseek (fp, 0L, SEEK_SET);
class BTree {
public:
BTree (const std::string &filename, unsigned int block_size, int t_t = TYPE_IDENTIFICACION, int k_t = KEY_FIXED, bool create_new_file = false);
+ BTree (const std::string &filename);
+
~BTree ();
/** Tipos de clave a usar */
/* Funciones de manejo de archivo */
void WriteFileHeader ();
+ void ReadFileHeader ();
/* Manejo de Bloques */
void WriteBlock (uchar *block, uint num);