omegalib  13.1
omicron::Event Class Reference

Events are generated by Service instances. More...

#include <Event.h>

Public Member Functions

 Event ()
 
void copyFrom (const Event &e)
 
size_t serialize (omicronConnector::EventData *ed) const
 Serializes this event to a streamable event data packet. More...
 
void deserialize (const omicronConnector::EventData *ed)
 Deserializes from an event data packet. More...
 
void reset (Type type, Service::ServiceType serviceType, uint sourceId=0, unsigned short serviceId=0, unsigned short userId=0)
 
void resetSourceId (uint newSourceId)
 Only resets the event source id, keeping the rest of the event data intact. More...
 
void resetType (Type type)
 Only resets the event type, keeping the rest of the event data intact. More...
 
unsigned int getSourceId () const
 id of the source of this event. Input services associate unique ids to each of their event sources. More...
 
Service::ServiceType getServiceType () const
 Type of the service that generated this event. More...
 
void setProcessed () const
 Used to mark events that have been processed. More...
 
bool isProcessed () const
 
void setExclusive () const
 being broadcast. More...
 
bool isExclusive () const
 
const Vector3fgetPosition () const
 Get the event position. More...
 
void setServiceType (Service::ServiceType type)
 
unsigned int getServiceId () const
 Gets the unique id of the event service that generated this event. More...
 
unsigned int getUserId () const
 Numeric id of the user associated to this event. More...
 
unsigned int getDeviceTag () const
 Gets the event device tag. More...
 
Type getType () const
 The event type. More...
 
unsigned int getTimestamp () const
 Gets the event timestamp. The timestamp is updated everytime the Event::reset is called. More...
 
void setPosition (const Vector3f &value)
 Set to true if this event has been processed already. More...
 
void setPosition (float x, float y, float z)
 
void setPosition (float x, float y)
 
const QuaterniongetOrientation () const
 Rotation. More...
 
void setOrientation (const Quaternion &value)
 
void setOrientation (float w, float x, float y, float z)
 
bool isFlagSet (uint flag) const
 Event flags. More...
 
void setFlags (uint flags) const
 
void clearFlags () const
 
uint getFlags () const
 
bool isKeyDown (int key) const
 Utility method to check is the event is a key down event. More...
 
bool isKeyUp (int key) const
 Utility method to check is the event is a key up event. More...
 
bool isButtonDown (Flags button) const
 Utility method to check if the event is a button down event. More...
 
bool isButtonUp (Flags button) const
 
float getAxis (int axisId) const
 Utility method to read an axis value from the event extra data. More...
 
bool isFrom (Service *svc, int sourceId) const
 Utility method to check if an event is from a specific source service and source id. More...
 
bool isFrom (Service::ServiceType type, int sourceId) const
 Utility method to check if an event is from a specific service type and source id. More...
 
bool getChar (char *c) const
 Utility method that gets a character stored in this event. More...
 
void setExtraDataType (ExtraDataType type)
 Extra data. More...
 
ExtraDataType getExtraDataType () const
 
float getExtraDataFloat (int index) const
 
void setExtraDataFloat (int index, float value)
 
int getExtraDataInt (int index) const
 
void setExtraDataInt (int index, int value)
 
Vector3f getExtraDataVector3 (int index) const
 
void setExtraDataVector3 (int index, const Vector3f value)
 
const char * getExtraDataString () const
 
void setExtraDataString (const String &value)
 
void resetExtraData ()
 
bool isExtraDataNull (int pointId) const
 
void setExtraData (ExtraDataType type, unsigned int items, int mask, void *data)
 
uint getExtraDataMask () const
 
int getExtraDataSize () const
 Returns the size in bytes of the event extra data. More...
 
int getExtraDataItems () const
 Returns the number of elements stored in the extra data section of the Event. More...
 
void * getExtraDataBuffer () const
 Returns the raw etra data buffer. More...
 
- Public Member Functions inherited from omicron::ReferenceType
 ReferenceType ()
 
virtual ~ReferenceType ()
 
void ref ()
 
void unref ()
 
long refCount ()
 

Static Public Member Functions

static Event::Flags parseButtonName (const String &name)
 
static int parseJointName (const String &name)
 
- Static Public Member Functions inherited from omicron::ReferenceType
static void printObjCounts ()
 

Static Public Attributes

static const int ExtraDataSize = 1024
 
static const int MaxExtraDataItems = 32
 

Friends

class EventUtils
 
class Service
 

Additional Inherited Members

- Public Types inherited from omicron::EventBase
enum  ServiceType {
  ServiceTypePointer, ServiceTypeMocap, ServiceTypeKeyboard, ServiceTypeController,
  ServiceTypeUi, ServiceTypeGeneric, ServiceTypeBrain, ServiceTypeWand,
  ServiceTypeSpeech
}
 Enumerates the service classes supported by omicron. More...
 
enum  Type {
  Select = 0, Toggle = 1, ChangeValue = 2, Update = 3,
  Move = 4, Down = 5, Up = 6, Trace = 7,
  Connect = Trace, Untrace = 8, Disconnect = Untrace, Click = 9,
  Zoom = 15, Split = 18, Rotate = 21, Null = 666
}
 #PYAPI Supported event types. More...
 
enum  Flags {
  Left = 1 << 0, Button1 = 1 <<0, Right = 1 << 1, Button2 = 1 << 1,
  Middle = 1 << 2, Button3 = 1 << 2, Ctrl = 1 << 3, SpecialButton1 = 1 << 3,
  Alt = 1 << 4, SpecialButton2 = 1 << 4, Shift = 1 << 5, SpecialButton3 = 1 << 5,
  Button4 = 1 << 6, Enter = 1 << 6, Button5 = 1 << 7, Backspace = 1 << 7,
  Button6 = 1 << 8, Button7 = 1 << 9, ButtonUp = 1 << 10, ButtonDown = 1 << 11,
  ButtonLeft = 1 << 12, ButtonRight = 1 << 13, Button8 = 1 << 15, Button9 = 1 << 16,
  Processed = 1 << 14, Exclusive = 1 << 17, User = 1 << 18
}
 #PYAPI Defines some generic input event flags More...
 
enum  ExtraDataType {
  ExtraDataNull, ExtraDataFloatArray, ExtraDataIntArray, ExtraDataVector3Array,
  ExtraDataString, ExtraDataKinectSpeech
}
 
enum  OmicronSkeletonJoint {
  OMICRON_SKEL_HIP_CENTER, OMICRON_SKEL_HEAD, OMICRON_SKEL_NECK, OMICRON_SKEL_TORSO,
  OMICRON_SKEL_WAIST, OMICRON_SKEL_LEFT_COLLAR, OMICRON_SKEL_LEFT_SHOULDER, OMICRON_SKEL_LEFT_ELBOW,
  OMICRON_SKEL_LEFT_WRIST, OMICRON_SKEL_LEFT_HAND, OMICRON_SKEL_LEFT_FINGERTIP, OMICRON_SKEL_LEFT_HIP,
  OMICRON_SKEL_LEFT_KNEE, OMICRON_SKEL_LEFT_ANKLE, OMICRON_SKEL_LEFT_FOOT, OMICRON_SKEL_RIGHT_COLLAR,
  OMICRON_SKEL_RIGHT_SHOULDER, OMICRON_SKEL_RIGHT_ELBOW, OMICRON_SKEL_RIGHT_WRIST, OMICRON_SKEL_RIGHT_HAND,
  OMICRON_SKEL_RIGHT_FINGERTIP, OMICRON_SKEL_RIGHT_HIP, OMICRON_SKEL_RIGHT_KNEE, OMICRON_SKEL_RIGHT_ANKLE,
  OMICRON_SKEL_RIGHT_FOOT, OMICRON_SKEL_SPINE, OMICRON_SKEL_SHOULDER_CENTER, OMICRON_SKEL_LEFT_THUMB,
  OMICRON_SKEL_RIGHT_THUMB, OMICRON_SKEL_COUNT
}
 Joint enumerations for Kinect (Uses OpenNI's enumerations with additional Kinect for Windows values) See MSKinectService.h, XnTypes.h (OpenNI), or NuiSensor.h (Kinect for Windows) More...
 
enum  DeviceTagMask { DTServiceIdMask = 0x0000ffff, DTUserIdMask = 0xffff0000, DTUserIdOffset = 16, DTServiceIdOffset = 0 }
 Bit masks used to read the service id and user id from the event device tag. More...
 
- Static Protected Attributes inherited from omicron::ReferenceType
static List< ReferenceType * > mysObjList
 

Detailed Description

Events are generated by Service instances.

+ Inheritance diagram for omicron::Event:

Constructor & Destructor Documentation

omicron::Event::Event ( )
inline

Member Function Documentation

void omicron::Event::clearFlags ( ) const
inline
void omicron::Event::copyFrom ( const Event e)
inline
void omicron::Event::deserialize ( const omicronConnector::EventData ed)
inline

Deserializes from an event data packet.

float omicron::Event::getAxis ( int  axisId) const
inline

Utility method to read an axis value from the event extra data.

bool omicron::Event::getChar ( char *  c) const
inline

Utility method that gets a character stored in this event.

Returns
true if the event has been generated by a keyboard service and contains an ASCII character.
unsigned int omicron::Event::getDeviceTag ( ) const
inline

Gets the event device tag.

The device tag identifies the service and the user associated with this event. The lower two bytes contain the service id, while the top two bytes contain the user id. Both can be accessed using the getServiceId and getUserId utility functions.

void * omicron::Event::getExtraDataBuffer ( ) const
inline

Returns the raw etra data buffer.

float omicron::Event::getExtraDataFloat ( int  index) const
inline
int omicron::Event::getExtraDataInt ( int  index) const
inline
int omicron::Event::getExtraDataItems ( ) const
inline

Returns the number of elements stored in the extra data section of the Event.

uint omicron::Event::getExtraDataMask ( ) const
inline
int omicron::Event::getExtraDataSize ( ) const
inline

Returns the size in bytes of the event extra data.

const char * omicron::Event::getExtraDataString ( ) const
inline
Event::ExtraDataType omicron::Event::getExtraDataType ( ) const
inline
Vector3f omicron::Event::getExtraDataVector3 ( int  index) const
inline
uint omicron::Event::getFlags ( ) const
inline
const Quaternion & omicron::Event::getOrientation ( ) const
inline

Rotation.

const Vector3f & omicron::Event::getPosition ( ) const
inline

Get the event position.

unsigned int omicron::Event::getServiceId ( ) const
inline

Gets the unique id of the event service that generated this event.

This value is part of the device tag.

Service::ServiceType omicron::Event::getServiceType ( ) const
inline

Type of the service that generated this event.

unsigned int omicron::Event::getSourceId ( ) const
inline

id of the source of this event. Input services associate unique ids to each of their event sources.

unsigned int omicron::Event::getTimestamp ( ) const
inline

Gets the event timestamp. The timestamp is updated everytime the Event::reset is called.

Event::Type omicron::Event::getType ( ) const
inline

The event type.

unsigned int omicron::Event::getUserId ( ) const
inline

Numeric id of the user associated to this event.

This value is part of the device tag.

bool omicron::Event::isButtonDown ( Flags  button) const
inline

Utility method to check if the event is a button down event.

bool omicron::Event::isButtonUp ( Flags  button) const
inline
bool omicron::Event::isExclusive ( ) const
inline
bool omicron::Event::isExtraDataNull ( int  pointId) const
inline
bool omicron::Event::isFlagSet ( uint  flag) const
inline

Event flags.

bool omicron::Event::isFrom ( Service svc,
int  sourceId 
) const
inline

Utility method to check if an event is from a specific source service and source id.

bool omicron::Event::isFrom ( Service::ServiceType  type,
int  sourceId 
) const
inline

Utility method to check if an event is from a specific service type and source id.

bool omicron::Event::isKeyDown ( int  key) const
inline

Utility method to check is the event is a key down event.

bool omicron::Event::isKeyUp ( int  key) const
inline

Utility method to check is the event is a key up event.

bool omicron::Event::isProcessed ( ) const
inline
Event::Flags omicron::Event::parseButtonName ( const String name)
inlinestatic
int omicron::Event::parseJointName ( const String name)
inlinestatic
void omicron::Event::reset ( Type  type,
Service::ServiceType  serviceType,
uint  sourceId = 0,
unsigned short  serviceId = 0,
unsigned short  userId = 0 
)
inline
void omicron::Event::resetExtraData ( )
inline
void omicron::Event::resetSourceId ( uint  newSourceId)
inline

Only resets the event source id, keeping the rest of the event data intact.

Useful when dynamically re-routing events (i.e. to transparently re-associate head tracking sources to applications)

void omicron::Event::resetType ( Type  type)
inline

Only resets the event type, keeping the rest of the event data intact.

size_t omicron::Event::serialize ( omicronConnector::EventData ed) const
inline

Serializes this event to a streamable event data packet.

Returns the size of data to stream.

void omicron::Event::setExclusive ( ) const
inline

being broadcast.

void omicron::Event::setExtraData ( Event::ExtraDataType  type,
unsigned int  items,
int  mask,
void *  data 
)
inline
void omicron::Event::setExtraDataFloat ( int  index,
float  value 
)
inline
void omicron::Event::setExtraDataInt ( int  index,
int  value 
)
inline
void omicron::Event::setExtraDataString ( const String value)
inline
void omicron::Event::setExtraDataType ( Event::ExtraDataType  type)
inline

Extra data.

void omicron::Event::setExtraDataVector3 ( int  index,
const Vector3f  value 
)
inline
void omicron::Event::setFlags ( uint  flags) const
inline
void omicron::Event::setOrientation ( const Quaternion value)
inline
void omicron::Event::setOrientation ( float  w,
float  x,
float  y,
float  z 
)
inline
void omicron::Event::setPosition ( const Vector3f value)
inline

Set to true if this event has been processed already.

void omicron::Event::setPosition ( float  x,
float  y,
float  z 
)
inline
void omicron::Event::setPosition ( float  x,
float  y 
)
inline
void omicron::Event::setProcessed ( ) const
inline

Used to mark events that have been processed.

void omicron::Event::setServiceType ( Service::ServiceType  type)
inline

Friends And Related Function Documentation

friend class EventUtils
friend
friend class Service
friend

Member Data Documentation

const int omicron::Event::ExtraDataSize = 1024
static
const int omicron::Event::MaxExtraDataItems = 32
static

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