text.hh revision 5886
1695SN/A/*
21762SN/A * Copyright (c) 2004-2005 The Regents of The University of Michigan
3695SN/A * All rights reserved.
4695SN/A *
5695SN/A * Redistribution and use in source and binary forms, with or without
6695SN/A * modification, are permitted provided that the following conditions are
7695SN/A * met: redistributions of source code must retain the above copyright
8695SN/A * notice, this list of conditions and the following disclaimer;
9695SN/A * redistributions in binary form must reproduce the above copyright
10695SN/A * notice, this list of conditions and the following disclaimer in the
11695SN/A * documentation and/or other materials provided with the distribution;
12695SN/A * neither the name of the copyright holders nor the names of its
13695SN/A * contributors may be used to endorse or promote products derived from
14695SN/A * this software without specific prior written permission.
15695SN/A *
16695SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17695SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18695SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19695SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20695SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21695SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22695SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23695SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24695SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25695SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26695SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu *
282665Ssaidi@eecs.umich.edu * Authors: Nathan Binkert
29695SN/A */
30695SN/A
31695SN/A#ifndef __BASE_STATS_TEXT_HH__
32695SN/A#define __BASE_STATS_TEXT_HH__
33695SN/A
34695SN/A#include <iosfwd>
35695SN/A#include <string>
36695SN/A
374078Sbinkertn@umich.edu#include "base/output.hh"
38695SN/A#include "base/stats/output.hh"
39695SN/A
40729SN/Anamespace Stats {
41695SN/A
42695SN/Aclass Text : public Output
43695SN/A{
44695SN/A  protected:
45695SN/A    bool mystream;
46695SN/A    std::ostream *stream;
47695SN/A
48695SN/A  protected:
495886Snate@binkert.org    bool noOutput(const Info &info);
50695SN/A
51695SN/A  public:
52695SN/A    bool compat;
53695SN/A    bool descriptions;
54695SN/A
55695SN/A  public:
56695SN/A    Text();
57695SN/A    Text(std::ostream &stream);
58695SN/A    Text(const std::string &file);
59695SN/A    ~Text();
60695SN/A
61695SN/A    void open(std::ostream &stream);
62695SN/A    void open(const std::string &file);
63695SN/A
64695SN/A    // Implement Visit
655886Snate@binkert.org    virtual void visit(const ScalarInfoBase &info);
665886Snate@binkert.org    virtual void visit(const VectorInfoBase &info);
675886Snate@binkert.org    virtual void visit(const DistInfoBase &info);
685886Snate@binkert.org    virtual void visit(const VectorDistInfoBase &info);
695886Snate@binkert.org    virtual void visit(const Vector2dInfoBase &info);
705886Snate@binkert.org    virtual void visit(const FormulaInfoBase &info);
71695SN/A
72695SN/A    // Implement Output
73695SN/A    virtual bool valid() const;
74695SN/A    virtual void output();
754085Sbinkertn@umich.edu
764085Sbinkertn@umich.edu    // Implement Event Output
774085Sbinkertn@umich.edu    virtual void event(const std::string &event) {}
78695SN/A};
79695SN/A
804078Sbinkertn@umich.edubool initText(const std::string &filename, bool desc=true, bool compat=true);
814078Sbinkertn@umich.edu
82729SN/A/* namespace Stats */ }
83695SN/A
84695SN/A#endif // __BASE_STATS_TEXT_HH__
85