WPILibC++
2020.3.2
raw_socket_ostream.h
1
/*----------------------------------------------------------------------------*/
2
/* Copyright (c) 2016-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_OSTREAM_H_
9
#define WPIUTIL_WPI_RAW_SOCKET_OSTREAM_H_
10
11
#include "wpi/raw_ostream.h"
12
13
namespace
wpi
{
14
15
class
NetworkStream;
16
17
class
raw_socket_ostream
:
public
raw_ostream
{
18
public
:
19
raw_socket_ostream
(
NetworkStream
& stream,
bool
shouldClose)
20
: m_stream(stream), m_shouldClose(shouldClose) {}
21
~
raw_socket_ostream
();
22
23
void
close();
24
25
bool
has_error()
const
{
return
m_error; }
26
void
clear_error() { m_error =
false
; }
27
28
protected
:
29
void
error_detected() { m_error =
true
; }
30
31
private
:
32
void
write_impl(
const
char
* data,
size_t
len)
override
;
33
uint64_t current_pos()
const override
;
34
35
NetworkStream
& m_stream;
36
bool
m_error =
false
;
37
bool
m_shouldClose;
38
};
39
40
}
// namespace wpi
41
42
#endif // WPIUTIL_WPI_RAW_SOCKET_OSTREAM_H_
wpi::raw_socket_ostream
Definition:
raw_socket_ostream.h:17
wpi
WPILib C++ utilities (wpiutil) namespace.
Definition:
EventLoopRunner.h:17
wpi::NetworkStream
Definition:
NetworkStream.h:17
wpi::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition:
raw_ostream.h:47
wpiutil
src
main
native
include
wpi
raw_socket_ostream.h
Generated on Fri Feb 21 2020 08:50:37 for WPILibC++ by
1.8.16