#include <string>
#include "clave_fija.h"
-ClaveFija::ClaveFija (int n)
+ClaveFija::ClaveFija (int n, uint bd)
{
data = n;
+ block_data = bd;
}
ClaveFija::ClaveFija (uchar *n)
{
memcpy (&data, n, sizeof(int));
+ memcpy (&block_data, n+sizeof(int), sizeof(int));
}
uint ClaveFija::Size () const
{
- return sizeof (int);
+ return sizeof (int)+sizeof(uint);
}
uchar *ClaveFija::ToArray () const
{
uchar *out;
- out = new uchar[sizeof(int)];
+ out = new uchar[Size ()];
memcpy (out, &data, sizeof(int));
+ memcpy (out+sizeof (int), &block_data, sizeof(int));
return out;
}
return data < ((ClaveFija&)c).data;
}
+bool ClaveFija::operator == (const Clave &c) const
+{
+ return data == ((ClaveFija&)c).data;
+}
+
+uchar *ClaveFija::ToRaw (uint &size) const
+{
+ size = Size ();
+ return ToArray ();
+}
+