North State Framework in C#  V3.0.0
An object-oriented framework for implementing UML state machines.
Public Member Functions | Properties | List of all members
NSFEvent Class Reference

Represents an event which can trigger a transition or be handled by an event handler. More...

Inheritance diagram for NSFEvent:
NSFTimerAction INSFIdObject INSFNamedObject NSFDataEvent< DataType >

Public Member Functions

 NSFEvent (NSFString name, INSFEventHandler parent)
 Creates an event. More...
 
 NSFEvent (NSFString name, INSFNamedObject source, INSFEventHandler destination)
 Creates an event. More...
 
 NSFEvent (NSFEvent nsfEvent)
 Creates an event. More...
 
virtual NSFEvent copy ()
 Creates a deep copy. More...
 
NSFEvent copy (NSFString name)
 Creates a deep copy. More...
 
NSFEvent copy (INSFNamedObject source, INSFEventHandler destination)
 Creates a deep copy, replacing the specified parameters. More...
 
NSFEvent copy (NSFString name, INSFNamedObject source, INSFEventHandler destination)
 Creates a deep copy, replacing the specified parameters. More...
 
void queueEvent ()
 Queues the event to its destination. More...
 
void queueEvent (NSFStateMachineContext context)
 Queues the event to its destination. More...
 
void schedule (INSFNamedObject source, INSFEventHandler destination, NSFTime delayTime, NSFTime repeatTime)
 Schedules the event to execute. More...
 
void setRouting (INSFNamedObject source, INSFEventHandler destination)
 Sets the source and destination of the event. More...
 
- Public Member Functions inherited from NSFTimerAction
bool isScheduled ()
 Checks if the action is already scheduled. More...
 
void schedule ()
 Schedules the action to execute at the previously designated delay and repeat times. More...
 
void schedule (NSFTime delayTime)
 Schedules the action to execute after the specified delay time with zero repeat time. More...
 
void schedule (NSFTime delayTime, NSFTime repeatTime)
 Schedules the action to execute at the specified times. More...
 
void scheduleAbsoluteExecution ()
 Schedules the action to execute at its designated execution time. More...
 
void scheduleAbsoluteExecution (NSFTime executionTime)
 Schedules the action to execute at the specified execution time. More...
 
void scheduleAbsoluteExecution (NSFTime executionTime, NSFTime repeatTime)
 Schedules the action to execute at the specified execution time. More...
 
void unschedule ()
 Unschedules the action. More...
 

Properties

INSFEventHandler Destination [get, set]
 Gets or sets the event destination. More...
 
NSFId Id [get, set]
 Gets or sets the event id. More...
 
INSFNamedObject Source [get, set]
 Gets or sets the event source. More...
 
- Properties inherited from NSFTimerAction
NSFTime DelayTime [get, set]
 Gets or sets the delay time of the action. More...
 
NSFTime ExecutionTime [get, set]
 Gets or sets the execution time of the action. More...
 
NSFString Name [get, set]
 Gets or sets the name of the action. More...
 
NSFTime RepeatTime [get, set]
 Gets or sets the repeat time for periodic actions, 0 if non-periodic. More...
 
- Properties inherited from INSFNamedObject
NSFString Name [get]
 Gets the name of the object. More...
 
- Properties inherited from INSFIdObject
NSFId Id [get]
 Gets or sets the id number of the object. More...
 

Additional Inherited Members

- Protected Member Functions inherited from NSFTimerAction
 NSFTimerAction (NSFString name)
 Creates a timer action. More...
 

Detailed Description

Represents an event which can trigger a transition or be handled by an event handler.

Constructor & Destructor Documentation

NSFEvent ( NSFString  name,
INSFEventHandler  parent 
)

Creates an event.

Parameters
nameThe name of the event.
parentThe parent of the event.

The event source and destination will be set to the parent.

NSFEvent ( NSFString  name,
INSFNamedObject  source,
INSFEventHandler  destination 
)

Creates an event.

Parameters
nameThe name of the event.
sourceThe source of the event.
destinationThe destination of the event.
NSFEvent ( NSFEvent  nsfEvent)

Creates an event.

Parameters
nsfEventThe event to copy.

Member Function Documentation

virtual NSFEvent copy ( )
virtual

Creates a deep copy.

Returns
A copy of the event.

A common design pattern is to queue data event copies, each with its own unique data payload, to state machines for handling.

Reimplemented in NSFDataEvent< DataType >.

NSFEvent copy ( NSFString  name)

Creates a deep copy.

Parameters
nameThe new name for the copy.
Returns
A copy of the event.

A common design pattern is to queue data event copies, each with its own unique data payload, to state machines for handling.

NSFEvent copy ( INSFNamedObject  source,
INSFEventHandler  destination 
)

Creates a deep copy, replacing the specified parameters.

Parameters
sourceThe new source for the copy.
destinationThe new destination for the copy.
Returns
A copy of the event.

A common design pattern is to queue data event copies, each with its own unique data payload, to state machines for handling.

NSFEvent copy ( NSFString  name,
INSFNamedObject  source,
INSFEventHandler  destination 
)

Creates a deep copy, replacing the specified parameters.

Parameters
nameThe new name for the copy.
sourceThe new source for the copy.
destinationThe new destination for the copy.
Returns
A copy of the event.

A common design pattern is to queue data event copies, each with its own unique data payload, to state machines for handling.

void queueEvent ( )

Queues the event to its destination.

void queueEvent ( NSFStateMachineContext  context)

Queues the event to its destination.

This method is provided to allow event queuing to be registered as an entry, exit, or transition action. The event source will be changed to the context source for logging purposes during execution of this method. This method is not thread safe from a logging perspective, so that two threads calling this method on the same event can result in indeterminate logging of the source.

void schedule ( INSFNamedObject  source,
INSFEventHandler  destination,
NSFTime  delayTime,
NSFTime  repeatTime 
)

Schedules the event to execute.

Parameters
sourceSource of the event.
destinationDestination of the event.
delayTimeDelay time before executing the event.
repeatTimeRepeat time, if desired. Zero if one-shot.
void setRouting ( INSFNamedObject  source,
INSFEventHandler  destination 
)

Sets the source and destination of the event.

Parameters
sourceSource of the event.
destinationDestination of the event.

Property Documentation

INSFEventHandler Destination
getset

Gets or sets the event destination.

NSFId Id
getset

Gets or sets the event id.

Transitions use the event id to match the trigger event. In other words, mulitple event objects with the same id can trigger a transition. Use the copy() method to create a new event object with the same id as an existing object.

INSFNamedObject Source
getset

Gets or sets the event source.




Copyright 2004-2014, North State Software, LLC. All rights reserved.