Bitstream Interpretation Library (BIL)  0.1
WireConnection.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 #ifndef BIL_WIRECONNECTION_HPP
8 #define BIL_WIRECONNECTION_HPP
9 
10 #include <vector>
12 
13 
14 namespace bil {
15 
30  public:
31 
32  /**********************************************************************/
33  /* CONSTRUCTION / DESTRUCTION */
34  /**********************************************************************/
35 
40 
41 
42  /**********************************************************************/
43  /* DESTINATION SITE OFFSET */
44  /**********************************************************************/
45 
50  void xOffset(short offset);
51 
56  short xOffset() const;
57 
58 
63  void yOffset(short offset);
64 
69  short yOffset() const;
70 
71 
72  /**********************************************************************/
73  /* DESTINATION TILE TYPE INDEX */
74  /**********************************************************************/
75 
80  void tileTypeIndex(unsigned short index);
81 
86  unsigned short tileTypeIndex() const;
87 
88 
89  /**********************************************************************/
90  /* DESTINATION WIRE INDEX */
91  /**********************************************************************/
92 
97  void wireIndex(unsigned short index);
98 
103  unsigned short wireIndex() const;
104 
105 
106  /**********************************************************************/
107  /* MODIFICATORS */
108  /**********************************************************************/
109 
113  void clear();
114 
115 
116  private:
117 
118  friend bool operator== (const WireConnection& c1, const WireConnection& c2);
119 
120  friend void writeBinary(const WireConnection& data, std::ostream& outputStream);
121  friend void readBinary(WireConnection& data, std::istream& inputStream);
122 
123  short m_xOffset;
124  short m_yOffset;
125  unsigned short m_tileTypeIndex;
126  unsigned short m_wireIndex;
127 
128  };
129 
130 
132  inline bool operator== (const WireConnection& c1, const WireConnection& c2)
133  {
134  if (c1.m_xOffset != c2.m_xOffset) return false;
135  if (c1.m_yOffset != c2.m_yOffset) return false;
136  if (c1.m_tileTypeIndex != c2.m_tileTypeIndex) return false;
137  return (c1.m_wireIndex == c2.m_wireIndex);
138  }
139 
141  inline bool operator!= (const WireConnection& c1, const WireConnection& c2)
142  {
143  return !(operator== (c1, c2));
144  }
145 
146 
148  typedef std::vector<WireConnection> WireConnections;
149 
150 }
151 
152 #endif