]>
Commit | Line | Data |
---|---|---|
dee1d5f1 | 1 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
2 | * See cxx source for full Copyright notice */ | |
3 | ||
5f91c9e8 | 4 | // $Id$ |
13985652 | 5 | // $MpId: AliMpIntPair.h,v 1.6 2006/05/24 13:58:07 ivana Exp $ |
dee1d5f1 | 6 | |
46df088d | 7 | /// \ingroup core |
dee1d5f1 | 8 | /// \class AliMpIntPair |
9 | /// \brief A pair of integers. | |
10 | /// | |
11 | /// The pair created by the default constructor is in invalide state, | |
12 | /// setting one of values changes the state to valid. | |
13 | /// | |
13985652 | 14 | /// \author David Guez, Ivana Hrivnacova; IPN Orsay |
5f91c9e8 | 15 | |
16 | #ifndef ALI_MP_INT_PAIR_H | |
17 | #define ALI_MP_INT_PAIR_H | |
18 | ||
19 | #include <TObject.h> | |
20 | ||
b80faac0 | 21 | using std::ostream; |
22 | ||
5f91c9e8 | 23 | class AliMpIntPair : public TObject |
24 | { | |
25 | public: | |
26 | AliMpIntPair(Int_t ix,Int_t iy); | |
27 | AliMpIntPair(Int_t ix,Int_t iy, Bool_t validity); | |
28 | AliMpIntPair(const AliMpIntPair& right); | |
29 | AliMpIntPair(); | |
30 | virtual ~AliMpIntPair(); | |
31 | ||
32 | // operators | |
33 | Bool_t operator < (const AliMpIntPair& pos2) const; | |
34 | Bool_t operator == (const AliMpIntPair& pos2) const; | |
35 | Bool_t operator != (const AliMpIntPair& pos2) const; | |
36 | AliMpIntPair& operator = (const AliMpIntPair& src) ; | |
37 | void operator += (const AliMpIntPair& op); | |
38 | void operator -= (const AliMpIntPair& op); | |
39 | ||
f5671fc3 | 40 | // |
5f91c9e8 | 41 | // static get methods |
f5671fc3 | 42 | // |
43 | /// Return invalid pair | |
5f91c9e8 | 44 | static AliMpIntPair Invalid() {return AliMpIntPair();} |
45 | ||
f5671fc3 | 46 | // |
5f91c9e8 | 47 | // get methods |
f5671fc3 | 48 | // |
49 | /// Return first value | |
5f91c9e8 | 50 | Int_t GetFirst() const {return fFirst;} |
f5671fc3 | 51 | /// Return second value |
5f91c9e8 | 52 | Int_t GetSecond() const {return fSecond;} |
f5671fc3 | 53 | /// Return validity |
5f91c9e8 | 54 | Bool_t IsValid() const {return fValidity;} |
55 | ||
f5671fc3 | 56 | // |
5f91c9e8 | 57 | // set methods |
f5671fc3 | 58 | // |
59 | /// Set first value | |
5f91c9e8 | 60 | void SetFirst(Int_t ix) {fFirst=ix; fValidity=true; } |
f5671fc3 | 61 | /// Set second value |
5f91c9e8 | 62 | void SetSecond(Int_t iy) {fSecond=iy; fValidity=true;} |
71a2d3aa | 63 | /// Set both first and second value |
d4eca43d | 64 | void Set(Int_t ix, Int_t iy) { fFirst=ix; fSecond=iy; fValidity=true; } |
5f91c9e8 | 65 | |
71a2d3aa | 66 | // |
ef053765 | 67 | // TObject functions used for sorting in Root collections |
71a2d3aa | 68 | // |
69 | /// Return true as Compare() function is implemented | |
ef053765 | 70 | virtual Bool_t IsSortable() const {return kTRUE;} |
71 | virtual Int_t Compare(const TObject* obj) const; | |
72 | ||
5f91c9e8 | 73 | private: |
74 | // data members | |
829425a5 | 75 | Int_t fFirst; ///< the first value |
76 | Int_t fSecond; ///< the second value | |
77 | Bool_t fValidity; ///< validity | |
5f91c9e8 | 78 | |
829425a5 | 79 | ClassDef(AliMpIntPair,1) // utility class for the motif type |
5f91c9e8 | 80 | }; |
81 | ||
82 | AliMpIntPair operator + (const AliMpIntPair& op1,const AliMpIntPair& op2); | |
83 | AliMpIntPair operator - (const AliMpIntPair& op1,const AliMpIntPair& op2); | |
84 | AliMpIntPair operator * (const AliMpIntPair& op1,const AliMpIntPair& op2); | |
85 | ostream& operator << (ostream &stream,const AliMpIntPair& op); | |
86 | ||
87 | #endif //ALI_MP_INT_PAIR_H |