- A Logic Circuit Simulation Library in C++ |
#include <clock.h>
Inheritance diagram for lcs::Clock:
Clock
object. The returned Clock
object is instantiated by a shallow copy-constructor.
The pulse width of the clock can be altered using the lcs::Clock::setPulseWidth
function. The pulse width is measured in system time units. By default, the pulse width is set to 100 system time units.
See lcs::SystemTimer
for more information.
Public Member Functions | |
Clock (const Clock &clk) | |
~Clock () | |
virtual void | tick () |
void | setPulseWidth (unsigned int width) |
void | notifyTick (TickListener *tl) |
void | stopTickNotification (TickListener *tl) |
void | destroyClock (void) |
Static Public Member Functions | |
static const Clock & | getClock (void) throw (NullClockException) |
lcs::Clock::Clock | ( | const Clock & | clk | ) |
Copy constructor.
lcs::Clock::~Clock | ( | ) |
Destructor.
void lcs::Clock::destroyClock | ( | void | ) |
WARNING :: Do not ever call this function. It is used by the simulation system (the class lcs::Simulation
) to gracefully free the memory used by the single, full Clock
object.
static const Clock& lcs::Clock::getClock | ( | void | ) | throw (NullClockException) [static] |
Returns a clock object. The returned object is a shallow copy of the single Clock
object which can exist.
void lcs::Clock::notifyTick | ( | TickListener * | tl | ) |
This function can used by a lcs::TickListener
derivative to get notified of a clock pulse.
void lcs::Clock::setPulseWidth | ( | unsigned int | width | ) |
Sets the pulse width of the clock in system time units.
width | The desired pulse width in system time units. |
void lcs::Clock::stopTickNotification | ( | TickListener * | tl | ) |
A lcs::TickListener
derivative which registered to be notified of a clock pulse should de-register using this function when notification is no longer required. Hence, this function should be called before the object ceases to exist in the simulation system. Else, a segmentation fault is bound to occur.
virtual void lcs::Clock::tick | ( | ) | [virtual] |
This function is used by lcs::SystemTimer
to notify the clock of the system time. This function will never need to be used by a user of libLCS.