source: git/kernel/multicnt.h @ fbc7cb

jengelh-datetimespielwiese
Last change on this file since fbc7cb was 35aab3, checked in by Hans Schönemann <hannes@…>, 19 years ago
This commit was generated by cvs2svn to compensate for changes in r6879, which included commits to RCS files with non-trunk default branches. git-svn-id: file:///usr/local/Singular/svn/trunk@6880 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 2.3 KB
Line 
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
17class multiCnt
18{
19public:
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
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
62inline  void multiCnt::copy_shallow( multiCnt &C )
63{
64    cnt      = C.cnt;
65    N        = C.N;
66    last_inc = C.last_inc;
67}
68
69// ----------------------------------------------------------------------------
70//  zero constructor
71// ----------------------------------------------------------------------------
72
73inline multiCnt::multiCnt( )
74{
75    copy_zero( );
76}
77
78#endif /* MULTICNT_H */
79
80// ----------------------------------------------------------------------------
81//  multicnt.h
82//  end of file
83// ----------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.