30 #include <boost/cstdint.hpp>
36 using namespace boost;
41 const string Int64Converter::WIRE_SCHEMA =
"int64";
43 Int64Converter::Int64Converter() :
51 assert(data.first == this->getDataType());
53 boost::shared_ptr<int64_t> number = boost::static_pointer_cast<int64_t>(data.second);
55 for (int64_t i = 0; i < 8; ++i) {
56 wire[i] = (
unsigned char) ((*number & (0xffull << (i * 8ull))) >> (i * 8ull));
64 assert(wire.size() == 8);
66 boost::shared_ptr<int64_t> number(
new int64_t(0));
67 for (int64_t i = 0; i < 8; ++i) {
68 *number |= ((int64_t) ((
unsigned char) wire[i]) << (i * 8ull));
std::pair< std::string, boost::shared_ptr< void > > AnnotatedData
A combination of data type and the actual data.
std::string serialize(const AnnotatedData &data, std::string &wire)
Serialized the given domain object to the wire.
virtual std::string getDataType() const
Returns the name of the data type this converter is applicable for.
static const std::string WIRE_SCHEMA
AnnotatedData deserialize(const std::string &wireSchema, const std::string &wire)
Deserializes a domain object from a wire type.
virtual ~Int64Converter()