NDEvent Class Reference

A representation of a single NetDog event. More...

List of all members.

Public Types

typedef uint32_t EventID
 Sequential ID number of event.
typedef int8_t Type
 Type of event.

Public Member Functions

NDNodeID getCreatorNodeID (void)
 Returns the NDNodeID of the node that created the event.
EventID getCreatorEventID (void)
 Returns the EventID for this event, as specified by the creator.
void routeToAll (void)
 Sets routing destination to ALL.
void routeToNode (NDNodeID nid)
 Sets routing destination to specific node.
void setReliable (bool rel)
 (Un)sets the "reliable" flag for this event.
bool getReliable (void)
 Determines whether this event's "reliable" flag has been set.
Type getEventType (void)
 Returns the event type for this event.
NDTimeValue getEventTime (void)
 Returns the time at which the event is supposed to occur.
uint32_t getDataLength (void)
 Returns the size of the event data payload.
void * getData (void)
 Returns pointer to the event data payload.
NDResult send (void)
 Sends the event.

Static Public Member Functions

static void * operator new (size_t s)
static void operator delete (void *p)

Detailed Description

A representation of a single event. The actual event "payload" is contained inside the NDEvent and must be accessed/modified using the provided accessor functions.


Member Typedef Documentation

Sequential ID number of event.

Note that these numbers are only sequential and unique for the NetDog node that generated them.

Describes the type of event. This is a user defined quantity. Each type should be identified by a unique non-negative integer.


Member Function Documentation

NDEvent::EventID NDEvent::getCreatorEventID ( void   ) 

Returns the EventID for this event, as specified by the creator.

Returns:
NDEvent::EventID
NDNodeID NDEvent::getCreatorNodeID ( void   ) 

Returns the NDNodeID of the node that created the event.

Returns:
NDNodeID of creator
void * NDEvent::getData ( void   ) 

Returns a pointer to the event data payload, the actual user-defined "guts" of the event being sent. This is completely user defined, and should not be accessed beyond than the number of bytes returned by getDataLength().

Returns:
data pointer
uint32_t NDEvent::getDataLength ( void   ) 

Returns the size of the event data payload in bytes.

Returns:
Size of payload
NDTimeValue NDEvent::getEventTime ( void   ) 

Returns the time at which the event is supposed to occur. This is relative to the NDChannel's universe time. The event may be scheduled to happen in the future, past, present, etc.

Returns:
NDTimeValue
NDEvent::Type NDEvent::getEventType ( void   ) 

Returns the event type for this event.

Returns:
NDEvent::Type
bool NDEvent::getReliable ( void   ) 

Determines whether this event's "reliable" flag has been set.

Returns:
bool
void NDEvent::routeToAll ( void   ) 

Sets routing destination to ALL.

This only makes sense for smaller network topologies. In fact, depending on the routing used, this may not actually reach ALL destinations.

Returns:
(void)
void NDEvent::routeToNode ( NDNodeID  nid  ) 

Sets routing destination to specific node.

This could be used, for example, to send a 'chat' message directly to another player node.

Parameters:
nid NDNodeID of destination node
Returns:
(void)
NDResult NDEvent::send ( void   ) 

Sends the event. This triggers NetDog to dispatch the event. Note that this does not deallocate the event, so be sure to deallocate the event when you are done with it using the "delete" operator.

Returns:
NDRES_OK on success
void NDEvent::setReliable ( bool  rel  ) 

Un(sets) the "reliable" flag for this event.

If set, the flag will result in the event being sent reliably, i.e. with guaranteed delivery.

For performance reasons, this should only be set for events that actually need to be delivered reliably.

Parameters:
rel A boolean value, true if the reliable flag should be set, false if it should be unset.
Returns:
(void)

Generated on Wed Jul 21 18:14:48 2010 for nd2 by  doxygen 1.6.1