UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
DoubleAr.H
1 /* DoubleAr.H */
2 /* $Id: DoubleAr.H,v 1.2 2002/10/16 17:37:47 vlad Exp $ */
3 #ifndef __DoubleAr_H
4 #define __DoubleAr_H
5 
6 #include <mix/DynAr.H>
7 #include <mix/SortedAr.H>
8 
9 
10 /*************************************************************
11  * Dynamic Array of Double floats
12  *************************************************************/
13 
14 class DoubleAr : public SortedAr
15 {
16 public:
17 
18  DoubleAr (const DoubleAr& flar);
19  DoubleAr (unsigned quant = DEFAULT_QUANT,
20  unsigned volume = START_VOLUME);
21 
22  double& fetch (unsigned i);
23  double get (unsigned i) const;
24 
25  void insert (unsigned i, double val);
26 
27  void addh (double val);
28  void addl (double val);
29 
30  void addh (const DoubleAr& flar);
31  void addl (const DoubleAr& flar);
32 
33  DoubleAr& assign (const DoubleAr& flar);
34  DoubleAr& assign (unsigned cnt, double* vect);
35 
36  double* vector () const;
37 
38  // Synonyms
39  double& operator[] (unsigned i) {return fetch(i);};
40  double operator() (unsigned i) const {return get(i);};
41  DoubleAr& operator= (const DoubleAr& flar) {return assign(flar);};
42 
43  // Usual compare between two double floats
44  virtual Compar compare (const char* item1,
45  const char* item2) const;
46 
47  // Usual exchange between two floats: quicker than DynAr::exchange()
48  virtual void exchange (unsigned i1, unsigned i2);
49 
50  // Return index of item or -1
51  int find_ascent (double item) const
52  {return quick_find_ascent((const char*)&item);}
53  int find_descent (double item) const
54  {return quick_find_descent((const char*)&item);}
55  int find (double item) const
56  {return slow_find((const char*)&item);}
57 
58  // Return LESS or GREATER in case of out of range and EQUAL means
59  // the L..R is found (L<=R)
60  Compar find_range_ascent (double value,
61  unsigned& L, unsigned& R) const {
62  return SortedAr::find_range_ascent((const char*)&value, L, R);
63  }
64  Compar find_range_descent (double value,
65  unsigned& L, unsigned& R) const {
66  return SortedAr::find_range_descent((const char*)&value, L, R);
67  }
68 
69  // For debug purpose
70  virtual void print_item (unsigned i) const;
71  virtual void print_contents () const;
72 
73 };
74 
75 
76 #endif /* DoubleAr.H */
Definition: SortedAr.H:14
Definition: DoubleAr.H:14