SUMO - Simulation of Urban MObility
OutputDevice_String.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2009-2018 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 /****************************************************************************/
15 // An output device that encapsulates a stringstream
16 /****************************************************************************/
17 
18 
19 // ===========================================================================
20 // included modules
21 // ===========================================================================
22 #include <config.h>
23 
24 #include <sstream>
25 #include <string>
26 #include "OutputDevice_String.h"
27 
28 
29 // ===========================================================================
30 // method definitions
31 // ===========================================================================
32 OutputDevice_String::OutputDevice_String(const bool binary, const int defaultIndentation)
33  : OutputDevice(binary, defaultIndentation) {
34  setPrecision();
35  myStream << std::setiosflags(std::ios::fixed);
36 }
37 
38 
40 }
41 
42 
43 std::string
45  return myStream.str();
46 }
47 
48 
49 std::ostream&
51  return myStream;
52 }
53 
54 
55 /****************************************************************************/
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:64