OpenCores
URL https://opencores.org/ocsvn/w11/w11/trunk

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.7/] [tools/] [src/] [librtools/] [Rstats.hpp] - Blame information for rev 19

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 19 wfjm
// $Id: Rstats.hpp 495 2013-03-06 17:13:48Z mueller $
2 10 wfjm
//
3
// Copyright 2011- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
//
5
// This program is free software; you may redistribute and/or modify it under
6
// the terms of the GNU General Public License as published by the Free
7
// Software Foundation, either version 2, or at your option any later version.
8
//
9
// This program is distributed in the hope that it will be useful, but
10
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
// for complete details.
13
// 
14
// Revision History: 
15
// Date         Rev Version  Comment
16
// 2011-02-06   359   1.0    Initial version
17
// ---------------------------------------------------------------------------
18
 
19
/*!
20
  \file
21 19 wfjm
  \version $Id: Rstats.hpp 495 2013-03-06 17:13:48Z mueller $
22 10 wfjm
  \brief   Declaration of class Rstats .
23
*/
24
 
25
#ifndef included_Retro_Rstats
26
#define included_Retro_Rstats 1
27
 
28
#include <cstddef>
29
#include <cstdint>
30
#include <string>
31
#include <vector>
32
#include <ostream>
33
 
34
namespace Retro {
35
 
36
  class Rstats {
37
    public:
38
                    Rstats();
39
                    Rstats(const Rstats& rhs);
40
                    ~Rstats();
41
 
42
      void          Define(size_t ind, const std::string& name,
43
                           const std::string& text);
44
 
45
      void          Set(size_t ind, double val);
46
      void          Inc(size_t ind, double val=1.);
47
 
48
      void          SetFormat(const char* format, int width=0, int prec=0);
49
 
50
      size_t        Size() const;
51
      double        Value(size_t ind) const;
52
      const std::string&  Name(size_t ind) const;
53
      const std::string&  Text(size_t ind) const;
54
 
55
      void          Print(std::ostream& os, const char* format=0,
56
                          int width=0, int prec=0) const;
57
      void          Dump(std::ostream& os, int ind=0, const char* text=0) const;
58
 
59
      double        operator[](size_t ind) const;
60
 
61
      Rstats&       operator=(const Rstats& rhs);
62
      Rstats&       operator-(const Rstats& rhs);
63
      Rstats&       operator*(double rhs);
64
 
65
  private:
66
      std::vector<double> fValue;           //!< counter value
67
      std::vector<std::string> fName;       //!< counter name
68
      std::vector<std::string> fText;       //!< counter text
69
      std::uint32_t fHash;                  //!< hash value for name+text
70 19 wfjm
      std::string   fFormat;                //!< default format for Print
71
      int           fWidth;                 //!< default width for Print
72
      int           fPrec;                  //!< default precision for Print
73 10 wfjm
  };
74
 
75
  std::ostream&     operator<<(std::ostream& os, const Rstats& obj);
76
 
77
} // end namespace Retro
78
 
79
#include "Rstats.ipp"
80
 
81
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.