ANY NONE STREAM
deferred class interface FILTER
   --
   -- A filter is something connected to another stream. It allows to add behaviour (e.g. compression, encryption
   -- and any other codings)
   --
   -- There are two kinds of filters:
   -- + input filters (see FILTER_INPUT_STREAM)
   -- + output filters (see FILTER_OUTPUT_STREAM)
   --
   --*** Note that currently FILTER is inserted (not inherited) by FILTER_INPUT_STREAM and FILTER_OUTPUT_STREAM
   -- (due to limitations of the new Eiffel way, or bugs of the compiler, I don't know)
   --

feature(s) from FILTER
   connect_to (a_stream: STREAM)
      -- Connect the filter to some underlying stream.
      require
         not is_connected;
         a_stream.is_connected;
         not a_stream.is_filtered
      ensure
         is_connected

   is_connected: BOOLEAN
      -- True if the filter is connected to some underlying stream.

   disconnect
      -- Disconnect from the underlying stream.
      require
         is_connected
      ensure
         not is_connected;
         stream = Void

feature(s) from FILTER
   stream: STREAM
      -- The underlying stream (i.e. the filtered one)

feature(s) from FILTER
   do_detach
      -- Used by the underlying stream to require not to be filtered anymore


invariant

    stream /= Void implies stream.filter = Current;

end of deferred FILTER