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 /****************************************************************************/
16 // An output device for TCP/IP Network connections
17 /****************************************************************************/
18 #ifndef OutputDevice_Network_h
19 #define OutputDevice_Network_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h> // #ifdef _MSC_VER
26 
27 #include "foreign/tcpip/socket.h"
28 #include "foreign/tcpip/storage.h"
29 #include "OutputDevice.h"
31 #include <string>
32 #include <iostream>
33 #include <sstream>
34 
35 
36 // ==========================================================================
37 // class definitions
38 // ==========================================================================
50 public:
57  OutputDevice_Network(const std::string& host,
58  const int port);
59 
60 
63 
64 
65 protected:
68 
77  std::ostream& getOStream();
78 
79 
85  virtual void postWriteHook();
87 
88 private:
90  std::ostringstream myMessage;
91 
94 
95 };
96 
97 
98 #endif
99 
100 /****************************************************************************/
tcpip::Socket
Definition: socket.h:61
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
OutputDevice_Network::~OutputDevice_Network
~OutputDevice_Network()
Destructor.
Definition: OutputDevice_Network.cpp:61
OutputDevice.h
UtilExceptions.h
OutputDevice_Network::mySocket
tcpip::Socket * mySocket
the socket to transfer the data
Definition: OutputDevice_Network.h:93
OutputDevice_Network::myMessage
std::ostringstream myMessage
packet buffer
Definition: OutputDevice_Network.h:90
storage.h
OutputDevice_Network::OutputDevice_Network
OutputDevice_Network(const std::string &host, const int port)
Constructor.
Definition: OutputDevice_Network.cpp:36
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:74
OutputDevice_Network::getOStream
std::ostream & getOStream()
Returns the associated ostream.
Definition: OutputDevice_Network.cpp:68
OutputDevice_Network
An output device for TCP/IP network connections.
Definition: OutputDevice_Network.h:49