ESyS-Particle
4.0.1
Main Page
Related Pages
Namespaces
Classes
Files
File List
Foundation
Counter.h
1
2
// //
3
// Copyright (c) 2003-2011 by The University of Queensland //
4
// Earth Systems Science Computational Centre (ESSCC) //
5
// http://www.uq.edu.au/esscc //
6
// //
7
// Primary Business: Brisbane, Queensland, Australia //
8
// Licensed under the Open Software License version 3.0 //
9
// http://www.opensource.org/licenses/osl-3.0.php //
10
// //
12
13
#ifndef _COUNTER_H_
14
#define _COUNTER_H_
15
#include "t_list.h"
16
17
//--- IO includes ---
18
#include <iostream>
19
#include <cstdio>
20
using
std::ostream;
21
22
//--- system includes ---
23
#include <string.h>
24
29
class
CCounter
{
30
protected
:
31
char
*
Name
;
32
int
Value ;
33
int
Id ;
34
public
:
35
CCounter
() ;
36
CCounter
(
char
*
Name
,
int
Id=0) ;
37
virtual
~
CCounter
() ;
38
39
void
create
(
char
*
Name
,
int
Id=0) ;
40
CCounter
&
operator +=
(
int
n) ;
41
CCounter
&
operator -=
(
int
n) ;
42
CCounter
&
operator ++
() ;
43
CCounter
&
operator --
() ;
44
CCounter
&
operator ++
(
int
) ;
45
CCounter
&
operator --
(
int
) ;
46
CCounter
&
reset
() ;
47
char
*
getName
() ;
48
operator
int () ;
49
ostream&
print
(ostream& Out) ;
50
} ;
55
class
CListCounters
:
public
List
<CCounter> {
56
} ;
57
61
class
CCounterList
{
62
protected
:
63
CListCounters
m_Counters ;
64
public
:
65
CCounterList
() ;
66
virtual
~
CCounterList
() ;
67
68
CCounterList
&
operator <<
(
CCounter
&Counter) ;
69
CCounterList
&
addCounter
(
char
*name) ;
70
CCounter
&
counter
(
char
*name) ;
71
CCounter
&
operator()
(
char
*Name) ;
72
ostream&
print
(ostream& Out) ;
73
inline
CListCounters
& getList()
74
{
return
m_Counters; } ;
75
} ;
76
77
// out-of-class method to print-out counter values
78
ostream& operator<<(ostream& Out,
CCounter
&P) ;
79
ostream& operator<<(ostream& Out,
CCounterList
&P) ;
80
81
#endif
82
Generated on Sun Apr 13 2014 05:18:50 for ESyS-Particle by
1.8.1.2