+
+#include <string>
+#include "clave_variable.h"
+#include <iostream>
+
+ClaveVariable::ClaveVariable (const std::string &s)
+{
+ data = s;
+}
+
+ClaveVariable::ClaveVariable (uchar *n)
+{
+ uint len;
+
+ memcpy (&len, n, sizeof (uint));
+ uchar *str = new uchar[len+1];
+ n += sizeof (uint);
+ memcpy (str, n, sizeof (uchar)*len);
+ str[len] = '\0';
+ data = std::string ((const char *)(str));
+ std::cout << "CREE : " << data << std::endl;
+ delete [] str;
+}
+
+uint ClaveVariable::Size () const
+{
+ return data.size ()+sizeof (uint);
+}
+
+uchar *ClaveVariable::ToArray () const
+{
+ uchar *out;
+ uint len = data.size ();
+ out = new uchar[Size ()];
+ memcpy (out, &len, sizeof (uint));
+ memcpy (out+sizeof(uint), data.c_str (), data.size ());
+ return out;
+}
+
+Clave *ClaveVariable::Clone () const
+{
+ ClaveVariable *k = new ClaveVariable (*this);
+ return k;
+}
+
+bool ClaveVariable::operator < (const Clave &c) const
+{
+ return data < ((ClaveVariable&)c).data;
+}
+
+bool ClaveVariable::operator == (const Clave &c) const
+{
+ return data == ((ClaveVariable&)c).data;
+}
+