source: trunk/MagicSoft/Mars/mbase/MLut.h@ 9481

Last change on this file since 9481 was 9462, checked in by tbretz, 15 years ago
*** empty log message ***
File size: 1.5 KB
Line 
1#ifndef MARS_MLut
2#define MARS_MLut
3
4#ifndef ROOT_TObjArray
5#include <TObjArray.h>
6#endif
7
8#include <iosfwd>
9
10class MArrayI;
11
12class MLut : public TObjArray
13{
14private:
15 UInt_t fMinEntries; // The minimum entries per row
16 UInt_t fMaxEntries; // The maximum entries per row
17
18 Int_t fMaxIndex; // The maximum index fount in the lut
19
20 MLut *GetInverse(Bool_t uniq=kTRUE) const;
21
22public:
23 MLut() : fMinEntries(0), fMaxEntries(0), fMaxIndex(0) { SetOwner(); }
24
25 // TObjArry
26 void Delete(Option_t *option="");
27
28 // MLut Getter
29 const MArrayI &GetRow(UInt_t i) const;
30
31 Int_t GetNumRows() const { return GetEntriesFast(); }
32
33 UInt_t GetMaxEntries() const { return fMaxEntries; }
34 Int_t GetMaxIndex() const { return fMaxIndex; }
35
36 Bool_t HasConstantLength() const { return fMinEntries==fMaxEntries; }
37 Bool_t IsEmpty() const { return fMaxEntries==0; }
38 Bool_t IsDefaultCol() const;
39 Bool_t IsDefaultRow() const;
40
41 // MLut conversions
42 void SetInverse(const MLut &lut, Bool_t uniq=kTRUE);
43 void Invert(Bool_t uniq=kTRUE);
44
45 // Setter
46 void SetDefaultCol(UInt_t n);
47 void SetDefaultRow(UInt_t n);
48
49 // MLut I/O
50 Int_t ReadStream(istream &in);
51 Int_t WriteStream(ostream &out) const;
52
53 Int_t ReadFile(const char *fname);
54 Int_t WriteFile(const char *fname) const;
55
56 // TObject
57 void Print(const Option_t *o="") const;
58 void Print(const Option_t *o, const Option_t *o2) const { Print(o); }
59
60 ClassDef(MLut, 1) // A simple and fast easy-to-use look-up-table
61};
62
63#endif
Note: See TracBrowser for help on using the repository browser.