1
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3
* Contains a simple pair class.
5
* \author Pierre Terdiman
6
* \date January, 13, 2003
8
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
10
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
12
#ifndef __ICEPAIRS_H__
13
#define __ICEPAIRS_H__
15
//! A generic couple structure
19
inline_ Pair(udword i0, udword i1) : id0(i0), id1(i1) {}
21
udword id0; //!< First index of the pair
22
udword id1; //!< Second index of the pair
25
class Pairs : private Container
28
// Constructor / Destructor
32
inline_ udword GetNbPairs() const { return GetNbEntries()>>1; }
33
inline_ const Pair* GetPairs() const { return (const Pair*)GetEntries(); }
34
inline_ const Pair* GetPair(udword i) const { return (const Pair*)&GetEntries()[i+i]; }
36
inline_ BOOL HasPairs() const { return IsNotEmpty(); }
38
inline_ void ResetPairs() { Reset(); }
39
inline_ void DeleteLastPair() { DeleteLastEntry(); DeleteLastEntry(); }
41
inline_ void AddPair(const Pair& p) { Add(p.id0).Add(p.id1); }
42
inline_ void AddPair(udword id0, udword id1) { Add(id0).Add(id1); }
45
#endif // __ICEPAIRS_H__