3 #include "clave_variable.h"
6 ClaveVariable::ClaveVariable (const std::string &s)
11 ClaveVariable::ClaveVariable (uchar *n)
15 memcpy (&len, n, sizeof (uint));
16 uchar *str = new uchar[len+1];
18 memcpy (str, n, sizeof (uchar)*len);
20 data = std::string ((const char *)(str));
21 std::cout << "CREE : " << data << std::endl;
25 uint ClaveVariable::Size () const
27 return data.size ()+sizeof (uint);
30 uchar *ClaveVariable::ToArray () const
33 uint len = data.size ();
34 out = new uchar[Size ()];
35 memcpy (out, &len, sizeof (uint));
36 memcpy (out+sizeof(uint), data.c_str (), data.size ());
40 Clave *ClaveVariable::Clone () const
42 ClaveVariable *k = new ClaveVariable (*this);
46 bool ClaveVariable::operator < (const Clave &c) const
48 return data < ((ClaveVariable&)c).data;
51 bool ClaveVariable::operator == (const Clave &c) const
53 return data == ((ClaveVariable&)c).data;