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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
19 // An output device for TCP/IP Network connections
20 /****************************************************************************/
21 #ifndef OutputDevice_Network_h
22 #define OutputDevice_Network_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif // #ifdef _MSC_VER
33 
34 #include "foreign/tcpip/socket.h"
35 #include "foreign/tcpip/storage.h"
36 #include "OutputDevice.h"
38 #include <string>
39 #include <iostream>
40 #include <sstream>
41 
42 
43 // ==========================================================================
44 // class definitions
45 // ==========================================================================
57 public:
64  OutputDevice_Network(const std::string& host,
65  const int port);
66 
67 
70 
71 
72 protected:
75 
84  std::ostream& getOStream();
85 
86 
92  virtual void postWriteHook();
94 
95 private:
97  std::ostringstream myMessage;
98 
101 
102 };
103 
104 
105 #endif
106 
107 /****************************************************************************/
tcpip::Socket * mySocket
the socket to transfer the data
An output device for TCP/IP network connections.
OutputDevice_Network(const std::string &host, const int port)
Constructor.
std::ostream & getOStream()
Returns the associated ostream.
std::ostringstream myMessage
packet buffer
~OutputDevice_Network()
Destructor.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
virtual void postWriteHook()
Sends the data which was written to the string stream over the socket.