ControlEvent Class Reference

Describes a change in a ControlState and some other useful data. More...

#include <Control.h>

Inheritance diagram for ControlEvent:

Inheritance graph
[legend]

List of all members.

Classes

union  TEventDependantData
 Data of an event of a control, which can be an axis or a switch (union). More...

Public Types

enum  EEventType {
  SWITCH_DOWN, SWITCH_UP, AXIS, LAST_NETWORK_EVENT,
  GFX_FRAME = LAST_NETWORK_EVENT, GFX_RESIZE
}

Public Member Functions

 ControlEvent (double time, EEventType type)
 Builds an event.
 ControlEvent (double time, ControlState::ESwitchId switchId, int unmappedKey, bool down)
 Builds a switch event.
 ControlEvent (double time, ControlState::EAxisId axisId, float movement)
 Builds an axis event.
 ControlEvent (const ControlEvent &v)
 Copies an event.
double getTime () const
 Gets the timestamp of the event.
EEventType getType () const
 Gets the type of the event.
ControlState::ESwitchId getSwitchId () const
 Returns the switch ID if the event is about a switch (result is undefined otherwise).
int getUnmappedKey () const
 Returns the unmapped key if the event is about a switch (result is undefined otherwise).
ControlState::EAxisId getAxisId () const
 Returns the axis ID if the event is about an axis (result is undefined otherwise).
float getAxisMovement () const
 Returns the axis relative movement if the event is about an axis (result is undefined otherwise).

Protected Attributes

double time
 Timestamp of the event.
EEventType type
 Type of the event.
TEventDependantData data


Detailed Description

Describes a change in a ControlState and some other useful data.

Author:
Sukender
Todo:
Must be thread safe.
Version:
0.2.0

Definition at line 172 of file Control.h.


Member Enumeration Documentation

Enumerator:
SWITCH_DOWN 
SWITCH_UP 
AXIS 
LAST_NETWORK_EVENT  Indicates the "past the end" event that can be send across the network.
GFX_FRAME 
GFX_RESIZE 

Definition at line 174 of file Control.h.


Constructor & Destructor Documentation

ControlEvent::ControlEvent ( double  time,
EEventType  type 
) [inline]

Builds an event.

Definition at line 182 of file Control.h.

ControlEvent::ControlEvent ( double  time,
ControlState::ESwitchId  switchId,
int  unmappedKey,
bool  down 
) [inline]

ControlEvent::ControlEvent ( double  time,
ControlState::EAxisId  axisId,
float  movement 
) [inline]

ControlEvent::ControlEvent ( const ControlEvent v  )  [inline]


Member Function Documentation

ControlState::EAxisId ControlEvent::getAxisId (  )  const [inline]

Returns the axis ID if the event is about an axis (result is undefined otherwise).

Definition at line 203 of file Control.h.

References ASSERT, AXIS, ControlEvent::TEventDependantData::axisMovement, data, TrivialPair< T1, T2 >::first, and type.

Referenced by ControlMapper::onControlEventReceived().

float ControlEvent::getAxisMovement (  )  const [inline]

Returns the axis relative movement if the event is about an axis (result is undefined otherwise).

Definition at line 205 of file Control.h.

References ASSERT, AXIS, ControlEvent::TEventDependantData::axisMovement, data, TrivialPair< T1, T2 >::second, and type.

Referenced by ControlMapper::onControlEventReceived().

ControlState::ESwitchId ControlEvent::getSwitchId (  )  const [inline]

Returns the switch ID if the event is about a switch (result is undefined otherwise).

Definition at line 199 of file Control.h.

References ASSERT, data, TrivialPair< T1, T2 >::first, SWITCH_DOWN, SWITCH_UP, ControlEvent::TEventDependantData::switchId, and type.

Referenced by ControlMapper::onControlEventReceived().

double ControlEvent::getTime (  )  const [inline]

Gets the timestamp of the event.

Definition at line 194 of file Control.h.

References time.

Referenced by ControlMapper::onControlEventReceived().

EEventType ControlEvent::getType (  )  const [inline]

Gets the type of the event.

Definition at line 196 of file Control.h.

References type.

Referenced by ControlMapper::onControlEventReceived().

int ControlEvent::getUnmappedKey (  )  const [inline]

Returns the unmapped key if the event is about a switch (result is undefined otherwise).

Definition at line 201 of file Control.h.

References ASSERT, data, TrivialPair< T1, T2 >::second, SWITCH_DOWN, SWITCH_UP, ControlEvent::TEventDependantData::switchId, and type.

Referenced by ControlMapper::onControlEventReceived().


Member Data Documentation

Definition at line 218 of file Control.h.

Referenced by ControlEvent(), getAxisId(), getAxisMovement(), getSwitchId(), and getUnmappedKey().

double ControlEvent::time [protected]

Timestamp of the event.

Definition at line 208 of file Control.h.

Referenced by getTime().

Type of the event.

Definition at line 209 of file Control.h.

Referenced by ControlEvent(), getAxisId(), getAxisMovement(), getSwitchId(), getType(), and getUnmappedKey().


The documentation for this class was generated from the following file:

Generated on Sun Jan 17 11:39:26 2010 for PVLE (Pro-Vocation Light Engine) by  doxygen 1.5.9