]>
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 | |
7 | /// \ingroup basic | |
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 | ||
21 | class AliMpIntPair : public TObject | |
22 | { | |
23 | public: | |
24 | AliMpIntPair(Int_t ix,Int_t iy); | |
25 | AliMpIntPair(Int_t ix,Int_t iy, Bool_t validity); | |
26 | AliMpIntPair(const AliMpIntPair& right); | |
27 | AliMpIntPair(); | |
28 | virtual ~AliMpIntPair(); | |
29 | ||
30 | // operators | |
31 | Bool_t operator < (const AliMpIntPair& pos2) const; | |
32 | Bool_t operator == (const AliMpIntPair& pos2) const; | |
33 | Bool_t operator != (const AliMpIntPair& pos2) const; | |
34 | AliMpIntPair& operator = (const AliMpIntPair& src) ; | |
35 | void operator += (const AliMpIntPair& op); | |
36 | void operator -= (const AliMpIntPair& op); | |
37 | ||
f5671fc3 | 38 | // |
5f91c9e8 | 39 | // static get methods |
f5671fc3 | 40 | // |
41 | /// Return invalid pair | |
5f91c9e8 | 42 | static AliMpIntPair Invalid() {return AliMpIntPair();} |
43 | ||
f5671fc3 | 44 | // |
5f91c9e8 | 45 | // get methods |
f5671fc3 | 46 | // |
47 | /// Return first value | |
5f91c9e8 | 48 | Int_t GetFirst() const {return fFirst;} |
f5671fc3 | 49 | /// Return second value |
5f91c9e8 | 50 | Int_t GetSecond() const {return fSecond;} |
f5671fc3 | 51 | /// Return validity |
5f91c9e8 | 52 | Bool_t IsValid() const {return fValidity;} |
53 | ||
f5671fc3 | 54 | // |
5f91c9e8 | 55 | // set methods |
f5671fc3 | 56 | // |
57 | /// Set first value | |
5f91c9e8 | 58 | void SetFirst(Int_t ix) {fFirst=ix; fValidity=true; } |
f5671fc3 | 59 | /// Set second value |
5f91c9e8 | 60 | void SetSecond(Int_t iy) {fSecond=iy; fValidity=true;} |
d4eca43d | 61 | void Set(Int_t ix, Int_t iy) { fFirst=ix; fSecond=iy; fValidity=true; } |
5f91c9e8 | 62 | |
ef053765 | 63 | // TObject functions used for sorting in Root collections |
64 | virtual Bool_t IsSortable() const {return kTRUE;} | |
65 | virtual Int_t Compare(const TObject* obj) const; | |
66 | ||
5f91c9e8 | 67 | private: |
68 | // data members | |
829425a5 | 69 | Int_t fFirst; ///< the first value |
70 | Int_t fSecond; ///< the second value | |
71 | Bool_t fValidity; ///< validity | |
5f91c9e8 | 72 | |
829425a5 | 73 | ClassDef(AliMpIntPair,1) // utility class for the motif type |
5f91c9e8 | 74 | }; |
75 | ||
76 | AliMpIntPair operator + (const AliMpIntPair& op1,const AliMpIntPair& op2); | |
77 | AliMpIntPair operator - (const AliMpIntPair& op1,const AliMpIntPair& op2); | |
78 | AliMpIntPair operator * (const AliMpIntPair& op1,const AliMpIntPair& op2); | |
79 | ostream& operator << (ostream &stream,const AliMpIntPair& op); | |
80 | ||
81 | #endif //ALI_MP_INT_PAIR_H |