Bitstream Interpretation Library (BIL)  0.1
PIPRef.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 #ifndef BIL_PIPREF_HPP
8 #define BIL_PIPREF_HPP
9 
10 #include <cstring>
11 #include <vector>
12 
13 
14 namespace bil {
15 
22  class PIPRef {
23  public:
24 
25  /**********************************************************************/
26  /* CONSTRUCTION / DESTRUCTION */
27  /**********************************************************************/
28 
32  PIPRef();
33 
34 
35  /**********************************************************************/
36  /* TILE INDEX */
37  /**********************************************************************/
38 
43  void tileIndex(size_t index);
44 
49  size_t tileIndex() const;
50 
51 
52  /**********************************************************************/
53  /* PIP INDEX */
54  /**********************************************************************/
55 
60  void pipIndex(size_t index);
61 
66  size_t pipIndex() const;
67 
68 
69  /**********************************************************************/
70  /* MODIFICATORS */
71  /**********************************************************************/
72 
76  void clear();
77 
78 
79  private:
80 
81  friend bool operator== (const PIPRef& ref1, const PIPRef& ref2);
82  friend bool operator< (const PIPRef& ref1, const PIPRef& ref2);
83 
84  size_t m_tileIndex;
85  size_t m_pipIndex;
86 
87  };
88 
89 
91  inline bool operator== (const PIPRef& ref1, const PIPRef& ref2)
92  {
93  if (ref1.m_tileIndex != ref2.m_tileIndex) return false;
94  return ref1.m_pipIndex == ref2.m_pipIndex;
95  }
96 
98  inline bool operator!= (const PIPRef& ref1, const PIPRef& ref2)
99  {
100  return !(operator== (ref1, ref2));
101  }
102 
103 
105  inline bool operator< (const PIPRef& ref1, const PIPRef& ref2)
106  {
107  if (ref1.m_tileIndex != ref2.m_tileIndex)
108  return ref1.m_tileIndex < ref2.m_tileIndex;
109  return ref1.m_pipIndex < ref2.m_pipIndex;
110  }
111 
113  inline bool operator> (const PIPRef& ref1, const PIPRef& ref2)
114  {
115  return (operator< (ref2, ref1));
116  }
117 
119  inline bool operator<= (const PIPRef& ref1, const PIPRef& ref2)
120  {
121  return !(operator> (ref1, ref2));
122  }
123 
125  inline bool operator>= (const PIPRef& ref1, const PIPRef& ref2)
126  {
127  return !(operator< (ref1, ref2));
128  }
129 
130 
132  typedef std::vector<PIPRef> PIPRefs;
133 
134 }
135 
136 #endif