UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Int8Ar.H
1 /* Int8Ar.H */
2 /* $Id: Int8Ar.H,v 2.1 2003/02/07 17:54:11 vlad Exp $ */
3 #ifndef __Int8Ar_H
4 #define __Int8Ar_H
5 
6 
7 #ifdef CompilerIs64bitReady
8 
9 #include <mix/SortedAr.H>
10 
11 
12 /*************************************************************
13  * Dynamic Array of Long Longs
14  *************************************************************/
15 
16 class Int8Ar : public SortedAr
17 {
18 public:
19 
20  Int8Ar (const Int8Ar& int8ar);
21  Int8Ar (unsigned quant = DEFAULT_QUANT,
22  unsigned volume = START_VOLUME);
23 
24  long long& fetch (unsigned i);
25  long long get (unsigned i) const;
26 
27  void insert (unsigned i, long long val);
28 
29  void addh (long long val);
30  void addl (long long val);
31 
32  void addh (const Int8Ar& int8ar);
33  void addl (const Int8Ar& int8ar);
34 
35  Int8Ar& assign (const Int8Ar& int8ar);
36  Int8Ar& assign (unsigned cnt, long long* vect);
37 
38  // Allocate vector by calloc() of longs and return pointer
39  long long* vector () const;
40 
41  // Synonyms
42  long long& operator[] (unsigned i) {return fetch(i);};
43  long long operator() (unsigned i) const {return get(i);};
44  Int8Ar& operator= (const Int8Ar& int8ar) {return assign(int8ar);};
45 
46  // Usual compare between two longs
47  virtual Compar compare (const char* item1, const char* item2) const;
48 
49  // Usual exchange between two longs: quicker than DynAr::exchange()
50  virtual void exchange (unsigned i1, unsigned i2);
51 
52  // Return index of item or -1
53  int find_ascent (long long item) const
54  {return quick_find_ascent((const char*)&item);}
55  int find_descent (long long item) const
56  {return quick_find_descent((const char*)&item);}
57  int find (long long item) const
58  {return slow_find((const char*)&item);}
59 
60  // Return LESS or GREATER in case of out of range and EQUAL means
61  // the L..R is found (L<=R)
62  Compar find_range_ascent (long long value,
63  unsigned& L, unsigned& R) const {
64  return SortedAr::find_range_ascent((const char*)&value, L, R);
65  }
66  Compar find_range_descent (long long value,
67  unsigned& L, unsigned& R) const {
68  return SortedAr::find_range_descent((const char*)&value, L, R);
69  }
70 
71  // For debug purpose
72  virtual void print_item (unsigned i) const;
73  virtual void print_contents () const;
74 
75 };
76 
77 
78 /*************************************************************
79  * Dynamic Array of Unsigned Long Longs
80  *************************************************************/
81 
82 class UInt8Ar : public SortedAr
83 {
84 public:
85 
86  UInt8Ar (const UInt8Ar& uint8ar);
87  UInt8Ar (unsigned quant = DEFAULT_QUANT,
88  unsigned volume = START_VOLUME);
89 
90  unsigned long long& fetch (unsigned i);
91  unsigned long long get (unsigned i) const;
92 
93  void insert (unsigned i, unsigned long long val);
94 
95  void addh (unsigned long long val);
96  void addl (unsigned long long val);
97 
98  void addh (const UInt8Ar& uint8ar);
99  void addl (const UInt8Ar& uint8ar);
100 
101  UInt8Ar& assign (const UInt8Ar& uint8ar);
102  UInt8Ar& assign (unsigned cnt, unsigned long long* vect);
103 
104  // Allocate vector by calloc() of longs and return pointer
105  unsigned long long* vector () const;
106 
107  // Synonyms
108  unsigned long long& operator[] (unsigned i) {return fetch(i);};
109  unsigned long long operator() (unsigned i) const {return get(i);};
110  UInt8Ar& operator= (const UInt8Ar& uint8ar) {return assign(uint8ar);};
111 
112  // Usual compare between two longs
113  virtual Compar compare (const char* item1, const char* item2) const;
114 
115  // Usual exchange between two longs: quicker than DynAr::exchange()
116  virtual void exchange (unsigned i1, unsigned i2);
117 
118  // Return index of item or -1
119  int find_ascent (unsigned long long item) const
120  {return quick_find_ascent((const char*)&item);}
121  int find_descent (unsigned long long item) const
122  {return quick_find_descent((const char*)&item);}
123  int find (unsigned long item) const
124  {return slow_find((const char*)&item);}
125 
126  // Return LESS or GREATER in case of out of range and EQUAL means
127  // the L..R is found (L<=R)
128  Compar find_range_ascent (unsigned long long value,
129  unsigned& L, unsigned& R) const {
130  return SortedAr::find_range_ascent((const char*)&value, L, R);
131  }
132  Compar find_range_descent (unsigned long long value,
133  unsigned& L, unsigned& R) const {
134  return SortedAr::find_range_descent((const char*)&value, L, R);
135  }
136 
137  // For debug purpose
138  virtual void print_item (unsigned i) const;
139  virtual void print_contents () const;
140 
141 };
142 
143 
144 #endif /* CompilerIs64bitReady */
145 
146 
147 #endif /* Int8Ar.H */
Definition: SortedAr.H:14