SUMO - Simulation of Urban MObility
OutputDevice_String.cpp
Go to the documentation of this file.
1 /****************************************************************************/
7 // An output device that encapsulates a stringstream
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #ifdef _MSC_VER
26 #include <windows_config.h>
27 #else
28 #include <config.h>
29 #endif
30 
31 #include <sstream>
32 #include <string>
33 #include "OutputDevice_String.h"
34 
35 
36 // ===========================================================================
37 // method definitions
38 // ===========================================================================
39 OutputDevice_String::OutputDevice_String(const bool binary, const int defaultIndentation)
40  : OutputDevice(binary, defaultIndentation) {
41  setPrecision();
42  myStream << std::setiosflags(std::ios::fixed);
43 }
44 
45 
47 }
48 
49 
50 std::string
52  return myStream.str();
53 }
54 
55 
56 std::ostream&
58  return myStream;
59 }
60 
61 
62 /****************************************************************************/
std::ostream & getOStream()
Returns the associated ostream.
std::string getString() const
Returns the current content as a string.
void setPrecision(int precision=gPrecision)
Sets the precison or resets it to default.
~OutputDevice_String()
Destructor.
std::ostringstream myStream
The wrapped ofstream.
OutputDevice_String(const bool binary=false, const int defaultIndentation=0)
Constructor.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71