Path: blob/main/unittest/src/utils/iodevices/OutputDeviceMock.h
169684 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-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 OutputDeviceMock.h14/// @author Matthias Heppner15/// @author Michael Behrisch16/// @date 2009-11-2317///18//19/****************************************************************************/2021#ifndef OutputDeviceMock_h22#define OutputDeviceMock_h232425// ===========================================================================26// included modules27// ===========================================================================28#include <config.h>2930#include <fstream>31#include <utils/iodevices/OutputDevice.h>323334// ===========================================================================35// class definitions36// ===========================================================================37/**38* @class OutputDeviceMock39* Mock Implementation for Unit Tests40*41*/42class OutputDeviceMock : public OutputDevice {43public:44/** @brief Constructor45*/46OutputDeviceMock() {}4748/// @brief Destructor49~OutputDeviceMock() {}505152/** @brief Returns the current content as a string53*/54std::string getString() {55return myStream.str();56}5758protected:59/** @brief Returns the associated ostream60*/61std::ostream& getOStream() {62return myStream;63}6465private:66/// the string stream67std::ostringstream myStream;6869};707172#endif7374/****************************************************************************/757677