1/*
2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 34 unchanged lines hidden (view full) ---

43#include <cmath>
44#include <fstream>
45#include <iostream>
46#include <sstream>
47#include <string>
48
49#include "base/stats/info.hh"
50#include "base/stats/text.hh"
51#include "base/stats/visit.hh"
51#include "base/cast.hh"
52#include "base/misc.hh"
53#include "base/str.hh"
54
55using namespace std;
56
57#ifndef NAN
58float __nan();

--- 73 unchanged lines hidden (view full) ---

132
133bool
134Text::valid() const
135{
136 return stream != NULL && stream->good();
137}
138
139void
141Text::output()
140Text::begin()
141{
142 ccprintf(*stream, "\n---------- Begin Simulation Statistics ----------\n");
144 list<Info *>::const_iterator i, end = statsList().end();
145 for (i = statsList().begin(); i != end; ++i)
146 (*i)->visit(*this);
143}
144
145void
146Text::end()
147{
148 ccprintf(*stream, "\n---------- End Simulation Statistics ----------\n");
149 stream->flush();
150}
151
152bool
153Text::noOutput(const Info &info)
154{
155 if (!info.flags.isSet(display))

--- 420 unchanged lines hidden (view full) ---

576}
577
578void
579Text::visit(const FormulaInfo &info)
580{
581 visit((const VectorInfo &)info);
582}
583
583bool
584Output *
585initText(const string &filename, bool desc)
586{
587 static Text text;
588 static bool connected = false;
589
589 if (connected)
590 return false;
590 if (!connected) {
591 text.open(*simout.find(filename));
592 text.descriptions = desc;
593 connected = true;
594 }
595
592 extern list<Output *> OutputList;
593
594 text.open(*simout.find(filename));
595 text.descriptions = desc;
596 OutputList.push_back(&text);
597 connected = true;
598
599 return true;
596 return &text;
597}
598
599} // namespace Stats