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