- Todd Rundgren
PrimitiveRefQueue<>
IPrimitiveRefQueue<>
PrimitiveRefQueue<> Methods
PrimitiveRefQueue() | Constructor for the PrimitiveRefQueue<> class |
Size() | Returns number of items in the queue |
AddItem() | Adds an item to the end of the list (FIFO) or start of the list (LIFO) and trigger a receive event |
AddExpressItem() | Inserts an item at the beginning of the queue and trigger a receive event |
GetItem() | Gets next item from the queue and removes it |
PeekItem() | Gets next item from the queue without removing it |
PeekItem() | Gets item from the queue at specified one based position without removing it |
GotoTop() | Moves internal "pointer" to top of list |
GotoBottom() | Moves internal "pointer" to bottom of list |
GetCurrentItem() | Gets "current" object in collection and move pointer position |
IsCurrentValid() | Returns true if the "pointer" currently points at a valid position |
Clear() | Clears all items from the queue |
QueueType() | Returns the queue type as QueueType.LIFO or QueueType.FIFO |
AddQueueReceiveHandler() | Adds event handler for a "receive" event (AddItem(), AddExpressItem()) using a method reference |
AddQueueReceiveHandler() | Adds event handler for a "receive" event (AddItem(), AddExpressItem()) using an IQueue reference |
OnQueueReceive() | Event handler for PrimitiveRefQueueEvent<> processing |
IPrimitiveRefQueue Methods
OnQueueReceive() | Virtual method to handle PrimitiveRefQueueEvent<> processing |
Derived Classes
None
See Also
Class Hierarchy, PrimitiveRefQueueEvent<>, Queue<>, PrimitiveQueue<>, ObjectQueue
public method PrimitiveRefQueue(int Mode = QueueType.FIFO, bool ProcessEvents = false)
Parameters
Mode
Queue type enumeration value (FIFO or LIFO)
ProcessEvents
Add event handling if true
Return Value
None
Description
Constructor for the PrimitiveRefQueue<> class. The queue mode is specified using one of the two QueueType enumeration values (FIFO - First In First Out, LIFO - Last In First Out) and the "process events" flag can also be specified. If true, the system sets up the default handler for queue receive events (OnQueueReceive()). If false, the event handling is not turned on.
PrimitiveRefQueue<> Class
public virtual method<int> Size()
Parameters
None
Return Value
Returns size of queue
Description
This method returns the total number of primitive object references currently stored in the queue.
PrimitiveRefQueue<> Class
public method AddItem(T ref ObjectReference)
Parameters
ObjectReference
Primitive object reference to be added to queue
Return Value
None
Description
This method adds the specified primitive object reference to the queue. If it's a FIFO queue, the object is added to the end of the queue. If LIFO, it's added to the beginning of the queue. The storage for the queue is handled internally, and automatically grows the queue if necessary. The user of the class doesn't need to worry about any of the details.
This method will result in a PrimitiveRefQueueEvent<> if the queue was created with event processing turned on.
PrimitiveRefQueue<> Class
public method AddExpressItem(T ref ObjectReference)
Parameters
ObjectReference
Primitive object reference to be added to queue
Return Value
None
Description
This method adds the specified primitive object reference to the queue. Regardless of queue type, this item is placed at the beginning of the queue so that the next "GetItem()" call will return this object reference.
This method will result in a PrimitiveRefQueueEvent<> if the queue was created with event processing turned on.
PrimitiveRefQueue<> Class
public method<T ref> GetItem()
Parameters
None
Return Value
Primitive object reference in first position
Description
This method returns the next primitive object reference in the queue and removes the item from the queue. If the queue is empty, it returns null.
PrimitiveRefQueue<> Class
public method<T ref> PeekItem()
Parameters
None
Return Value
Primitive object reference in first position
Description
This method returns the next primitive object reference in the queue and does NOT remove the item from the queue. If the queue is empty, it returns null.
PrimitiveRefQueue<> Class
public method<T ref> PeekItem(int Position)
Parameters
Position
One based position
Return Value
Primitive object reference at specified position
Description
This method returns the primitive object reference at the specified one based position in the queue. If the position is not valid (less than one or greater than the current size of the queue), or if the queue is empty, it returns null.
PrimitiveRefQueue<> Class
public virtual method GotoTop()
Parameters
None
Return Value
None
Description
This method moves the internal "pointer" to the top of the list. This will always point at the queue position that corresponds to that position which would be returned using the next GetItem() method call. For FIFO, it will be the first item entered. For LIFO, it will be the last item entered.
The "GetCurrentItem()" method returns the object which is at the current pointer location.
PrimitiveRefQueue<> Class
public virtual method GotoBottom()
Parameters
None
Return Value
None
Description
This method moves the internal "pointer" to the bottom of the list. This will always point at the queue position that is at the opposite end of the queue from the position which would be returned using the next GetItem() method call. For FIFO, it will be the last item entered. For LIFO, it will be the first item entered.
The "GetCurrentItem()" method returns the object which is at the current pointer location.
PrimitiveRefQueue<> Class
public virtual method<T ref> GetCurrentItem(bool Forward = true)
Parameters
None
Return Value
Reference to current item
Description
This method returns a reference to the primitive object reference at the current "pointer" location within the list.
If the Forward flag is true, the current pointer location is then advanced to the next object in the list. If currently at the last position, the pointer is advanced to a "null" position.
If the forward flag is false, the current pointer is moved to the previous object in the list. If currently at the first position, the pointer is advanced to the "null" position.
If the pointer ends up at the "null" position, the next "GetCurrentItem()" call will return null. The "GotoTop()" or "GotoBottom()" method must be used to reset the pointer to a valid position.
If the collection is empty, this method returns null.
PrimitiveRefQueue<> Class
public virtual method<bool> IsCurrentValid()
Parameters
None
Return Value
True if current position is valid
Description
Virtual method to return true if the "current" pointer within the queue points at a valid position, and returns false if not. If the queue is empty, or if the end of the queue has been surpassed by making a "GetCurrentItem()" call at the end of the queue, the current "pointer" does not point at a valid position (and GetCurrentItem() returns null), so this method returns false.
PrimitiveRefQueue<> Class
public virtual method Clear()
Parameters
None
Return Value
None
Description
This method clears all items from the queue.
PrimitiveRefQueue<> Class
public method<QueueType> QueueType()
Parameters
None
Return Value
QueueType.LIFO or QueueType.FIFO
Description
This method returns the queue type enumeration value (FIFO or LIFO). This setting specifies how the data is retrieved from the queue.
PrimitiveRefQueue<> Class
public method AddQueueReceiveHandler(PrimitiveRefQueueHandler<T> Handler, Base ExtraObject = null)
Parameters
Handler
Method reference to be executed when the event occurs
ExtraObject
Optional object which will be sent along to each event handler when it is executed
Return Value
NONE
Description
This method registers a method reference to be executed when an item is added to the queue (if "process events" is turned on for the queue). The 'AddItem()' and 'AddExpressItem()' methods both issue this event. An optional object can also be registered which will be sent to each event handler as it is executed.
As is true with all Aztec event handling, this method can be called by any thread. When the event occurs, each registered event handler is scheduled to execute within the thread that registered it. So an item added to queue in one thread can be handled by event handlers executing in one or more other threads.
The PrimitiveRefQueueHandler<T> data type represents a method reference specific to a handler for PrimitiveRefQueueEvent<T>. PrimitiveRefQueueHandler<T> is defined as follows:
public type<method<PrimitiveRefQeueEvent<T>,Base>> PrimitiveRefQueueHandler<T>
Given this definition, the method handler must be defined with the following signature (name can be anything):
public method QueueReceiveMethod(PrimitiveRefQueueEvent<T> event, Base Extra) { }.
PrimitiveRefQueue<> Class
public method AddQueueReceiveHandler(IPrimitiveRefQueue<T> Interface, Base ExtraObject = null)
Parameters
Interface
Reference to an IPrimitiveRefQueue<> object
ExtraObject
Optional object which will be sent along to each event handler when it is executed
Return Value
NONE
Description
This method registers an IPrimitiveRefQueue<> interface object to be executed when an item is added to the queue (if "process events" is turned on for the queue). The 'AddItem()' and 'AddExpressItem()' methods both issue this event. An optional object can also be registered which will be sent to each event handler as it is executed.
As is true with all Aztec event handling, this method can be called by any thread. When the event occurs, each registered event handler is scheduled to execute within the thread that registered it. So an item added to queue in one thread can be handled by event handlers executing in one or more other threads.
When an item is added to the queue, the OnQueueReceive() method within the IPrimitiveRefQueue<> object will be executed.
PrimitiveRefQueue<> Class
public method virtual OnQueueReceive(PrimitiveRefQueueEvent<T> QueueEvent, Base ExtraObject)
Parameters
QueueEvent
PrimitiveRefQueueEvent<> object associated with the event
ExtraObject
Optional object sent along from when it was registered
Return Value
NONE
Description
This method is the default event handler for PrimitiveRefQueueEvent<> within the thread. It is invoked internally as a result of an item being added to the thread (if the PrimitiveRefQueue<> was created with the "process events" flag turned on). The 'AddItem()' and 'AddExpressItem()' methods both issue this event.
This method in turn executes every registered handler with the same argument list which comes in. Both implementations of the PrimitiveRefQueue<T>.AddQueueReceiveHandler() method register the event handlers which get invoked by this method.
If this method is overridden by a class derived from PrimitiveRefQueue<T>, it must call this implementation of the method if it needs to execute handlers registered with the PrimitiveRefQueue<T>.AddQueueReceiveHandler() methods.
PrimitiveRefQueue<> Class
public method virtual OnQueueReceive(PrimitiveRefQueueEvent<T> QueueEvent, Base ExtraObject)
Parameters
QueueEvent
PrimitiveRefQueueEvent<> object associated with the event
ExtraObject
Optional object sent along from when it was registered
Return Value
NONE
Description
This virtual method is the event handler for PrimitiveRefQueueEvent<> within the IPrimitiveRefQueue<> interface class. The method which overrides it is invoked when an item is added to the queue and the interface object is registered with the IPrimitiveRefQueue<>.AddQueueReceiveHandler() method.
IPrimitiveRefQueue<> Class