1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-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 /****************************************************************************/
10 /// @file    OutputDeviceMock.h
11 /// @author  Matthias Heppner
12 /// @author  Michael Behrisch
13 /// @date    2009-11-23
14 /// @version $Id$
15 ///
16 //
17 /****************************************************************************/
18 
19 #ifndef OutputDeviceMock_h
20 #define OutputDeviceMock_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <fstream>
29 #include <utils/iodevices/OutputDevice.h>
30 
31 
32 // ===========================================================================
33 // class definitions
34 // ===========================================================================
35 /**
36  * @class OutputDeviceMock
37  * Mock Implementation for Unit Tests
38  *
39  */
40 class OutputDeviceMock : public OutputDevice {
41 public:
42     /** @brief Constructor
43      */
OutputDeviceMock()44 	OutputDeviceMock() {}
45 
46     /// @brief Destructor
~OutputDeviceMock()47 	~OutputDeviceMock()  {}
48 
49 
50     /** @brief Returns the current content as a string
51      */
getString()52     std::string getString()  {
53         return myStream.str();
54     }
55 
56 protected:
57     /** @brief Returns the associated ostream
58      */
getOStream()59     std::ostream &getOStream()  {
60         return myStream;
61     }
62 
63 private:
64     /// the string stream
65     std::ostringstream myStream;
66 
67 };
68 
69 
70 #endif
71 
72 /****************************************************************************/
73 
74