30 #ifndef __ZMQ_DECODER_HPP_INCLUDED__ 31 #define __ZMQ_DECODER_HPP_INCLUDED__ 57 template <
typename T,
typename A = c_single_allocator>
79 void get_buffer (
unsigned char **data_, std::size_t *size_)
107 int decode (
const unsigned char *data_, std::size_t size_,
108 std::size_t &bytes_used_)
123 (static_cast <T *> (
this)->*
next) (data_ + bytes_used_);
130 while (bytes_used_ < size_) {
132 const size_t to_copy = std::min (
to_read, size_ - bytes_used_);
135 if (
read_pos != data_ + bytes_used_) {
136 memcpy (
read_pos, data_ + bytes_used_, to_copy);
141 bytes_used_ += to_copy;
147 (static_cast <T *> (
this)->*
next) (data_ + bytes_used_);
171 read_pos = static_cast <
unsigned char*> (read_pos_);
void get_buffer(unsigned char **data_, std::size_t *size_)
decoder_base_t(A *allocator_)
virtual void resize_buffer(std::size_t new_size)
int decode(const unsigned char *data_, std::size_t size_, std::size_t &bytes_used_)
virtual ~decoder_base_t()
int(T::* step_t)(unsigned char const *)
const decoder_base_t & operator=(const decoder_base_t &)
void next_step(void *read_pos_, std::size_t to_read_, step_t next_)