From: Eugene Alterman (eugalt_at_[hidden])
Date: 2005-12-12 13:37:56
"Christopher Kohlhoff" <chris_at_[hidden]> wrote in message
> Hi Eugene,
> --- Eugene Alterman <eugalt_at_[hidden]> wrote:
>> The bottom line of my suggestion is to have 2 distinct
>> interfaces. One is for stream establishment and connection
>> properties management. It provides efficient protocol stack
>> layer navigation and access (but no stream i/o operations).
>> The other one is strictly layered streaming interface for data
>> Do you think it makes sense?
> Could you sketch out some rough code illustrating what you are
> thinking of? I'm having trouble seeing how it would fit
> together, in particular how you would transition from one
> interface the other.
I will call this interfaces core_socket and stream_socket respectively.
You always start with an object of a stream_socket class and then obtain a
reference to core_socket from it.
Let us first start with a design that does not change the current interface
of stream_socket. Define a new core_socket class template, and derive
stream_socket from it adding the stream functionality. Then we can define
lowest_layer_type as core_socket. This will solve the stream layering
problem since having a reference to core_socket of a lower layer would not
allow performing stream operations on it.
The next step would be to derive stream_socket privately from core_socket
and provide a public member function returning a reference to core_socket.
This would deal with any temptation to downcast a core_socket reference to
I hope I made myself clear now,
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk