Implement "double" and "float" cql types.
This implementation doesn't touch serialization.hh (which should be
eventually removed) and rather follows the other examples in types.cc.
It is relatively ugly, because of all the cleverness of our "general"
byte swapping implementation actually works only for integer types, and
we need to get it to work for float/double as well.
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Tomek points out that:
Origin calls org.apache.cassandra.utils.Hex#hexToBytes here, which is
not what to_bytes() does. BytesType.getSerializer().toString() calls
ByteBufferUtil.bytesToHex(value), so you should call to_hex() here.
Fix that up.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Since types can be embedded at any position in memory we cannot assume
alignment.
Side note: It seems that on x86 access to the variable via packed<>
does not result in any extra instructions.
In v2: rebase, and add a more descriptive exception if trying to deserialize
an ipv6 address.
Add to list of types the Internet address type, known as INET in CQL
or as InetAddressType in the Cassandra code.
I based this code on stuff I found in InetAddressType and
InetAddressSerializer in the Cassandra code.
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
All usages I could find which deserialize value are
non-polymorphic. So there is no need to use boost::any() indirection
and polymorphic calls in most, if not all, cases.
Let the type class define deserialize_value/serialize_value
non-polymorphic members which work direclty on "value_type" and not
boost::any.