My Project
multicnt.h
Go to the documentation of this file.
1// ----------------------------------------------------------------------------
2// multicnt.h
3// begin of file
4// Stephan Endrass, endrass@mathematik.uni-mainz.de
5// 23.7.99
6// ----------------------------------------------------------------------------
7
8// ----------------------------------------------------------------------------
9// Description: the class multiCnt is a general multi purpose counter.
10// The counter holds an array cnt of N integers.
11// The integer last_inc holds the index of the last incremented entry.
12// ----------------------------------------------------------------------------
13
14#ifndef MULTICNT_H
15#define MULTICNT_H
16
18{
19public:
20
21 int *cnt;
22 int N;
24
25 multiCnt( );
26 multiCnt( int );
27 multiCnt( int,int );
28 multiCnt( int,int* );
29 multiCnt( const multiCnt& );
30
31 void copy_zero ( void );
32 void copy_new ( int );
33 void copy_delete ( void );
34 void copy_shallow( multiCnt& );
35 void copy_deep ( const multiCnt& );
36
37 void set( int );
38
39 void inc ( void );
40 void inc_carry( void );
41 int inc ( int );
42 //void dec ( void );
43 //void dec_carry( void );
44 //int dec ( int );
45};
46
47// ----------------------------------------------------------------------------
48// zero init
49// ----------------------------------------------------------------------------
50
51inline void multiCnt::copy_zero( void )
52{
53 cnt = (int*)NULL;
54 N = 0;
55 last_inc = 0;
56}
57
58// ----------------------------------------------------------------------------
59// copy a counter by reference
60// ----------------------------------------------------------------------------
61
63{
64 cnt = C.cnt;
65 N = C.N;
67}
68
69// ----------------------------------------------------------------------------
70// zero constructor
71// ----------------------------------------------------------------------------
72
74{
75 copy_zero( );
76}
77
78#endif /* MULTICNT_H */
79
80// ----------------------------------------------------------------------------
81// multicnt.h
82// end of file
83// ----------------------------------------------------------------------------
void copy_zero(void)
Definition: multicnt.h:51
void copy_new(int)
Definition: multicnt.cc:32
int * cnt
Definition: multicnt.h:21
void set(int)
Definition: multicnt.cc:108
void copy_deep(const multiCnt &)
Definition: multicnt.cc:91
int last_inc
Definition: multicnt.h:23
void inc_carry(void)
Definition: multicnt.cc:176
void copy_delete(void)
Definition: multicnt.cc:81
multiCnt()
Definition: multicnt.h:73
void inc(void)
Definition: multicnt.cc:154
multiCnt(const multiCnt &)
int N
Definition: multicnt.h:22
void copy_shallow(multiCnt &)
Definition: multicnt.h:62
#define NULL
Definition: omList.c:12