46 template <
typename PacketType,
typename T>
struct decoder;
47 template <
typename PacketType>
struct decoder<PacketType, uint8_t> { uint8_t
operator()(
const PacketType& p)
const {
return static_cast<uint8_t
>(p.decode_integer(
sizeof(uint8_t))); } };
48 template <
typename PacketType>
struct decoder<PacketType, uint16_t> { uint16_t
operator()(
const PacketType& p)
const {
return static_cast<uint16_t
>(p.decode_integer(
sizeof(uint16_t))); } };
49 template <
typename PacketType>
struct decoder<PacketType, uint32_t> { uint32_t
operator()(
const PacketType& p)
const {
return static_cast<uint32_t
>(p.decode_integer(
sizeof(uint32_t))); } };
50 template <
typename PacketType>
struct decoder<PacketType, uint64_t> { uint64_t
operator()(
const PacketType& p)
const {
return static_cast<uint64_t
>(p.decode_integer(
sizeof(uint64_t))); } };
51 template <
typename PacketType>
struct decoder<PacketType, int8_t> { uint8_t
operator()(
const PacketType& p)
const {
return static_cast<int8_t
>(p.decode_integer(
sizeof(int8_t))); } };
52 template <
typename PacketType>
struct decoder<PacketType, int16_t> { uint8_t
operator()(
const PacketType& p)
const {
return static_cast<int16_t
>(p.decode_integer(
sizeof(int16_t))); } };
53 template <
typename PacketType>
struct decoder<PacketType, int32_t> { int32_t
operator()(
const PacketType& p)
const {
return static_cast<int32_t
>(p.decode_integer(
sizeof(int32_t))); } };
54 template <
typename PacketType>
struct decoder<PacketType, int64_t> { int64_t
operator()(
const PacketType& p)
const {
return static_cast<int64_t
>(p.decode_integer(
sizeof(int64_t))); } };
55 template <
typename PacketType>
struct decoder<PacketType, bool> {
bool operator()(
const PacketType& p)
const {
return p.decode_bool(); } };
56 template <
typename PacketType>
struct decoder<PacketType, typename PacketType::string_type> {
typename PacketType::string_type
operator()(
const PacketType& p)
const {
return p.decode_string(); } };
59 template <
typename CharType>
77 encode(
static_cast<uint64_t
>(aValue),
sizeof(uint8_t));
81 encode(
static_cast<uint64_t
>(aValue),
sizeof(uint16_t))
85 encode(
static_cast<uint64_t
>(aValue),
sizeof(uint32_t))
89 encode(
static_cast<uint64_t
>(aValue),
sizeof(uint64_t))
93 encode(
static_cast<uint64_t
>(aValue),
sizeof(int8_t));
97 encode(
static_cast<uint64_t
>(aValue),
sizeof(int16_t))
101 encode(
static_cast<uint64_t
>(aValue),
sizeof(int32_t))
105 encode(
static_cast<uint64_t
>(aValue),
sizeof(int64_t))
107 void encode(int64_t aValue, std::size_t aLength)
109 encode(
static_cast<uint64_t
>(aValue), aLength);
111 virtual void encode(uint64_t aValue, std::size_t aLength) = 0;
114 template <
typename T>
base_type::character_type character_type
void encode(int32_t aValue)
void encode(uint64_t aValue)
void encode(int8_t aValue)
void encode(int64_t aValue)
void encode(int64_t aValue, std::size_t aLength)
base_type::size_type size_type
virtual void encode(const string_type &aValue)=0
void encode(uint32_t aValue)
virtual uint64_t decode_integer(std::size_t aLength) const =0
virtual void encode(uint64_t aValue, std::size_t aLength)=0
virtual string_type decode_string() const =0
void encode(uint8_t aValue)
void encode(uint16_t aValue)
base_type::pointer pointer
base_type::iterator iterator
virtual bool decode_bool() const =0
void encode(int16_t aValue)
virtual void encode(bool aValue)=0
std::basic_string< CharType > string_type
base_type::const_pointer const_pointer
base_type::const_iterator const_iterator
const character_type * const_pointer
const_pointer const_iterator
basic_data_packet< char > data_packet
bool operator()(const PacketType &p) const
uint8_t operator()(const PacketType &p) const
int32_t operator()(const PacketType &p) const
int64_t operator()(const PacketType &p) const
uint8_t operator()(const PacketType &p) const
PacketType::string_type operator()(const PacketType &p) const
uint16_t operator()(const PacketType &p) const
uint32_t operator()(const PacketType &p) const
uint64_t operator()(const PacketType &p) const
uint8_t operator()(const PacketType &p) const