/****************************************************************************/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_File.h14/// @author Daniel Krajzewicz15/// @author Michael Behrisch16/// @date 200417///18// An output device that encapsulates an ofstream19/****************************************************************************/20#pragma once21#include <config.h>2223#include <iostream>24#include "OutputDevice.h"252627// ===========================================================================28// class definitions29// ===========================================================================30/**31* @class OutputDevice_File32* @brief An output device that encapsulates an ofstream33*34* Please note that the device gots responsible for the stream and deletes35* it (it should not be deleted elsewhere).36*/37class OutputDevice_File : public OutputDevice {38public:39/** @brief Constructor40* @param[in] fullName The name of the output file to use41* @param[in] binary whether the output steam needs to be opened in binary mode42* @exception IOError Should not be thrown by this implementation43*/44OutputDevice_File(const std::string& fullName, const bool binary = false);4546/// @brief Destructor47~OutputDevice_File();4849/** @brief returns the information whether the device will discard all output50* @return Whether the device redirects to /dev/null51*/52bool isNull() override {53return myAmNull;54}5556protected:57/// @name Methods that override/implement OutputDevice-methods58/// @{5960/** @brief Returns the associated ostream61* @return The used stream62*/63inline std::ostream& getOStream() override {64return *myFileStream;65}66/// @}6768private:69/// The wrapped ofstream70std::ostream* myFileStream = nullptr;7172/// am I redirecting to /dev/null73bool myAmNull = false;7475};767778