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

Last change on this file since 9384 was 9318, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 1.3 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 IsDefault() const;
39
40 // MLut conversions
41 void SetInverse(const MLut &lut, Bool_t uniq=kTRUE);
42 void Invert(Bool_t uniq=kTRUE);
43
44 // Setter
45 void SetDefault(UInt_t n);
46
47 // MLut I/O
48 Int_t ReadStream(istream &in);
49 Int_t WriteStream(ostream &out);
50
51 Int_t ReadFile(const char *fname);
52 Int_t WriteFile(const char *fname);
53
54 ClassDef(MLut, 1) // A simple and fast easy-to-use look-up-table
55};
56
57#endif
Note: See TracBrowser for help on using the repository browser.