Path: blob/main/src/utils/iodevices/OutputDevice_COUT.cpp
169678 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2004-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file OutputDevice_COUT.cpp14/// @author Daniel Krajzewicz15/// @author Michael Behrisch16/// @date 200417///18// An output device that encapsulates cout19/****************************************************************************/20#include <config.h>2122#include <iostream>23#include "OutputDevice_COUT.h"242526// ===========================================================================27// static member definitions28// ===========================================================================29OutputDevice* OutputDevice_COUT::myInstance = nullptr;303132// ===========================================================================33// static method definitions34// ===========================================================================35OutputDevice*36OutputDevice_COUT::getDevice() {37// check whether the device has already been aqcuired38if (myInstance == nullptr) {39myInstance = new OutputDevice_COUT();40}41return myInstance;42}434445// ===========================================================================46// method definitions47// ===========================================================================48OutputDevice_COUT::OutputDevice_COUT() : OutputDevice(0, "COUT") {49}505152OutputDevice_COUT::~OutputDevice_COUT() {53myInstance = nullptr;54}555657std::ostream&58OutputDevice_COUT::getOStream() {59return std::cout;60}616263void64OutputDevice_COUT::postWriteHook() {65std::cout.flush();66}676869/****************************************************************************/707172