text.cc (8243:63e849f0f341) text.cc (8296:be7f03723412)
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"
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"
52#include "base/cast.hh"
53#include "base/misc.hh"
54#include "base/str.hh"
55
56using namespace std;
57
58#ifndef NAN
59float __nan();

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

133
134bool
135Text::valid() const
136{
137 return stream != NULL && stream->good();
138}
139
140void
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()
142{
143 ccprintf(*stream, "\n---------- Begin Simulation Statistics ----------\n");
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{
147 ccprintf(*stream, "\n---------- End Simulation Statistics ----------\n");
148 stream->flush();
149}
150
151bool
152Text::noOutput(const Info &info)
153{
154 if (!info.flags.isSet(display))

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

575}
576
577void
578Text::visit(const FormulaInfo &info)
579{
580 visit((const VectorInfo &)info);
581}
582
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 *
584initText(const string &filename, bool desc)
585{
586 static Text text;
587 static bool connected = false;
588
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 }
591
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;
600}
601
602} // namespace Stats
597}
598
599} // namespace Stats