/src/lib/sequencer/events/can_read_data_from_stream.e

http://github.com/tybor/Liberty · Specman e · 62 lines · 29 code · 7 blank · 26 comment · 0 complexity · 5be259d39609825e36fb26b00d7f515d MD5 · raw file

  1. -- This file is part of a Liberty Eiffel library.
  2. -- See the full copyright at the end.
  3. --
  4. class CAN_READ_DATA_FROM_STREAM
  5. --
  6. -- Event: some data can be read from `input_stream'
  7. --
  8. inherit
  9. EVENT_DESCRIPTOR
  10. create {INPUT_STREAM}
  11. make
  12. feature {EVENTS_SET}
  13. expect (events: EVENTS_SET)
  14. do
  15. events.when_data(input_stream)
  16. set_expected(events)
  17. end
  18. occurred (events: EVENTS_SET): BOOLEAN
  19. do
  20. Result := events.is_data(input_stream)
  21. end
  22. feature {}
  23. input_stream: INPUT_STREAM
  24. make (a_input_stream: like input_stream)
  25. require
  26. not is_expected
  27. a_input_stream /= Void
  28. a_input_stream.is_connected
  29. a_input_stream.has_descriptor
  30. do
  31. input_stream := a_input_stream
  32. ensure
  33. input_stream = a_input_stream
  34. end
  35. end -- class CAN_READ_DATA_FROM_STREAM
  36. --
  37. -- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
  38. --
  39. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  40. -- of this software and associated documentation files (the "Software"), to deal
  41. -- in the Software without restriction, including without limitation the rights
  42. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  43. -- copies of the Software, and to permit persons to whom the Software is
  44. -- furnished to do so, subject to the following conditions:
  45. --
  46. -- The above copyright notice and this permission notice shall be included in
  47. -- all copies or substantial portions of the Software.
  48. --
  49. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  51. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  52. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  53. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  54. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  55. -- THE SOFTWARE.