1 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2 * See cxx source for full Copyright notice */
5 // $MpId: AliMpIntPair.h,v 1.6 2006/05/24 13:58:07 ivana Exp $
8 /// \class AliMpIntPair
9 /// \brief A pair of integers.
11 /// The pair created by the default constructor is in invalide state,
12 /// setting one of values changes the state to valid.
14 /// \author David Guez, Ivana Hrivnacova; IPN Orsay
16 #ifndef ALI_MP_INT_PAIR_H
17 #define ALI_MP_INT_PAIR_H
21 class AliMpIntPair : public TObject
24 AliMpIntPair(Int_t ix,Int_t iy);
25 AliMpIntPair(Int_t ix,Int_t iy, Bool_t validity);
26 AliMpIntPair(const AliMpIntPair& right);
28 virtual ~AliMpIntPair();
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);
41 /// Return invalid pair
42 static AliMpIntPair Invalid() {return AliMpIntPair();}
47 /// Return first value
48 Int_t GetFirst() const {return fFirst;}
49 /// Return second value
50 Int_t GetSecond() const {return fSecond;}
52 Bool_t IsValid() const {return fValidity;}
58 void SetFirst(Int_t ix) {fFirst=ix; fValidity=true; }
60 void SetSecond(Int_t iy) {fSecond=iy; fValidity=true;}
61 /// Set both first and second value
62 void Set(Int_t ix, Int_t iy) { fFirst=ix; fSecond=iy; fValidity=true; }
65 // TObject functions used for sorting in Root collections
67 /// Return true as Compare() function is implemented
68 virtual Bool_t IsSortable() const {return kTRUE;}
69 virtual Int_t Compare(const TObject* obj) const;
73 Int_t fFirst; ///< the first value
74 Int_t fSecond; ///< the second value
75 Bool_t fValidity; ///< validity
77 ClassDef(AliMpIntPair,1) // utility class for the motif type
80 AliMpIntPair operator + (const AliMpIntPair& op1,const AliMpIntPair& op2);
81 AliMpIntPair operator - (const AliMpIntPair& op1,const AliMpIntPair& op2);
82 AliMpIntPair operator * (const AliMpIntPair& op1,const AliMpIntPair& op2);
83 ostream& operator << (ostream &stream,const AliMpIntPair& op);
85 #endif //ALI_MP_INT_PAIR_H