Bitstream Interpretation Library (BIL)  0.1
PinWire.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 #ifndef BIL_PINWIRE_HPP
8 #define BIL_PINWIRE_HPP
9 
10 #include <vector>
12 
13 
14 namespace bil {
15 
22  class PinWire {
23  public:
24 
25  /**********************************************************************/
26  /* CONSTRUCTION / DESTRUCTION */
27  /**********************************************************************/
28 
32  PinWire();
33 
34 
35  /**********************************************************************/
36  /* WIRE INDEX */
37  /**********************************************************************/
38 
43  void wireIndex(unsigned short index);
44 
49  unsigned short wireIndex() const;
50 
51 
52  /**********************************************************************/
53  /* PIN INDEX */
54  /**********************************************************************/
55 
60  void pinIndex(unsigned short index);
61 
66  unsigned short pinIndex() const;
67 
68 
69  /**********************************************************************/
70  /* MODIFICATORS */
71  /**********************************************************************/
72 
76  void clear();
77 
78 
79  private:
80 
81  friend bool operator== (const PinWire& pw1, const PinWire& pw2);
82 
83  friend void writeBinary(const PinWire& data, std::ostream& outputStream);
84  friend void readBinary(PinWire& data, std::istream& inputStream);
85 
86  unsigned short m_wireIndex;
87  unsigned short m_pinIndex;
88 
89  };
90 
92  inline bool operator== (const PinWire& pw1, const PinWire& pw2)
93  {
94  if (pw1.m_wireIndex != pw2.m_wireIndex) return false;
95  return (pw1.m_pinIndex == pw2.m_pinIndex);
96  }
97 
99  inline bool operator!= (const PinWire& pw1, const PinWire& pw2)
100  {
101  return !(operator== (pw1, pw2));
102  }
103 
104 
106  typedef std::vector<PinWire> PinWires;
107 
108 }
109 
110 #endif