Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to design a custom IO object for Boost.Asio
    primarykey
    data
    text
    <p>I have an base class (DeviceBase) representing an embedded device, with which I want to communicate. The device can be accessed in various ways, including USB and TCP sockets. Additionally, there is a mock implementation which works on files.</p> <p>Until now, I have only used synchronous read/write calls, and all the implementations are simply classes derived from the base class, overriding the read/write functions. This allows me to use polymorphic pointers and containers to provide implementation-independent access to the device to the application's logic.</p> <p>Now i want to use Boost.Asio to enable simple async IO. I have found this guide <a href="http://www.highscore.de/cpp/boost/asio.html" rel="nofollow">http://www.highscore.de/cpp/boost/asio.html</a> describing how to write your own extensions, but it is quite simplified, and I have stumbled upon some issues which aren't discussed there.</p> <ul> <li><p>Currently, all my implementations have different constructors (obviously, because of the different ways of addressing/initializing the device connection). The implementation class presented in the guide is constructed by the io_service, which means, the user can't pass arguments to the constructor.</p></li> <li><p>The example in the guide provides a template class in the form of <code>custom_io_object&lt;implementation&gt;</code>, which would prevent the usage of polymorphic pointers, because now there is no common base class to the different kinds of IO objects.</p></li> </ul> <p>Is there any form of documentation, or any books which discuss the design of Boost.Asio extensions? Do I overlook something?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload