Realistic 3D camera system
3D camera system components
write.hpp
Go to the documentation of this file.
1 //
2 // impl/write.hpp
3 // ~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 //
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 //
10 
11 #ifndef ASIO_IMPL_WRITE_HPP
12 #define ASIO_IMPL_WRITE_HPP
13 
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 
18 #include "asio/buffer.hpp"
30 
32 
33 namespace asio {
34 
35 template <typename SyncWriteStream, typename ConstBufferSequence,
36  typename CompletionCondition>
37 std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers,
38  CompletionCondition completion_condition, asio::error_code& ec)
39 {
40  ec = asio::error_code();
42  const_buffer, ConstBufferSequence> tmp(buffers);
43  std::size_t total_transferred = 0;
45  completion_condition(ec, total_transferred)));
46  while (tmp.begin() != tmp.end())
47  {
48  std::size_t bytes_transferred = s.write_some(tmp, ec);
49  tmp.consume(bytes_transferred);
50  total_transferred += bytes_transferred;
52  completion_condition(ec, total_transferred)));
53  }
54  return total_transferred;
55 }
56 
57 template <typename SyncWriteStream, typename ConstBufferSequence>
58 inline std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers)
59 {
61  std::size_t bytes_transferred = write(s, buffers, transfer_all(), ec);
62  asio::detail::throw_error(ec, "write");
63  return bytes_transferred;
64 }
65 
66 template <typename SyncWriteStream, typename ConstBufferSequence>
67 inline std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers,
68  asio::error_code& ec)
69 {
70  return write(s, buffers, transfer_all(), ec);
71 }
72 
73 template <typename SyncWriteStream, typename ConstBufferSequence,
74  typename CompletionCondition>
75 inline std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers,
76  CompletionCondition completion_condition)
77 {
79  std::size_t bytes_transferred = write(s, buffers, completion_condition, ec);
80  asio::detail::throw_error(ec, "write");
81  return bytes_transferred;
82 }
83 
84 #if !defined(ASIO_NO_IOSTREAM)
85 
86 template <typename SyncWriteStream, typename Allocator,
87  typename CompletionCondition>
88 std::size_t write(SyncWriteStream& s,
90  CompletionCondition completion_condition, asio::error_code& ec)
91 {
92  std::size_t bytes_transferred = write(s, b.data(), completion_condition, ec);
93  b.consume(bytes_transferred);
94  return bytes_transferred;
95 }
96 
97 template <typename SyncWriteStream, typename Allocator>
98 inline std::size_t write(SyncWriteStream& s,
100 {
101  asio::error_code ec;
102  std::size_t bytes_transferred = write(s, b, transfer_all(), ec);
103  asio::detail::throw_error(ec, "write");
104  return bytes_transferred;
105 }
106 
107 template <typename SyncWriteStream, typename Allocator>
108 inline std::size_t write(SyncWriteStream& s,
110  asio::error_code& ec)
111 {
112  return write(s, b, transfer_all(), ec);
113 }
114 
115 template <typename SyncWriteStream, typename Allocator,
116  typename CompletionCondition>
117 inline std::size_t write(SyncWriteStream& s,
119  CompletionCondition completion_condition)
120 {
121  asio::error_code ec;
122  std::size_t bytes_transferred = write(s, b, completion_condition, ec);
123  asio::detail::throw_error(ec, "write");
124  return bytes_transferred;
125 }
126 
127 #endif // !defined(ASIO_NO_IOSTREAM)
128 
129 namespace detail
130 {
131  template <typename AsyncWriteStream, typename ConstBufferSequence,
132  typename CompletionCondition, typename WriteHandler>
133  class write_op
134  : detail::base_from_completion_cond<CompletionCondition>
135  {
136  public:
137  write_op(AsyncWriteStream& stream, const ConstBufferSequence& buffers,
138  CompletionCondition completion_condition, WriteHandler& handler)
139  : detail::base_from_completion_cond<
140  CompletionCondition>(completion_condition),
141  stream_(stream),
142  buffers_(buffers),
143  start_(0),
145  handler_(ASIO_MOVE_CAST(WriteHandler)(handler))
146  {
147  }
148 
149 #if defined(ASIO_HAS_MOVE)
150  write_op(const write_op& other)
152  stream_(other.stream_),
153  buffers_(other.buffers_),
154  start_(other.start_),
156  handler_(other.handler_)
157  {
158  }
159 
160  write_op(write_op&& other)
162  stream_(other.stream_),
163  buffers_(other.buffers_),
164  start_(other.start_),
166  handler_(ASIO_MOVE_CAST(WriteHandler)(other.handler_))
167  {
168  }
169 #endif // defined(ASIO_HAS_MOVE)
170 
171  void operator()(const asio::error_code& ec,
172  std::size_t bytes_transferred, int start = 0)
173  {
174  switch (start_ = start)
175  {
176  case 1:
178  for (;;)
179  {
180  stream_.async_write_some(buffers_,
181  ASIO_MOVE_CAST(write_op)(*this));
182  return; default:
183  total_transferred_ += bytes_transferred;
184  buffers_.consume(bytes_transferred);
186  if ((!ec && bytes_transferred == 0)
187  || buffers_.begin() == buffers_.end())
188  break;
189  }
190 
191  handler_(ec, static_cast<const std::size_t&>(total_transferred_));
192  }
193  }
194 
195  //private:
196  AsyncWriteStream& stream_;
198  const_buffer, ConstBufferSequence> buffers_;
199  int start_;
200  std::size_t total_transferred_;
201  WriteHandler handler_;
202  };
203 
204  template <typename AsyncWriteStream,
205  typename CompletionCondition, typename WriteHandler>
206  class write_op<AsyncWriteStream, asio::mutable_buffers_1,
207  CompletionCondition, WriteHandler>
208  : detail::base_from_completion_cond<CompletionCondition>
209  {
210  public:
211  write_op(AsyncWriteStream& stream,
213  CompletionCondition completion_condition,
214  WriteHandler& handler)
215  : detail::base_from_completion_cond<
216  CompletionCondition>(completion_condition),
217  stream_(stream),
218  buffer_(buffers),
219  start_(0),
221  handler_(ASIO_MOVE_CAST(WriteHandler)(handler))
222  {
223  }
224 
225 #if defined(ASIO_HAS_MOVE)
226  write_op(const write_op& other)
228  stream_(other.stream_),
229  buffer_(other.buffer_),
230  start_(other.start_),
232  handler_(other.handler_)
233  {
234  }
235 
236  write_op(write_op&& other)
238  stream_(other.stream_),
239  buffer_(other.buffer_),
240  start_(other.start_),
242  handler_(ASIO_MOVE_CAST(WriteHandler)(other.handler_))
243  {
244  }
245 #endif // defined(ASIO_HAS_MOVE)
246 
247  void operator()(const asio::error_code& ec,
248  std::size_t bytes_transferred, int start = 0)
249  {
250  std::size_t n = 0;
251  switch (start_ = start)
252  {
253  case 1:
255  for (;;)
256  {
257  stream_.async_write_some(
258  asio::buffer(buffer_ + total_transferred_, n),
259  ASIO_MOVE_CAST(write_op)(*this));
260  return; default:
261  total_transferred_ += bytes_transferred;
262  if ((!ec && bytes_transferred == 0)
263  || (n = this->check_for_completion(ec, total_transferred_)) == 0
264  || total_transferred_ == asio::buffer_size(buffer_))
265  break;
266  }
267 
268  handler_(ec, static_cast<const std::size_t&>(total_transferred_));
269  }
270  }
271 
272  //private:
273  AsyncWriteStream& stream_;
275  int start_;
276  std::size_t total_transferred_;
277  WriteHandler handler_;
278  };
279 
280  template <typename AsyncWriteStream,
281  typename CompletionCondition, typename WriteHandler>
282  class write_op<AsyncWriteStream, asio::const_buffers_1,
283  CompletionCondition, WriteHandler>
284  : detail::base_from_completion_cond<CompletionCondition>
285  {
286  public:
287  write_op(AsyncWriteStream& stream,
289  CompletionCondition completion_condition,
290  WriteHandler& handler)
291  : detail::base_from_completion_cond<
292  CompletionCondition>(completion_condition),
293  stream_(stream),
294  buffer_(buffers),
295  start_(0),
297  handler_(ASIO_MOVE_CAST(WriteHandler)(handler))
298  {
299  }
300 
301 #if defined(ASIO_HAS_MOVE)
302  write_op(const write_op& other)
304  stream_(other.stream_),
305  buffer_(other.buffer_),
306  start_(other.start_),
308  handler_(other.handler_)
309  {
310  }
311 
312  write_op(write_op&& other)
314  stream_(other.stream_),
315  buffer_(other.buffer_),
316  start_(other.start_),
318  handler_(ASIO_MOVE_CAST(WriteHandler)(other.handler_))
319  {
320  }
321 #endif // defined(ASIO_HAS_MOVE)
322 
323  void operator()(const asio::error_code& ec,
324  std::size_t bytes_transferred, int start = 0)
325  {
326  std::size_t n = 0;
327  switch (start_ = start)
328  {
329  case 1:
331  for (;;)
332  {
333  stream_.async_write_some(
334  asio::buffer(buffer_ + total_transferred_, n),
335  ASIO_MOVE_CAST(write_op)(*this));
336  return; default:
337  total_transferred_ += bytes_transferred;
338  if ((!ec && bytes_transferred == 0)
339  || (n = this->check_for_completion(ec, total_transferred_)) == 0
340  || total_transferred_ == asio::buffer_size(buffer_))
341  break;
342  }
343 
344  handler_(ec, static_cast<const std::size_t&>(total_transferred_));
345  }
346  }
347 
348  //private:
349  AsyncWriteStream& stream_;
351  int start_;
352  std::size_t total_transferred_;
353  WriteHandler handler_;
354  };
355 
356  template <typename AsyncWriteStream, typename Elem,
357  typename CompletionCondition, typename WriteHandler>
358  class write_op<AsyncWriteStream, boost::array<Elem, 2>,
359  CompletionCondition, WriteHandler>
360  : detail::base_from_completion_cond<CompletionCondition>
361  {
362  public:
363  write_op(AsyncWriteStream& stream, const boost::array<Elem, 2>& buffers,
364  CompletionCondition completion_condition, WriteHandler& handler)
365  : detail::base_from_completion_cond<
366  CompletionCondition>(completion_condition),
367  stream_(stream),
368  buffers_(buffers),
369  start_(0),
371  handler_(ASIO_MOVE_CAST(WriteHandler)(handler))
372  {
373  }
374 
375 #if defined(ASIO_HAS_MOVE)
376  write_op(const write_op& other)
378  stream_(other.stream_),
379  buffers_(other.buffers_),
380  start_(other.start_),
382  handler_(other.handler_)
383  {
384  }
385 
386  write_op(write_op&& other)
388  stream_(other.stream_),
389  buffers_(other.buffers_),
390  start_(other.start_),
392  handler_(ASIO_MOVE_CAST(WriteHandler)(other.handler_))
393  {
394  }
395 #endif // defined(ASIO_HAS_MOVE)
396 
397  void operator()(const asio::error_code& ec,
398  std::size_t bytes_transferred, int start = 0)
399  {
400  typename asio::detail::dependent_type<Elem,
401  boost::array<asio::const_buffer, 2> >::type bufs = {{
404  std::size_t buffer_size0 = asio::buffer_size(bufs[0]);
405  std::size_t buffer_size1 = asio::buffer_size(bufs[1]);
406  std::size_t n = 0;
407  switch (start_ = start)
408  {
409  case 1:
411  for (;;)
412  {
413  bufs[0] = asio::buffer(bufs[0] + total_transferred_, n);
414  bufs[1] = asio::buffer(
415  bufs[1] + (total_transferred_ < buffer_size0
416  ? 0 : total_transferred_ - buffer_size0),
417  n - asio::buffer_size(bufs[0]));
418  stream_.async_write_some(bufs, ASIO_MOVE_CAST(write_op)(*this));
419  return; default:
420  total_transferred_ += bytes_transferred;
421  if ((!ec && bytes_transferred == 0)
422  || (n = this->check_for_completion(ec, total_transferred_)) == 0
423  || total_transferred_ == buffer_size0 + buffer_size1)
424  break;
425  }
426 
427  handler_(ec, static_cast<const std::size_t&>(total_transferred_));
428  }
429  }
430 
431  //private:
432  AsyncWriteStream& stream_;
434  int start_;
435  std::size_t total_transferred_;
436  WriteHandler handler_;
437  };
438 
439 #if defined(ASIO_HAS_STD_ARRAY)
440 
441  template <typename AsyncWriteStream, typename Elem,
442  typename CompletionCondition, typename WriteHandler>
443  class write_op<AsyncWriteStream, std::array<Elem, 2>,
444  CompletionCondition, WriteHandler>
445  : detail::base_from_completion_cond<CompletionCondition>
446  {
447  public:
448  write_op(AsyncWriteStream& stream, const std::array<Elem, 2>& buffers,
449  CompletionCondition completion_condition, WriteHandler& handler)
451  CompletionCondition>(completion_condition),
452  stream_(stream),
453  buffers_(buffers),
454  start_(0),
456  handler_(ASIO_MOVE_CAST(WriteHandler)(handler))
457  {
458  }
459 
460 #if defined(ASIO_HAS_MOVE)
461  write_op(const write_op& other)
463  stream_(other.stream_),
464  buffers_(other.buffers_),
465  start_(other.start_),
467  handler_(other.handler_)
468  {
469  }
470 
471  write_op(write_op&& other)
473  stream_(other.stream_),
474  buffers_(other.buffers_),
475  start_(other.start_),
477  handler_(ASIO_MOVE_CAST(WriteHandler)(other.handler_))
478  {
479  }
480 #endif // defined(ASIO_HAS_MOVE)
481 
482  void operator()(const asio::error_code& ec,
483  std::size_t bytes_transferred, int start = 0)
484  {
485  typename asio::detail::dependent_type<Elem,
486  std::array<asio::const_buffer, 2> >::type bufs = {{
489  std::size_t buffer_size0 = asio::buffer_size(bufs[0]);
490  std::size_t buffer_size1 = asio::buffer_size(bufs[1]);
491  std::size_t n = 0;
492  switch (start_ = start)
493  {
494  case 1:
496  for (;;)
497  {
498  bufs[0] = asio::buffer(bufs[0] + total_transferred_, n);
499  bufs[1] = asio::buffer(
500  bufs[1] + (total_transferred_ < buffer_size0
501  ? 0 : total_transferred_ - buffer_size0),
502  n - asio::buffer_size(bufs[0]));
503  stream_.async_write_some(bufs, ASIO_MOVE_CAST(write_op)(*this));
504  return; default:
505  total_transferred_ += bytes_transferred;
506  if ((!ec && bytes_transferred == 0)
507  || (n = this->check_for_completion(ec, total_transferred_)) == 0
508  || total_transferred_ == buffer_size0 + buffer_size1)
509  break;
510  }
511 
512  handler_(ec, static_cast<const std::size_t&>(total_transferred_));
513  }
514  }
515 
516  //private:
517  AsyncWriteStream& stream_;
518  std::array<Elem, 2> buffers_;
519  int start_;
520  std::size_t total_transferred_;
521  WriteHandler handler_;
522  };
523 
524 #endif // defined(ASIO_HAS_STD_ARRAY)
525 
526  template <typename AsyncWriteStream, typename ConstBufferSequence,
527  typename CompletionCondition, typename WriteHandler>
528  inline void* asio_handler_allocate(std::size_t size,
529  write_op<AsyncWriteStream, ConstBufferSequence,
530  CompletionCondition, WriteHandler>* this_handler)
531  {
533  size, this_handler->handler_);
534  }
535 
536  template <typename AsyncWriteStream, typename ConstBufferSequence,
537  typename CompletionCondition, typename WriteHandler>
538  inline void asio_handler_deallocate(void* pointer, std::size_t size,
539  write_op<AsyncWriteStream, ConstBufferSequence,
540  CompletionCondition, WriteHandler>* this_handler)
541  {
543  pointer, size, this_handler->handler_);
544  }
545 
546  template <typename AsyncWriteStream, typename ConstBufferSequence,
547  typename CompletionCondition, typename WriteHandler>
549  write_op<AsyncWriteStream, ConstBufferSequence,
550  CompletionCondition, WriteHandler>* this_handler)
551  {
552  return this_handler->start_ == 0 ? true
554  this_handler->handler_);
555  }
556 
557  template <typename Function, typename AsyncWriteStream,
558  typename ConstBufferSequence, typename CompletionCondition,
559  typename WriteHandler>
560  inline void asio_handler_invoke(Function& function,
561  write_op<AsyncWriteStream, ConstBufferSequence,
562  CompletionCondition, WriteHandler>* this_handler)
563  {
565  function, this_handler->handler_);
566  }
567 
568  template <typename Function, typename AsyncWriteStream,
569  typename ConstBufferSequence, typename CompletionCondition,
570  typename WriteHandler>
571  inline void asio_handler_invoke(const Function& function,
572  write_op<AsyncWriteStream, ConstBufferSequence,
573  CompletionCondition, WriteHandler>* this_handler)
574  {
576  function, this_handler->handler_);
577  }
578 } // namespace detail
579 
580 template <typename AsyncWriteStream, typename ConstBufferSequence,
581  typename CompletionCondition, typename WriteHandler>
582 inline ASIO_INITFN_RESULT_TYPE(WriteHandler,
583  void (asio::error_code, std::size_t))
584 async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
585  CompletionCondition completion_condition,
586  ASIO_MOVE_ARG(WriteHandler) handler)
587 {
588  // If you get an error on the following line it means that your handler does
589  // not meet the documented type requirements for a WriteHandler.
590  ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
591 
593  WriteHandler, void (asio::error_code, std::size_t)> init(
594  ASIO_MOVE_CAST(WriteHandler)(handler));
595 
596  detail::write_op<AsyncWriteStream, ConstBufferSequence,
597  CompletionCondition, ASIO_HANDLER_TYPE(
598  WriteHandler, void (asio::error_code, std::size_t))>(
600  asio::error_code(), 0, 1);
601 
602  return init.result.get();
603 }
604 
605 template <typename AsyncWriteStream, typename ConstBufferSequence,
606  typename WriteHandler>
607 inline ASIO_INITFN_RESULT_TYPE(WriteHandler,
608  void (asio::error_code, std::size_t))
609 async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
610  ASIO_MOVE_ARG(WriteHandler) handler)
611 {
612  // If you get an error on the following line it means that your handler does
613  // not meet the documented type requirements for a WriteHandler.
614  ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
615 
617  WriteHandler, void (asio::error_code, std::size_t)> init(
618  ASIO_MOVE_CAST(WriteHandler)(handler));
619 
620  detail::write_op<AsyncWriteStream, ConstBufferSequence,
622  WriteHandler, void (asio::error_code, std::size_t))>(
623  s, buffers, transfer_all(), init.handler)(
624  asio::error_code(), 0, 1);
625 
626  return init.result.get();
627 }
628 
629 #if !defined(ASIO_NO_IOSTREAM)
630 
631 namespace detail
632 {
633  template <typename Allocator, typename WriteHandler>
635  {
636  public:
638  WriteHandler& handler)
639  : streambuf_(streambuf),
640  handler_(ASIO_MOVE_CAST(WriteHandler)(handler))
641  {
642  }
643 
644 #if defined(ASIO_HAS_MOVE)
646  : streambuf_(other.streambuf_),
647  handler_(other.handler_)
648  {
649  }
650 
652  : streambuf_(other.streambuf_),
653  handler_(ASIO_MOVE_CAST(WriteHandler)(other.handler_))
654  {
655  }
656 #endif // defined(ASIO_HAS_MOVE)
657 
658  void operator()(const asio::error_code& ec,
659  const std::size_t bytes_transferred)
660  {
661  streambuf_.consume(bytes_transferred);
662  handler_(ec, bytes_transferred);
663  }
664 
665  //private:
667  WriteHandler handler_;
668  };
669 
670  template <typename Allocator, typename WriteHandler>
671  inline void* asio_handler_allocate(std::size_t size,
673  {
675  size, this_handler->handler_);
676  }
677 
678  template <typename Allocator, typename WriteHandler>
679  inline void asio_handler_deallocate(void* pointer, std::size_t size,
681  {
683  pointer, size, this_handler->handler_);
684  }
685 
686  template <typename Allocator, typename WriteHandler>
689  {
691  this_handler->handler_);
692  }
693 
694  template <typename Function, typename Allocator, typename WriteHandler>
695  inline void asio_handler_invoke(Function& function,
697  {
699  function, this_handler->handler_);
700  }
701 
702  template <typename Function, typename Allocator, typename WriteHandler>
703  inline void asio_handler_invoke(const Function& function,
705  {
707  function, this_handler->handler_);
708  }
709 } // namespace detail
710 
711 template <typename AsyncWriteStream, typename Allocator,
712  typename CompletionCondition, typename WriteHandler>
713 inline ASIO_INITFN_RESULT_TYPE(WriteHandler,
714  void (asio::error_code, std::size_t))
715 async_write(AsyncWriteStream& s,
717  CompletionCondition completion_condition,
718  ASIO_MOVE_ARG(WriteHandler) handler)
719 {
720  // If you get an error on the following line it means that your handler does
721  // not meet the documented type requirements for a WriteHandler.
722  ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
723 
725  WriteHandler, void (asio::error_code, std::size_t)> init(
726  ASIO_MOVE_CAST(WriteHandler)(handler));
727 
728  async_write(s, b.data(), completion_condition,
730  WriteHandler, void (asio::error_code, std::size_t))>(
731  b, init.handler));
732 
733  return init.result.get();
734 }
735 
736 template <typename AsyncWriteStream, typename Allocator, typename WriteHandler>
737 inline ASIO_INITFN_RESULT_TYPE(WriteHandler,
738  void (asio::error_code, std::size_t))
739 async_write(AsyncWriteStream& s,
741  ASIO_MOVE_ARG(WriteHandler) handler)
742 {
743  // If you get an error on the following line it means that your handler does
744  // not meet the documented type requirements for a WriteHandler.
745  ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
746 
748  WriteHandler, void (asio::error_code, std::size_t)> init(
749  ASIO_MOVE_CAST(WriteHandler)(handler));
750 
751  async_write(s, b.data(), transfer_all(),
753  WriteHandler, void (asio::error_code, std::size_t))>(
754  b, init.handler));
755 
756  return init.result.get();
757 }
758 
759 #endif // !defined(ASIO_NO_IOSTREAM)
760 
761 } // namespace asio
762 
764 
765 #endif // ASIO_IMPL_WRITE_HPP
void asio_handler_deallocate(void *pointer, std::size_t size, binder1< Handler, Arg1 > *this_handler)
WriteHandler handler_
Definition: write.hpp:201
void throw_error(const asio::error_code &err)
Definition: throw_error.hpp:31
write_op(AsyncWriteStream &stream, const ConstBufferSequence &buffers, CompletionCondition completion_condition, WriteHandler &handler)
Definition: write.hpp:137
void operator()(const asio::error_code &ec, std::size_t bytes_transferred, int start=0)
Definition: write.hpp:397
Holds a buffer that cannot be modified.
Definition: buffer.hpp:211
SocketService & s
Definition: connect.hpp:521
write_op(AsyncWriteStream &stream, const asio::const_buffers_1 &buffers, CompletionCondition completion_condition, WriteHandler &handler)
Definition: write.hpp:287
std::size_t check_for_completion(const asio::error_code &ec, std::size_t total_transferred)
write_op(AsyncWriteStream &stream, const boost::array< Elem, 2 > &buffers, CompletionCondition completion_condition, WriteHandler &handler)
Definition: write.hpp:363
void * asio_handler_allocate(std::size_t size, binder1< Handler, Arg1 > *this_handler)
asio::detail::consuming_buffers< const_buffer, ConstBufferSequence > buffers_
Definition: write.hpp:198
asio::basic_streambuf< Allocator > MatchCondition enable_if< is_match_condition< MatchCondition >::value >::type *detail::async_result_init< ReadHandler, void(asio::error_code, std::size_t)> init(ASIO_MOVE_CAST(ReadHandler)(handler))
void operator()(const asio::error_code &ec, const std::size_t bytes_transferred)
Definition: write.hpp:658
#define ASIO_HANDLER_TYPE(h, sig)
std::size_t write(SyncWriteStream &s, const ConstBufferSequence &buffers, CompletionCondition completion_condition, asio::error_code &ec)
Write a certain amount of data to a stream before returning.
Definition: write.hpp:37
STL namespace.
mutable_buffers_1 buffer(const mutable_buffer &b)
Create a new modifiable buffer from an existing buffer.
Definition: buffer.hpp:706
write_op(AsyncWriteStream &stream, const asio::mutable_buffers_1 &buffers, CompletionCondition completion_condition, WriteHandler &handler)
Definition: write.hpp:211
detail::transfer_all_t transfer_all()
write_streambuf_handler(asio::basic_streambuf< Allocator > &streambuf, WriteHandler &handler)
Definition: write.hpp:637
asio::basic_streambuf< Allocator > & b
Definition: read.hpp:702
ASIO_INITFN_RESULT_TYPE(ComposedConnectHandler, void(asio::error_code, Iterator)) async_connect(basic_socket< Protocol
std::size_t buffer_size(const mutable_buffer &b)
Get the number of bytes in a modifiable buffer.
Definition: buffer.hpp:357
void operator()(const asio::error_code &ec, std::size_t bytes_transferred, int start=0)
Definition: write.hpp:171
void invoke(Function &function, Context &context)
const MutableBufferSequence & buffers
Definition: read.hpp:521
Holds a buffer that can be modified.
Definition: buffer.hpp:91
void operator()(const asio::error_code &ec, std::size_t bytes_transferred, int start=0)
Definition: write.hpp:323
void asio_handler_invoke(Function &function, binder1< Handler, Arg1 > *this_handler)
AsyncWriteStream & stream_
Definition: write.hpp:196
asio::basic_streambuf< Allocator > CompletionCondition ASIO_MOVE_ARG(ReadHandler) handler)
Definition: read.hpp:704
bool is_continuation(Context &context)
Class to represent an error code value.
Definition: error_code.hpp:80
void deallocate(void *p, std::size_t s, Handler &h)
std::size_t adapt_completion_condition_result(bool result)
Automatically resizable buffer class based on std::streambuf.
asio::basic_streambuf< Allocator > & streambuf_
Definition: write.hpp:666
void * allocate(std::size_t s, Handler &h)
const MutableBufferSequence CompletionCondition completion_condition
Definition: read.hpp:521
handler_type< Handler, Signature >::type handler
#define ASIO_MOVE_CAST(type)
Definition: config.hpp:138
async_result< typename handler_type< Handler, Signature >::type > result
const_buffers_type data() const
Get a list of buffers that represents the input sequence.
void consume(std::size_t n)
Remove characters from the input sequence.
void operator()(const asio::error_code &ec, std::size_t bytes_transferred, int start=0)
Definition: write.hpp:247
#define ASIO_WRITE_HANDLER_CHECK(handler_type, handler)
bool asio_handler_is_continuation(binder1< Handler, Arg1 > *this_handler)
std::size_t total_transferred_
Definition: write.hpp:200