Eclipse SUMO - Simulation of Urban MObility
OutputDevice_COUT.cpp
Go to the documentation of this file.
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3
// Copyright (C) 2004-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
/****************************************************************************/
15
// An output device that encapsulates cout
16
/****************************************************************************/
17
18
19
// ===========================================================================
20
// included modules
21
// ===========================================================================
22
#include <
config.h
>
23
24
#include <iostream>
25
#include "
OutputDevice_COUT.h
"
26
27
28
// ===========================================================================
29
// static member definitions
30
// ===========================================================================
31
OutputDevice
*
OutputDevice_COUT::myInstance
=
nullptr
;
32
33
34
// ===========================================================================
35
// static method definitions
36
// ===========================================================================
37
OutputDevice
*
38
OutputDevice_COUT::getDevice
() {
39
// check whether the device has already been aqcuired
40
if
(
myInstance
==
nullptr
) {
41
myInstance
=
new
OutputDevice_COUT
();
42
}
43
return
myInstance
;
44
}
45
46
47
// ===========================================================================
48
// method definitions
49
// ===========================================================================
50
OutputDevice_COUT::OutputDevice_COUT
() {
51
myFilename
=
"COUT"
;
52
}
53
54
55
OutputDevice_COUT::~OutputDevice_COUT
() {
56
myInstance
=
nullptr
;
57
}
58
59
60
std::ostream&
61
OutputDevice_COUT::getOStream
() {
62
return
std::cout;
63
}
64
65
66
void
67
OutputDevice_COUT::postWriteHook
() {
68
std::cout.flush();
69
}
70
71
72
/****************************************************************************/
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition:
OutputDevice.h:63
OutputDevice_COUT::postWriteHook
virtual void postWriteHook()
Called after every write access.
Definition:
OutputDevice_COUT.cpp:67
OutputDevice_COUT::getOStream
std::ostream & getOStream()
Returns the associated ostream.
Definition:
OutputDevice_COUT.cpp:61
OutputDevice::myFilename
std::string myFilename
Definition:
OutputDevice.h:359
OutputDevice_COUT::myInstance
static OutputDevice * myInstance
my singular instance
Definition:
OutputDevice_COUT.h:76
OutputDevice_COUT::~OutputDevice_COUT
~OutputDevice_COUT()
Destructor.
Definition:
OutputDevice_COUT.cpp:55
OutputDevice_COUT::getDevice
static OutputDevice * getDevice()
Returns the single cout instance.
Definition:
OutputDevice_COUT.cpp:38
OutputDevice_COUT::OutputDevice_COUT
OutputDevice_COUT()
Constructor.
Definition:
OutputDevice_COUT.cpp:50
config.h
OutputDevice_COUT.h
src
utils
iodevices
OutputDevice_COUT.cpp
Generated on Sun Dec 13 2020 08:44:58 for Eclipse SUMO - Simulation of Urban MObility by
1.8.20