Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Examples  

gadget::Event Class Reference

Base event type that an event source may generate. More...

#include <Event.h>

Inheritance diagram for gadget::Event:

Inheritance graph
[legend]
List of all members.

Public Methods

const EventTypetype () const
 Returns the type of this event. More...

void setType (const EventType &type)
 Set the type of this event. More...

const unsigned long & time () const
 Returns the time at which the event occurred. More...

virtual ~Event ()
virtual vpr::ReturnStatus writeObject (vpr::ObjectWriter *writer)
virtual vpr::ReturnStatus readObject (vpr::ObjectReader *reader)

Protected Methods

 Event (const EventType &type, const unsigned long &time)
 Initializes data members. More...


Protected Attributes

EventType mType
 The event type. More...

unsigned long mTime
 Time at which the event occurred. More...


Detailed Description

Base event type that an event source may generate.

This class cannot be instantiated directly, and instead, subclasses must be used.

Definition at line 56 of file Event.h.


Constructor & Destructor Documentation

virtual gadget::Event::~Event   [inline, virtual]
 

Definition at line 88 of file Event.h.

00089    {
00090    }

gadget::Event::Event const EventType   type,
const unsigned long &    time
[inline, protected]
 

Initializes data members.

Parameters:
type  The type of this event from the Event::Type enumeration.
time  The time at which this event occurred. This should be as accurate as possible, preferabbly acquired from the operating system or windowing system event data structure. The time at which the event was processed is not an acceptable value.

Definition at line 107 of file Event.h.

References gadget::EventType.

00108       : mType(type), mTime(time)
00109    {
00110    }


Member Function Documentation

const EventType& gadget::Event::type   const [inline]
 

Returns the type of this event.

This can be used for dynamic casting to more specific event types.

Definition at line 63 of file Event.h.

References gadget::EventType.

00064    {
00065       return mType;
00066    }

void gadget::Event::setType const EventType   type [inline]
 

Set the type of this event.

This is needed because while using an Object Reader to de-serialize an Event we can not set the type during construction. We must set the event type after creating this event using the EventFactory. This could later be removed if the EventFactory is chaged to take care of this.

Definition at line 75 of file Event.h.

References gadget::EventType.

00076    {
00077       mType = type;
00078    }

const unsigned long& gadget::Event::time   const [inline]
 

Returns the time at which the event occurred.

Definition at line 83 of file Event.h.

00084    {
00085       return mTime;
00086    }

vpr::ReturnStatus gadget::Event::writeObject vpr::ObjectWriter *    writer [virtual]
 

Reimplemented in gadget::KeyEvent.

Definition at line 43 of file Event.cpp.

References mTime, and mType.

00044 {
00045    writer->writeUint8(mType);
00046    writer->writeUint64(mTime);
00047    return vpr::ReturnStatus::Succeed;
00048 }

vpr::ReturnStatus gadget::Event::readObject vpr::ObjectReader *    reader [virtual]
 

Reimplemented in gadget::KeyEvent.

Definition at line 50 of file Event.cpp.

References mTime, and mType.

00051 {
00052    mType = (EventType)reader->readUint8();
00053    mTime = reader->readUint64();
00054    return vpr::ReturnStatus::Succeed;
00055 }


Member Data Documentation

EventType gadget::Event::mType [protected]
 

The event type.

Definition at line 112 of file Event.h.

Referenced by readObject, gadget::MouseEvent::writeObject, gadget::KeyEvent::writeObject, and writeObject.

unsigned long gadget::Event::mTime [protected]
 

Time at which the event occurred.

Definition at line 113 of file Event.h.

Referenced by gadget::KeyEvent::readObject, readObject, gadget::KeyEvent::writeObject, and writeObject.


The documentation for this class was generated from the following files:
Generated on Sun May 2 14:26:57 2004 for Gadgeteer by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002