SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00009 // An output device for TCP/IP Network connections 00010 /****************************************************************************/ 00011 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00012 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00013 /****************************************************************************/ 00014 // 00015 // This file is part of SUMO. 00016 // SUMO is free software: you can redistribute it and/or modify 00017 // it under the terms of the GNU General Public License as published by 00018 // the Free Software Foundation, either version 3 of the License, or 00019 // (at your option) any later version. 00020 // 00021 /****************************************************************************/ 00022 #ifndef OutputDevice_Network_h 00023 #define OutputDevice_Network_h 00024 00025 00026 // =========================================================================== 00027 // included modules 00028 // =========================================================================== 00029 #ifdef _MSC_VER 00030 #include <windows_config.h> 00031 #else 00032 #include <config.h> 00033 #endif // #ifdef _MSC_VER 00034 00035 #include "foreign/tcpip/socket.h" 00036 #include "foreign/tcpip/storage.h" 00037 #include "OutputDevice.h" 00038 #include <utils/common/UtilExceptions.h> 00039 #include <string> 00040 #include <iostream> 00041 #include <sstream> 00042 00043 00044 // ========================================================================== 00045 // class definitions 00046 // ========================================================================== 00057 class OutputDevice_Network : public OutputDevice { 00058 public: 00065 OutputDevice_Network(const std::string& host, 00066 const int port); 00067 00068 00070 ~OutputDevice_Network() ; 00071 00072 00073 protected: 00076 00085 std::ostream& getOStream() ; 00086 00087 00093 virtual void postWriteHook() ; 00095 00096 private: 00098 std::ostringstream myMessage; 00099 00101 tcpip::Socket* mySocket; 00102 00103 }; 00104 00105 00106 #endif 00107 00108 /****************************************************************************/