SysEvent.h

Classes

SysEvent -- abstract base class for system events (from X, Glish, signals) (full description)
SysEventSource -- abstract base class for system event sources (full description)
SysEventTarget -- abstract base class for system event targets (handlers) (full description)
SysEventTargetInfo -- Internal class (full description)

class SysEvent

Types

enum Group

UnknownGroup = 0
XGroup
GlishGroup
SigGroup

Interface

Public Members
SysEvent() : rep(0), src(0)
SysEvent(const SysEvent &other) : rep(other.clone()), src(other.src)
virtual ~SysEvent()
int operator==(const SysEvent &other)
SysEvent &operator=(const SysEvent &other)
virtual Group group() const
virtual String type() const
virtual Bool dispatch(SysEventTarget &e)
virtual Bool dispatch(SysEventTarget &e, SysEventSource &xs)
SysEventSource *source()
Protected Members
SysEvent(SysEvent *other, SysEventSource *s) : rep(other), src(s)
SysEvent(SysEventSource *s) : rep(0), src(s)
virtual SysEvent *clone() const

Description

Review Status

Reviewed By:
Paul Shannon
Date Reviewed:
1995/03/02

Prerequisite

Etymology

Event is the class describing astronomical events, so 'SysEvent' was picked to distinguish it.

Synopsis

This class is the base class for all system events. It is simply a wrapper around the basic types of events which must be handled in the system, e.g. X events, Glish events, signals, etc. It provides a common interface to all events.

Motivation

To write a windowing Glish client, it is necessary to mix the X and Glish event loops. While this could have been done by explicitly writing the X event loop each time, it is better to encapsulate the event loop in a couple of classes. This class does this for the actual events.

Member Description

enum Group

These are the various types of events which can be handled.

SysEvent() : rep(0), src(0)

Creates an unusable event, but the event can be assigned to.

SysEvent(const SysEvent &other) : rep(other.clone()), src(other.src)

Creates an event given another event.

virtual ~SysEvent()

int operator==(const SysEvent &other)

Equality operator checks to see if two events are identical. This just uses the "group()" and the "type()" to determine equality.

SysEvent &operator=(const SysEvent &other)

virtual Group group() const

Returns the group to which this event belongs.

virtual String type() const

Returns the type of this event represented as a String.

virtual Bool dispatch(SysEventTarget &e)

Sends the event to the event target parameter.

virtual Bool dispatch(SysEventTarget &e, SysEventSource &xs)

Dispatches the event to the event target parameter, but it also carries along an extra event source in case it is needed. This is needed, for example, when a non-X event target wants to do something on the GUI, the X event source must be known.

SysEventSource *source()

Returns the event source which generated this event.

SysEvent(SysEvent *other, SysEventSource *s) : rep(other), src(s)

Protected constructor which is used by derived classes to fill the letter (here rep).

SysEvent(SysEventSource *s) : rep(0), src(s)

virtual SysEvent *clone() const

Returns a "deep" copy of the object.


class SysEventSource

Interface

Public Members
SysEventSource()
virtual ~SysEventSource()
virtual SysEvent::Group group() const = 0
virtual SysEvent nextEvent() = 0
virtual Bool waitingEvent() = 0
virtual Bool connected() = 0
virtual Bool canCombine(const SysEventSource &src) const = 0
virtual Bool canCombine(const SysEventSource *src) const = 0
virtual Bool combine(SysEventSource &src) = 0
virtual Bool combine(SysEventSource *src) = 0
virtual Bool addTarget(SysEventTarget &tgt, const String &regx) = 0
virtual Bool addTarget(SysEventTarget *tgt, const String &regx, Bool ownTarget=False) = 0
virtual Bool addTarget(SysEventTargetProc tgt, const String &regx, void *userData=0) = 0
virtual Bool setDefault(SysEventTarget &tgt) = 0
virtual Bool setDefault(SysEventTarget *tgt, Bool ownTarget=False) = 0
virtual Bool setDefault(SysEventTargetProc tgt, void *userData=0) = 0
virtual Bool loop() = 0
virtual void invokeTarget() = 0

Description

Review Status

Reviewed By:
Paul Shannon
Date Reviewed:
1995/03/02

Prerequisite

Etymology

See SysEvent

Synopsis

This class is the base class for all of the sources of events within the system, e.g. X Window System, Glish. These are the entities which generate the events which must be handled.

Motivation

See SysEvent

Member Description

SysEventSource()

virtual ~SysEventSource()

virtual SysEvent::Group group() const = 0

Returns the group to which the event source belongs.

virtual SysEvent nextEvent() = 0

Returns the next event which needs to be processed. This function may blocks until an event is ready to be returned.

virtual Bool waitingEvent() = 0

Used to check to see if there are any events waiting to be processed.

virtual Bool connected() = 0

Used to check to see if the event source is still "connected", i.e. whether it is still a valid source of events.

virtual Bool addTarget(SysEventTarget &tgt, const String &regx) = 0
virtual Bool addTarget(SysEventTarget *tgt, const String &regx, Bool ownTarget=False) = 0
virtual Bool addTarget(SysEventTargetProc tgt, const String &regx, void *userData=0) = 0

Part of the event driven interface to SysEventSource. These return True upon success, and False upon failure.

Invoke the target whenever the event matches the regular expression.

virtual Bool setDefault(SysEventTarget &tgt) = 0
virtual Bool setDefault(SysEventTarget *tgt, Bool ownTarget=False) = 0
virtual Bool setDefault(SysEventTargetProc tgt, void *userData=0) = 0

Part of the event driven interface to SysEventSource. These return True upon success, and False upon failure.

Specifies the default action

virtual Bool canCombine(const SysEventSource &src) const = 0
virtual Bool canCombine(const SysEventSource *src) const = 0
virtual Bool combine(SysEventSource &src) = 0
virtual Bool combine(SysEventSource *src) = 0
virtual Bool loop() = 0
virtual void invokeTarget() = 0

Part of the event driven interface to SysEventSource. These return True upon success, and False upon failure.


class SysEventTarget

Interface

SysEventTarget()
virtual ~SysEventTarget()
virtual SysEvent::Group group() const = 0
virtual Bool canHandle(SysEvent &event)
virtual Bool handle(SysEvent)
virtual SysEventTarget *clone() const = 0

Description

Review Status

Reviewed By:
Paul Shannon
Date Reviewed:
1995/03/02

Prerequisite

Etymology

See SysEvent

Synopsis

This class is the base class for all of the handlers of events within the system. The classes which derive from this class are the ones which react to waiting events. They are analogous to X event handlers.

Motivation

See SysEvent

Member Description

SysEventTarget()

virtual ~SysEventTarget()

virtual SysEvent::Group group() const = 0

Returns the group to which the event target belongs.

virtual Bool canHandle(SysEvent &event)

Checks to see if a given SysEventTarget can handle a particular event.

virtual Bool handle(SysEvent)

virtual SysEventTarget *clone() const = 0


class SysEventTargetInfo

Types

enum TargetType

Unknown = 0
ClassTgt
ProcTgt

Interface

SysEventTargetInfo(SysEventTargetProc t,const String &r,void *u=0)
SysEventTargetInfo(SysEventTargetProc t, void *u=0)
SysEventTargetInfo(SysEventTarget *t,const String &r)
SysEventTargetInfo(SysEventTarget *t)
SysEventTargetInfo(SysEventTargetInfo &other)
SysEventTargetInfo &operator=(SysEventTargetInfo &other)
virtual ~SysEventTargetInfo()
Regex &getRegex()
void *getUserData()
virtual SysEventTarget &getTarget()
SysEventTargetProc getTargetProc()
TargetType type() const
virtual uInt id() const ; //

Description

This class is used as a container of information for dispatching targets. It facilitates invoking targets based on regular expressions.

This class is not intended for external use.

Member Description

enum TargetType

SysEventTargetInfo(SysEventTargetProc t,const String &r,void *u=0)

SysEventTargetInfo(SysEventTargetProc t, void *u=0)

SysEventTargetInfo(SysEventTarget *t,const String &r)

SysEventTargetInfo(SysEventTarget *t)

SysEventTargetInfo(SysEventTargetInfo &other)

SysEventTargetInfo &operator=(SysEventTargetInfo &other)

virtual ~SysEventTargetInfo()

Regex &getRegex()

void *getUserData()

virtual SysEventTarget &getTarget()

SysEventTargetProc getTargetProc()

TargetType type() const

virtual uInt id() const ; //