Eclipse SUMO - Simulation of Urban MObility
OutputDevice_Network.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2006-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // An output device for TCP/IP Network connections
18 /****************************************************************************/
19 #ifndef OutputDevice_Network_h
20 #define OutputDevice_Network_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h> // #ifdef _MSC_VER
27 
28 #include "foreign/tcpip/socket.h"
29 #include "foreign/tcpip/storage.h"
30 #include "OutputDevice.h"
32 #include <string>
33 #include <iostream>
34 #include <sstream>
35 
36 
37 // ==========================================================================
38 // class definitions
39 // ==========================================================================
51 public:
58  OutputDevice_Network(const std::string& host,
59  const int port);
60 
61 
64 
65 
66 protected:
69 
78  std::ostream& getOStream();
79 
80 
86  virtual void postWriteHook();
88 
89 private:
91  std::ostringstream myMessage;
92 
95 
96 };
97 
98 
99 #endif
100 
101 /****************************************************************************/
tcpip::Socket
Definition: socket.h:59
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
OutputDevice_Network::~OutputDevice_Network
~OutputDevice_Network()
Destructor.
Definition: OutputDevice_Network.cpp:71
OutputDevice.h
UtilExceptions.h
OutputDevice_Network::mySocket
tcpip::Socket * mySocket
the socket to transfer the data
Definition: OutputDevice_Network.h:94
OutputDevice_Network::myMessage
std::ostringstream myMessage
packet buffer
Definition: OutputDevice_Network.h:91
storage.h
OutputDevice_Network::OutputDevice_Network
OutputDevice_Network(const std::string &host, const int port)
Constructor.
Definition: OutputDevice_Network.cpp:42
socket.h
config.h
OutputDevice_Network::postWriteHook
virtual void postWriteHook()
Sends the data which was written to the string stream over the socket.
Definition: OutputDevice_Network.cpp:84
OutputDevice_Network::getOStream
std::ostream & getOStream()
Returns the associated ostream.
Definition: OutputDevice_Network.cpp:78
OutputDevice_Network
An output device for TCP/IP network connections.
Definition: OutputDevice_Network.h:50