#include <stdlib.h>
#include "clave.h"
#include "clave_fija.h"
+#include "clave_variable.h"
/** Dato a guardar en los nodos */
class BTreeData {
public:
BTreeData () {}
- BTreeData (uchar *node);
+ BTreeData (uchar *node, int tree_type);
BTreeData (Clave *k, uint child);
virtual ~BTreeData ();
virtual uchar *ToArray () const;
Clave* getClave () { return clave; }
+ uint getChild () { return hijo; }
+ void setChild (uint c) { hijo = c; }
bool operator < (const BTreeData &data) const;
+ bool operator == (const BTreeData &data) const;
virtual operator std::string () const {
std::string out = (*clave);
std::stringstream ss;
- ss << out << " ";
- ss << hijo;
+ ss << "(" << out ;
+ ss << ")" << "[" << hijo << "]";
ss >> out;
return out;
}
class BTreeLeafData:public BTreeData {
public:
BTreeLeafData (Clave *k) { clave = k; }
- BTreeLeafData (uchar *node) { clave = new ClaveFija (node); }
+ BTreeLeafData (uchar *node, int key_type);
virtual ~BTreeLeafData ();
virtual uint Size () const;
class BTreeChildData:public BTreeData {
public:
- BTreeChildData (uint child):BTreeData () { hijo = child; }
+ BTreeChildData (uint child):BTreeData () { hijo = child; clave = NULL; }
BTreeChildData (uchar *node);
virtual ~BTreeChildData ();
virtual operator std::string () const {
std::string out;
std::stringstream ss;
- ss << hijo;
+ ss << "|" << hijo << "|";
ss >> out;
return out;
}