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

Last change on this file since 9301 was 9255, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 1.0 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;
16 UInt_t fMaxEntries;
17
18 Int_t fMaxIndex;
19
20 MLut *GetInverse(Bool_t uniq=kTRUE) const;
21
22public:
23 MLut() : fMinEntries(0), fMaxEntries(0) { SetOwner(); }
24
25 // MLut Getter
26 const MArrayI &GetRow(UInt_t i) const;
27
28 UInt_t GetMaxEntries() const { return fMaxEntries; }
29 Int_t GetMaxIndex() const { return fMaxIndex; }
30
31 Bool_t HasConstantLength() const { return fMinEntries==fMaxEntries; }
32 Bool_t IsEmpty() const { return fMaxEntries==0; }
33
34 // MLut convertions
35 void SetInverse(const MLut &lut, Bool_t uniq=kTRUE);
36 void Invert(Bool_t uniq=kTRUE);
37
38 // MLut I/O
39 Int_t ReadStream(istream &in);
40 Int_t WriteStream(ostream &out);
41
42 Int_t ReadFile(const char *fname);
43 Int_t WriteFile(const char *fname);
44
45 ClassDef(MLut, 1) // A simple and fast easy-to-use look-up-table
46};
47
48#endif
Note: See TracBrowser for help on using the repository browser.