- 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

bool isLocked (void)
Bus< 1 > makeBus (void)
void operator= (const LineState &value)
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

 Line (void)
 Line (const Line &line)
virtual ~Line ()
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 lock (Module *mod, unsigned int delay)
void unLock (Module *mod)

Friends

class Bus
class InputBus


Constructor & Destructor Documentation

lcs::Line::Line ( void   )  [private]

Default constructor.

lcs::Line::Line ( const Line line  )  [private]

Copy constructor.

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

Destructor.


Member Function Documentation

bool lcs::Line::isLocked ( void   ) 

Returns true if the line is locked, else returns false .

void lcs::Line::lock ( Module mod,
unsigned int  delay 
) [private]

This function locks a lcs::Line object for use with only that lcs::Module derivative which has locked the it. Since it is declared private, it cannot be used directly. One has to use lcs::Bus::lock instead.

One can also set assignment delay associated with the line using this function. Again, this feature cannot be used directly and one will have to use lcs::Bus::lock instead.

Parameters:
mod The pointer to an module object (which is an instance of a derivative of lcs::Module class) by which the line should be locked.
delay The assignment delay associated with the line.

Bus<1> lcs::Line::makeBus ( void   ) 

Returns a single line lcs::Bus object encapsulating the line.

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.

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::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::unLock ( Module mod  )  [private]

This functions unLocks a line from a module. Since it is declared private, it cannot be used directly. One has to use lcs::Bus::unLock instead. See lcs::Line::lock for more information.

Parameters:
mod The pointer to an module object (which is an instance of a derivative of lcs::Module class) with which the line was locked earlier.

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 InputBus [friend]

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


Copyright © 2006, 2007 Siva Chandra