/
gmSCDataQueueClass
gmSCDataQueueClass
Mark Juras
Owned by Mark Juras
The DataQueue Service Class
The service class DataQueue contains the core methods needed to provide a runtime data queue. The runtime data queue is a LIFO (Last In First Out) list of temporary arbitrary data items used by the runtime engine and string machine. All data stored in the queue is in raw form followed by a 2 word record which contains the length of the information in words and type code which describes the type of information stored. The base of the queue contains three values: the total size, the current top, and the current local base.The method DataQueue_ClearBotton
Prototypevoid DataQueue_ClearBottom(int isEmpty)'
Parameter | Description |
isEmpty | Specifies the desired state of the queue. If non-zero, then the queue must be positioned at the bottom; else this method empties the queue. |
This method has no return value. If the queue is supposed to be positioned at the bottom, but is not, then the message "SYSTEM ERROR#10009: Queue not at bottom mark, top=%d" is logged and control is returned to the operation system.
The method DataQueue_Close
Prototypevoid DataQueue_Close(void);
The method DataQueue_Compare
Prototypevoid DataQueue_Compare(void);
The method DataQueue_Concatenate
Prototypevoid DataQueue_Concatenate(void);
The method DataQueue_Create
Prototypevoid DataQueue_Create(int queueSize);
Parameter | Description |
queueSize | specifies the number of bytes of storage to be allocated to the new data queue storage area. |
This method itself has no return value.
The method DataQueue_GetBoolean
Prototypeint DataQueue_GetBoolean(void);
The method DataQueue_GetInteger
Prototypeint DataQueue_GetInteger(void);
The method DataQueue_GetString
Prototypeint DataQueue_GetString(char* buffer,int nBuffer);
Parameter | Description |
buffer | Receives the string value that was at the top of the queue in null-terminated form. |
nBuffer | Specifies the size of the buffer return area. It is used to prevent overflows. |
This method returns the number of characters returned in the buffer. This will never be greater than the size of the buffer minus 1. If loss of long string information is a potential problem then use a combination of DataQueue_TestTop and DataQueue_PopString to receive long strings.
The method DataQueue_PopEngine
Prototypeint* DataQueue_PopEngine(int* length,int* top);
Parameter | Description |
length | optionally returns the length of the vector, if it is not NULL. Users of this method will usually already know the length. |
top | optionally returns a pointer to the new top of the queue, if this parameter is not NULL. In some situations the user needs to examine the information at the top of the queue before deciding to remove it. In this case, this parameter is set to a non-NULL pointer. The new top returned can later be passed to the DataQueue_SetTop service when and if the actual removal is desired. |
The method returns a void* pointer to the start of the information in the queue. This pointer is valid until additional information is pushed. In particular it remains valid during subsequent pops of information.
The method DataQueue_PopInformation
Prototypeint* DataQueue_PopInformation(int* iType,int* length);
Parameter | Description |
iType | returns the type code of the information, if non-NULL. |
length | returns the length of the information, if non-NULL. |
This method returns an integer pointer to the actual start of the information vector for the requested value or a NULL if there is no information currently in the queue.
The method DataQueue_PopInteger
Prototypeint DataQueue_PopInteger(void);
The method DataQueue_PopString
Prototypechar* DataQueue_PopString(int* nString);
Parameter | Description |
nString | returns the length of the string. If nString is NULL, then no length is returned and if the string is a empty it is returned as a NULL |
The method returns a pointer to the start of the string. This may be a simple null-string,
The method DataQueue_PushEngine
Prototypeint* DataQueue_PushEngine(int* information,int length);
Parameter | Description |
information | contains the vector to be stored in the queue. There are cases where it is convenient to allocate the space for the vector and then to copy values into that space. In this case, this parameter may be NULL. |
length | Specifies the length of the information vector expressed in words. |
After this method executes the top of the queue looks as follows:
Word | Description of content |
top | REP_ENGINE |
top-1 | length |
top-- | information |
This method returns a pointer to the start of the information. This pointer is valid until this unit of information is removed from the queue. If there is not enough room to store the vector then a fatal "SYSTEM ERROR#10004: Data queue stack overflow" error occurs.
The method DataQueue_PushInteger
Prototypevoid DataQueue_PushInteger(int iValue);
Parameter | Description |
iValue | Specifies the actual integer value. |
After this method executes the top of the queue looks as follows:
Word | Description of content |
top | REP_SHORT |
top-1 | 1 |
top-2 | iValue |
This method itself has no return value.
The method DataQueue_PushString
Prototypechar* DataQueue_PushString(char* string,int nString);
Parameter | Description |
string | Contains the actual string to the stored. There are cases where it is convenient to allocate the space for the string and then to copy values into that space. In this case this parameter may be NULL. |
nString | Specifies the length of the string in characters. Great care must be taken not to change any content in the queue storage area not allocated to this string via this parameter. |
After this method executes the top of the queue looks as follows:
Word | Description of content |
top | REP_FSTRING |
top-1 | (nString / sizeof(int)) + 2 |
top-- | nstring,string,'\0' |
The method returns a pointer to the string itself within the queue.
The method DataQueue_SetBottom
Prototypeint DataQueue_SetBottom(void);
The method DataQueue_SetTop
Prototypevoid DataQueue_SetTop(int top)
Parameter | Description |
top | Specifies the new value of the top of the queue. It must be a value received from a conditional Pop method. |
This method has no return value.
The method DataQueue_TestTop
Prototypeint DataQueue_TestTop(void)
Table of Contents
, multiple selections available,
Related content
gmSCDataTableClass
gmSCDataTableClass
More like this
gmscTextClass
gmscTextClass
More like this
gmSCOfflineClass
gmSCOfflineClass
More like this
gmslDataTableClass
gmslDataTableClass
More like this
gmscTextBlockClass
gmscTextBlockClass
More like this
gmSCLongMemoryClass
gmSCLongMemoryClass
More like this