output.hh revision 1388
12SN/A/* 28922Swilliam.wang@arm.com * Copyright (c) 2005 The Regents of The University of Michigan 38707Sandreas.hansson@arm.com * All rights reserved. 48707Sandreas.hansson@arm.com * 58707Sandreas.hansson@arm.com * Redistribution and use in source and binary forms, with or without 68707Sandreas.hansson@arm.com * modification, are permitted provided that the following conditions are 78707Sandreas.hansson@arm.com * met: redistributions of source code must retain the above copyright 88707Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer; 98707Sandreas.hansson@arm.com * redistributions in binary form must reproduce the above copyright 108707Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer in the 118707Sandreas.hansson@arm.com * documentation and/or other materials provided with the distribution; 128707Sandreas.hansson@arm.com * neither the name of the copyright holders nor the names of its 138707Sandreas.hansson@arm.com * contributors may be used to endorse or promote products derived from 141762SN/A * this software without specific prior written permission. 157897Shestness@cs.utexas.edu * 169983Sstever@gmail.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 179983Sstever@gmail.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272SN/A */ 282SN/A 292SN/A#ifndef __BASE_OUTPUT_HH__ 302SN/A#define __BASE_OUTPUT_HH__ 312SN/A 322SN/A#include <iosfwd> 332SN/A#include <map> 342SN/A#include <string> 352SN/A 362SN/Aclass OutputDirectory 372SN/A{ 382SN/A private: 392SN/A typedef std::map<std::string, std::ostream *> map_t; 402SN/A 412SN/A map_t files; 422665Ssaidi@eecs.umich.edu std::string dir; 432665Ssaidi@eecs.umich.edu 442665Ssaidi@eecs.umich.edu public: 457897Shestness@cs.utexas.edu OutputDirectory(); 462SN/A ~OutputDirectory(); 472SN/A 481388SN/A void setDirectory(const std::string &dir); 498229Snate@binkert.org const std::string &directory(); 502SN/A 512SN/A std::string resolve(const std::string &name); 527781SAli.Saidi@ARM.com std::ostream *create(const std::string &name); 538229Snate@binkert.org std::ostream *find(const std::string &name); 541191SN/A 551191SN/A static bool isFile(const std::ostream *os); 561388SN/A static inline bool isFile(const std::ostream &os) { return isFile(&os); } 575529Snate@binkert.org}; 5810529Smorr@cs.wisc.edu 591717SN/Aextern OutputDirectory simout; 602651Ssaidi@eecs.umich.edu 618229Snate@binkert.org#endif // __BASE_OUTPUT_HH__ 622680Sktlim@umich.edu