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));
24 uint ClaveVariable::Size () const
26 return data.size ()+sizeof (uint);
29 uchar *ClaveVariable::ToArray () const
32 uint len = data.size ();
33 out = new uchar[Size ()];
34 memcpy (out, &len, sizeof (uint));
35 memcpy (out+sizeof(uint), data.c_str (), data.size ());
39 Clave *ClaveVariable::Clone () const
41 ClaveVariable *k = new ClaveVariable (*this);
45 bool ClaveVariable::operator < (const Clave &c) const
47 return data < ((ClaveVariable&)c).data;
50 bool ClaveVariable::operator == (const Clave &c) const
52 return data == ((ClaveVariable&)c).data;