Clock Class Reference

#include <Clock.h>

Inheritance diagram for Clock:
ListenerObject

# Public Member Functions

void constructor ()
 Class' constructor.
void destructor ()
 Class' destructor.
void start ()
 Start the clock.
void stop ()
 Stop the clock.
void pause (bool pause)
void reset ()
 Reset the clock's elapsed time.
void update (uint32 elapsedMilliseconds)
bool isPaused ()
uint32 getMilliseconds ()
uint32 getMinutes ()
uint32 getSeconds ()
void print (int32 col, int32 row, const char *font)

# Static Public Member Functions

static void printTime (uint32 milliseconds, int32 x, int32 y, const char *font, uint32 precision)
static void printDeciseconds (uint32 milliSeconds, int32 x, int32 y, const char *font)
static void printCentiseconds (uint32 milliSeconds, int32 x, int32 y, const char *font)
static void printMilliseconds (uint32 milliSeconds, int32 x, int32 y, const char *font)

# Protected Attributes

uint32 milliseconds
 Elapsed time in milliseconds.
uint32 previousSecond
 Previous elapsed second.
uint32 previousMinute
 Previous elapsed minute.
bool paused
 Flag to signal if the clock is paused or not.

# Additional Inherited Members

- Private Member Functions inherited from ListenerObject
void constructor ()
 Class' constructor.
void destructor ()
 Class' destructor.
void addEventListener (ListenerObject listener, uint16 eventCode)
void removeEventListener (ListenerObject listener, uint16 eventCode)
void removeEventListeners (uint16 eventCode)
void removeAllEventListeners ()
 Remove all listener objects.
bool hasActiveEventListeners ()
void fireEvent (uint16 eventCode)
void sendMessageTo (ListenerObject receiver, uint32 message, uint32 delay, uint32 randomDelay)
void sendMessageToSelf (uint32 message, uint32 delay, uint32 randomDelay)
void discardAllMessages ()
 Discard all messages, both to be sent and to be received.
void discardMessages (uint32 message)
virtual bool onEvent (ListenerObject eventFirer, uint16 eventCode)
virtual bool handleMessage (Telegram telegram)
- Private Attributes inherited from ListenerObject
VirtualList events
 List of registered events.
int8 eventFirings
 Counter that keeps track of the number of fired events to prevent race conditions in nested firings.

# Detailed Description

Class Clock

Inherits from ListenerObject

Implements simple clock that can keep track of time and print itself.

Definition at line 40 of file Clock.h.

# Member Function Documentation

# constructor()

void Clock::constructor ( )

Class' constructor.

Definition at line 122 of file Clock.c.

# destructor()

void Clock::destructor ( )

Class' destructor.

Definition at line 142 of file Clock.c.

# getMilliseconds()

uint32 Clock::getMilliseconds ( )

Retrieve the elapsed milliseconds.

Returns
Elapsed milliseconds

Definition at line 228 of file Clock.c.

# getMinutes()

uint32 Clock::getMinutes ( )

Retrieve the elapsed minutes.

Returns
Elapsed minutes

Definition at line 242 of file Clock.c.

# getSeconds()

uint32 Clock::getSeconds ( )

Retrieve the elapsed seconds.

Returns
Elapsed seconds

Definition at line 235 of file Clock.c.

# isPaused()

bool Clock::isPaused ( )

Retrieve the clock's paused state

Returns
True if the clock is paused

Definition at line 221 of file Clock.c.

# pause()

void Clock::pause ( bool pause)

Pause/unpause the clock

Parameters
pauseFlag to set the paused state of the clock

Definition at line 169 of file Clock.c.

# print()

void Clock::print ( int32 col,
int32 row,
const char * font )

Print the clock's time in MM::SS:XX format

Parameters
colScreen x coordinate where to print
rowScreen y coordinate where to print
fontPointer to font's name to use

Definition at line 249 of file Clock.c.

# printCentiseconds()

static void Clock::printCentiseconds ( uint32 milliSeconds,
int32 x,
int32 y,
const char * font )
static

Print the total centiseconds in the elapsed time provided.

Parameters
milliSecondsTotal time to print
xScreen x coordinate where to print
yScreen y coordinate where to print
fontPointer to font's name to use

Definition at line 75 of file Clock.c.

# printDeciseconds()

static void Clock::printDeciseconds ( uint32 milliSeconds,
int32 x,
int32 y,
const char * font )
static

Print the total deciseconds in the elapsed time provided.

Parameters
milliSecondsTotal time to print
xScreen x coordinate where to print
yScreen y coordinate where to print
fontPointer to font's name to use

Definition at line 65 of file Clock.c.

# printMilliseconds()

static void Clock::printMilliseconds ( uint32 milliSeconds,
int32 x,
int32 y,
const char * font )
static

Print the total milliseconds in the elapsed time provided.

Parameters
milliSecondsTotal time to print
xScreen x coordinate where to print
yScreen y coordinate where to print
fontPointer to font's name to use

Definition at line 93 of file Clock.c.

# printTime()

static void Clock::printTime ( uint32 milliseconds,
int32 x,
int32 y,
const char * font,
uint32 precision )
static

Print time in MM::SS:XX format

Parameters
millisecondsTotal time to print
xScreen x coordinate where to print
yScreen y coordinate where to print
fontPointer to font's name to use
precisionPrecision of the second decimals

Definition at line 26 of file Clock.c.

# reset()

void Clock::reset ( )

Reset the clock's elapsed time.

Definition at line 176 of file Clock.c.

# start()

void Clock::start ( )

Start the clock.

Definition at line 153 of file Clock.c.

# stop()

void Clock::stop ( )

Stop the clock.

Definition at line 161 of file Clock.c.

# update()

void Clock::update ( uint32 elapsedMilliseconds)

Update the clock's elapsed time

Parameters
elapsedMillisecondsMilliseconds that have passed since the previous call to the update method

Definition at line 185 of file Clock.c.

# Member Data Documentation

# milliseconds

uint32 Clock::milliseconds
protected

Elapsed time in milliseconds.

Definition at line 45 of file Clock.h.

# paused

bool Clock::paused
protected

Flag to signal if the clock is paused or not.

Definition at line 54 of file Clock.h.

# previousMinute

uint32 Clock::previousMinute
protected

Previous elapsed minute.

Definition at line 51 of file Clock.h.

# previousSecond

uint32 Clock::previousSecond
protected

Previous elapsed second.

Definition at line 48 of file Clock.h.


The documentation for this class was generated from the following files:
  • VUEngine-Core/source/Misc/Time/Clock.h
  • VUEngine-Core/source/Misc/Time/Clock.c