My Project  UNKNOWN_GIT_VERSION
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 
17 class multiCnt
18 {
19 public:
20 
21  int *cnt;
22  int N;
23  int last_inc;
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 
51 inline 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;
66  last_inc = C.last_inc;
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 // ----------------------------------------------------------------------------
multiCnt::last_inc
int last_inc
Definition: multicnt.h:23
multiCnt::inc_carry
void inc_carry(void)
Definition: multicnt.cc:176
multiCnt::copy_deep
void copy_deep(const multiCnt &)
Definition: multicnt.cc:91
multiCnt::multiCnt
multiCnt()
Definition: multicnt.h:73
multiCnt::cnt
int * cnt
Definition: multicnt.h:21
multiCnt::inc
void inc(void)
Definition: multicnt.cc:154
multiCnt::copy_delete
void copy_delete(void)
Definition: multicnt.cc:81
multiCnt
Definition: multicnt.h:18
multiCnt::copy_shallow
void copy_shallow(multiCnt &)
Definition: multicnt.h:62
multiCnt::copy_zero
void copy_zero(void)
Definition: multicnt.h:51
multiCnt::multiCnt
multiCnt(const multiCnt &)
multiCnt::N
int N
Definition: multicnt.h:22
multiCnt::copy_new
void copy_new(int)
Definition: multicnt.cc:32
NULL
#define NULL
Definition: omList.c:10
multiCnt::set
void set(int)
Definition: multicnt.cc:108