WPILibC++  2020.3.2-60-g3011ebe
raw_socket_istream.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2015-2018 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #ifndef WPIUTIL_WPI_RAW_SOCKET_ISTREAM_H_
9 #define WPIUTIL_WPI_RAW_SOCKET_ISTREAM_H_
10 
11 #include "wpi/raw_istream.h"
12 
13 namespace wpi {
14 
15 class NetworkStream;
16 
18  public:
19  explicit raw_socket_istream(NetworkStream& stream, int timeout = 0)
20  : m_stream(stream), m_timeout(timeout) {}
21 
22  void close() override;
23  size_t in_avail() const override;
24 
25  private:
26  void read_impl(void* data, size_t len) override;
27 
28  NetworkStream& m_stream;
29  int m_timeout;
30 };
31 
32 } // namespace wpi
33 
34 #endif // WPIUTIL_WPI_RAW_SOCKET_ISTREAM_H_
wpi::raw_istream
Definition: raw_istream.h:26
wpi
WPILib C++ utilities (wpiutil) namespace.
Definition: Endian.h:31
wpi::NetworkStream
Definition: NetworkStream.h:17
wpi::raw_socket_istream
Definition: raw_socket_istream.h:17