Clara-Doc - Programmer Reference

Module: CTQUE

Methods

MethodDescription
CTQUE_ClearClears the queue of all its items.
CTQUE_ConstructorCreates a queue (an instance of type CTQUE).
CTQUE_CountReturns the nimber of items in the queue.
CTQUE_DestructorReleases the queue and its resources.
CTQUE_GetReturns the next available queue item in first-in-first-out fashion.
CTQUE_GetMaxReturns the maximum number of items that can be inserted in the queue.
CTQUE_ItemSizeReturns the size of the next available item in the queue.
CTQUE_IterNextReturns the value of the next available item in the queue within an iteration loop; the item is not removed from the queue.
CTQUE_IterNextSizeReturns the size of the next item to be retrieved within an iteration loop.
CTQUE_IterStartStarts an iteration loop.
CTQUE_PutInserts an item in the queue.
CTQUE_SetMaxSets the maximum number of items in the queue.



Description

Creating and disposing of CTQUE instances
Before using a CTQUE, a CTQUE instance has to be created (constructed). This is done by calling the CTQUE_Constructor method. A pointer to a CTQUE instance will be returned to the caller. This pointer will be used in calls to other CTQUE methods. Every time CTQUE_Constructor is called, a new CTQUE instance is created and accessible through the pointer that is returned. This allows for several CTQUE instances within the same porgram. Be sure to pass the appropriate pointer when calling CTQUE methods. Once a CTQUE instance is no longer needed, its resources have to be reclaimed via a call the the CTQUE_Destructor method (you must pass the pointer to the CTQUE instance that will be garbage collected). Call the CTQUE_Constructor method on every CTQUE instance once they are no longer needed. In between calls to the constructor and the destructor for a given CTQUE instance, you may call any CTQUE method on that CTQUE instance.
                                       
 /INCLUDE QINCSRC,CTBASE               
                                       
DRc               S             10I 0  
DpQueue           S               *    
                                       
 /Free                                 
                                       
    pQueue = CTQUE_Constructor();      
                     
                     
    // Use CTQUE instance via methods by using the pQueue pointer                                   
    //
    // ...
    
    
    // We are done and need to gargabe collect CTQUE resources
    
    CTQUE_Destructor(pQueue);          
                                       
    *InLR = *On;                       
    Return;                            
                                       
 /End-Free