output.hh revision 2665:a124942bacb8
17753SWilliam.Wang@arm.com/* 27753SWilliam.Wang@arm.com * Copyright (c) 2005 The Regents of The University of Michigan 37753SWilliam.Wang@arm.com * All rights reserved. 47753SWilliam.Wang@arm.com * 57753SWilliam.Wang@arm.com * Redistribution and use in source and binary forms, with or without 67753SWilliam.Wang@arm.com * modification, are permitted provided that the following conditions are 77753SWilliam.Wang@arm.com * met: redistributions of source code must retain the above copyright 87753SWilliam.Wang@arm.com * notice, this list of conditions and the following disclaimer; 97753SWilliam.Wang@arm.com * redistributions in binary form must reproduce the above copyright 107753SWilliam.Wang@arm.com * notice, this list of conditions and the following disclaimer in the 117753SWilliam.Wang@arm.com * documentation and/or other materials provided with the distribution; 127753SWilliam.Wang@arm.com * neither the name of the copyright holders nor the names of its 137753SWilliam.Wang@arm.com * contributors may be used to endorse or promote products derived from 147753SWilliam.Wang@arm.com * this software without specific prior written permission. 157753SWilliam.Wang@arm.com * 167753SWilliam.Wang@arm.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 177753SWilliam.Wang@arm.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 187753SWilliam.Wang@arm.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 197753SWilliam.Wang@arm.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 207753SWilliam.Wang@arm.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 217753SWilliam.Wang@arm.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 227753SWilliam.Wang@arm.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 237753SWilliam.Wang@arm.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 247753SWilliam.Wang@arm.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 257753SWilliam.Wang@arm.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 267753SWilliam.Wang@arm.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 277753SWilliam.Wang@arm.com * 287753SWilliam.Wang@arm.com * Authors: Nathan Binkert 297753SWilliam.Wang@arm.com */ 307753SWilliam.Wang@arm.com 317753SWilliam.Wang@arm.com#ifndef __BASE_OUTPUT_HH__ 327753SWilliam.Wang@arm.com#define __BASE_OUTPUT_HH__ 337753SWilliam.Wang@arm.com 347753SWilliam.Wang@arm.com#include <iosfwd> 357753SWilliam.Wang@arm.com#include <map> 367753SWilliam.Wang@arm.com#include <string> 377753SWilliam.Wang@arm.com 387950SAli.Saidi@ARM.comclass OutputDirectory 397753SWilliam.Wang@arm.com{ 407753SWilliam.Wang@arm.com private: 418229Snate@binkert.org typedef std::map<std::string, std::ostream *> map_t; 427950SAli.Saidi@ARM.com 437950SAli.Saidi@ARM.com map_t files; 447753SWilliam.Wang@arm.com std::string dir; 458245Snate@binkert.org 468245Snate@binkert.org public: 477753SWilliam.Wang@arm.com OutputDirectory(); 487753SWilliam.Wang@arm.com ~OutputDirectory(); 497753SWilliam.Wang@arm.com 507753SWilliam.Wang@arm.com void setDirectory(const std::string &dir); 517753SWilliam.Wang@arm.com const std::string &directory(); 527753SWilliam.Wang@arm.com 537753SWilliam.Wang@arm.com std::string resolve(const std::string &name); 547753SWilliam.Wang@arm.com std::ostream *create(const std::string &name); 557753SWilliam.Wang@arm.com std::ostream *find(const std::string &name); 567753SWilliam.Wang@arm.com 577753SWilliam.Wang@arm.com static bool isFile(const std::ostream *os); 587753SWilliam.Wang@arm.com static inline bool isFile(const std::ostream &os) { return isFile(&os); } 597950SAli.Saidi@ARM.com}; 607753SWilliam.Wang@arm.com 617753SWilliam.Wang@arm.comextern OutputDirectory simout; 627753SWilliam.Wang@arm.com 637950SAli.Saidi@ARM.com#endif // __BASE_OUTPUT_HH__ 647950SAli.Saidi@ARM.com