- A Logic Circuit Simulation Library in C++





lcs::Line Class Reference

#include <line.h>

List of all members.


Detailed Description

This is a class which encapsulates a data line. A Line object is used to denote one bit of a lcs::Bus and lcs::InputBus objects. Various operators are supported to facilitate bit operations on Line objects.


Public Member Functions

 Line (void)
 Line (const Line &line)
virtual ~Line ()
void operator= (const LineState &value)
template<int bits, ExprType Type, typename LExprType, typename RExprType>
void operator= (const Expression< bits, Type, LExprType, RExprType > &expr)
template<int bits>
void operator= (const InputBus< bits > &bus)
const LineState operator() (void) const
const LineState operator| (const Line &line) const
const LineState operator & (const Line &line) const
const LineState operator^ (const Line &line) const
bool operator== (const LineState &state) const
bool operator!= (const LineState &state) const
void update (void)

Private Member Functions

const Lineoperator= (const Line &line)
void notify (const LineEvent &event, Module *mod, const int &portId)
void stopNotification (const LineEvent &event, Module *mod, const int &portId)
void setLineValue (const LineState &value)
void setAssDelay (unsigned int delay)

Friends

class Expression< 1, LINE_EXPR, void, void >
class Bus
class InputBus
class Clock


Constructor & Destructor Documentation

lcs::Line::Line ( void   ) 

Default constructor.

lcs::Line::Line ( const Line line  ) 

Copy constructor.

virtual lcs::Line::~Line (  )  [virtual]

Destructor.


Member Function Documentation

void lcs::Line::notify ( const LineEvent event,
Module mod,
const int &  portId 
) [private]

A lcs::Module (or its derivative) should register to be notified by the line about line events using this function. However, since this function is declared as a private member, one cannot use this function directly. See lcs::InputBus::notify for more information. The lcs::Line::notify is called by the function lcs::InputBus::notify.

Parameters:
event The event of whose occurance the module should be notified of.
mod Pointer to the lcs::Module object which has to be driven by the line.
portId The id of the module port to which the line is connected.

const LineState lcs::Line::operator & ( const Line line  )  const [inline]

Overloaded bit AND operator. Performs a AND operation of the line states of two Line objects.

bool lcs::Line::operator!= ( const LineState state  )  const [inline]

Overloaded logical inequality operator. Compares the line state with a LineState variable.

Parameters:
state The LineState variable with which the comparison should be made.

const LineState lcs::Line::operator() ( void   )  const [inline]

Returns the line state.

const Line& lcs::Line::operator= ( const Line line  )  [private]

Explicit assignment operator. The LHS Line object and the RHS Line object will both share the same line data after assignment.

template<int bits>
void lcs::Line::operator= ( const InputBus< bits > &  bus  )  [inline]

Assignment oparator to facilitate assignment with an lcs::InputBus object.

template<int bits, ExprType Type, typename LExprType, typename RExprType>
void lcs::Line::operator= ( const Expression< bits, Type, LExprType, RExprType > &  expr  )  [inline]

Assignment operator to facilitate assignment with an expression of bitwise operations.

void lcs::Line::operator= ( const LineState value  ) 

Overloaded assignment operator which sets the line state with a LineState variable.

Parameters:
value The value to which the line state should be changed.

bool lcs::Line::operator== ( const LineState state  )  const [inline]

Overloaded logical equality operator. Compares the line state with a LineState variable.

Parameters:
state The LineState variable with which the comparison should be made.

const LineState lcs::Line::operator^ ( const Line line  )  const [inline]

Overloaded bit XOR operator. Performs a XOR operation of the line states of two Line objects.

const LineState lcs::Line::operator| ( const Line line  )  const [inline]

Overloaded bit OR operator. Performs a OR operation of the line states of two Line objects.

void lcs::Line::setAssDelay ( unsigned int  delay  )  [inline, private]

Sets the assignement delay for the line.

void lcs::Line::setLineValue ( const LineState value  )  [private]

This is an internal function used by other functions of this class. As it is declared as private, a user of libLCS will never require to use this function.

void lcs::Line::stopNotification ( const LineEvent event,
Module mod,
const int &  portId 
) [private]

A lcs::Module (or its derivative) can de-register itself from being driven by the line using this function. See lcs::Line::notify for more information. As with lcs::Line::notify, even this function is declared private and hence cannot be used directly. One has to use lcs::Bus::stopNotification, which internally makes a call to lcs::Line::stopNotification.

Parameters:
event The event of whose occurance the module was being notified of.
mod Pointer to the lcs::Module object which should be de-registered from being notifed by the line.
portId The id of the module port to which the line is connected.

void lcs::Line::update ( void   ) 

This function is used by the system time keeper to notify the line to let it update it's state after a certain delay. Under normal circumstances, a user of libLCS will never require to call this function.


Friends And Related Function Documentation

friend class Bus [friend]

lcs::Bus classes of all sizes are friends of this class.

friend class Clock [friend]

lcs::Clock is a friend of this class.

friend class Expression< 1, LINE_EXPR, void, void > [friend]

An expression representing a single line is a friend.

friend class InputBus [friend]

lcs::InputBus classes of all sizes are friends of this class.


Copyright © 2006, 2007 Siva Chandra