Topic Guide: Reading the line states of lcs::Bus and lcs::InputBus objects


The lines states of lcs::Bus and lcs::InputBus objects can be read using the overloaded operator[] of the class lcs::InputBus (Note that lcs::Bus is derived from lcs::InputBus). The overloaded operator returns a const lcs::LineState value corresponding the state of bus line indicated by the index passed to the operator []. The usage is very similar to how one would read the element values from a standard data type array. However, since a const LineState value, and not a non-const reference to the LineState value is returned, one cannot set the line states using the operator [].

An example of reading the line states from the lines of a bus is as follows.

lcs::Bus<8> bus(128); // The bus lines are initialised to a binary equivalent of the decimal integer 
                      // 128.

lcs::LineState bit0 = bus[0], bit5 = bus[5]; // Reading the line states of the bus.

bus[1] = lcs::HIGH; // Error!! Line states cannot be set using lcs::InputBus::operator[].

Generated on Sat Oct 14 11:23:40 2006 for libLCS by  doxygen 1.4.7