Libraries
Poll Source Code
 previous   up   next 

Types
pollData
Type to manage sockets and corresponding event checks and findings.

pollData

const type: pollData

Type to manage sockets and corresponding event checks and findings. PollData maintains input (checkedEvents) and output (eventFindings) of the function poll. PollData contains a set of sockets. For every socket the checkedEvents and the eventFindings are maintained. The checkedEvents determine, which events (POLLIN, POLLOUT, or POLLINOUT) should be checked by poll. Poll determines the events found and stores them as eventFindings. PollData provides also an iterator, which can be used to iterate over checkedEvents and eventFindings.


Function Summary
void
clear (inout pollData: pData)
Clears pData.
void
addCheck (inout pollData: pData, in PRIMITIVE_SOCKET: aSocket, in integer: eventsToCheck, in file: aFile)
Add eventsToCheck for aSocket to pData.
void
addCheck (inout pollData: pData, in file: aFile, in integer: eventsToCheck)
Add eventsToCheck for aFile to pData.
void
removeCheck (inout pollData: pData, in PRIMITIVE_SOCKET: aSocket, in integer: eventsToCheck)
Remove eventsToCheck for aSocket from pData.
void
removeCheck (inout pollData: pData, in file: aFile, in integer: eventsToCheck)
Remove eventsToCheck for aFile from pData.
integer
getCheck (inout pollData: pData, in PRIMITIVE_SOCKET: aSocket)
Return the checkedEvents field from pData for aSocket.
integer
getCheck (inout pollData: pData, in file: aFile)
Return the checkedEvents field from pData for aFile.
void
poll (inout pollData: pData)
Waits for one or more of the checkedEvents from pData.
integer
getFinding (inout pollData: pData, in PRIMITIVE_SOCKET: aSocket)
Return the eventFindings field from pData for aSocket.
integer
getFinding (inout pollData: pData, in file: aFile)
Return the eventFindings field from pData for aFile.
void
iterChecks (in pollData: pData, in integer: pollMode)
Reset the pollData iterator to process checkedEvents.
void
iterFindings (in pollData: pData, in integer: pollMode)
Reset the pollData iterator to process eventFindings.
boolean
hasNext (inout pollData: pData)
Determine if the pData iterator can deliver another file.
file
nextFile (inout pollData: pData)
Get the next file from the pData iterator.
void
for (inout file: forVar) range (inout pollData: pData) do (in proc: statements) end for
For-loop to loop over the values of the pData iterator.

Function Detail

clear

const proc: clear (inout pollData: pData)

Clears pData. All sockets and all events are removed from pData and the iterator is reset, such that hasNext returns FALSE.


addCheck

const proc: addCheck (inout pollData: pData, in PRIMITIVE_SOCKET: aSocket, in integer: eventsToCheck, in file: aFile)

Add eventsToCheck for aSocket to pData. EventsToCheck can have one of the following values:

  • POLLIN check if data can be read from the corresponding socket.
  • POLLOUT check if data can be written to the corresponding socket.
  • POLLINOUT check if data can be read or written (POLLIN or POLLOUT).
Parameters:
pollData - Poll data to which the event checks are added.
aSocket - Socket for which the events should be checked.
eventsToCheck - Events to be added to the checkedEvents field of pData.
fileObj - File to be returned, if the iterator returns files in pData.
Raises:
RANGE_ERROR - Illegal value for eventsToCheck.
MEMORY_ERROR - An out of memory situation occurred.
FILE_ERROR - A limit of the operating system was reached.

addCheck

const proc: addCheck (inout pollData: pData, in file: aFile, in integer: eventsToCheck)

Add eventsToCheck for aFile to pData. EventsToCheck can have one of the following values:

  • POLLIN check if data can be read from the corresponding socket.
  • POLLOUT check if data can be written to the corresponding socket.
  • POLLINOUT check if data can be read or written (POLLIN or POLLOUT).
Parameters:
pollData - Poll data to which the event checks are added.
aFile - File for which the events should be checked.
eventsToCheck - Events to be added to the checkedEvents field of pData.
Raises:
RANGE_ERROR - Illegal value for eventsToCheck.
MEMORY_ERROR - An out of memory situation occurred.
FILE_ERROR - A limit of the operating system was reached.

removeCheck

const proc: removeCheck (inout pollData: pData, in PRIMITIVE_SOCKET: aSocket, in integer: eventsToCheck)

Remove eventsToCheck for aSocket from pData. EventsToCheck can have one of the following values:

  • POLLIN check if data can be read from the corresponding socket.
  • POLLOUT check if data can be written to the corresponding socket.
  • POLLINOUT check if data can be read or written (POLLIN or POLLOUT).
Parameters:
pollData - Poll data from which the event checks are removed.
aSocket - Socket for which the events should not be checked.
eventsToCheck - Events to be removed from the checkedEvents field of pData.
Raises:
RANGE_ERROR - Illegal value for eventsToCheck.

removeCheck

const proc: removeCheck (inout pollData: pData, in file: aFile, in integer: eventsToCheck)

Remove eventsToCheck for aFile from pData. EventsToCheck can have one of the following values:

  • POLLIN check if data can be read from the corresponding socket.
  • POLLOUT check if data can be written to the corresponding socket.
  • POLLINOUT check if data can be read or written (POLLIN or POLLOUT).
Parameters:
pollData - Poll data from which the event checks are removed.
aFile - File for which the events should not be checked.
eventsToCheck - Events to be removed from the checkedEvents field of pData.
Raises:
RANGE_ERROR - Illegal value for eventsToCheck.

getCheck

const func integer: getCheck (inout pollData: pData, in PRIMITIVE_SOCKET: aSocket)

Return the checkedEvents field from pData for aSocket. The poll function uses the checkedEvents as input. The following checkedEvents can be returned:

  • POLLNOTHING no data can be read or written.
  • POLLIN data can be read from the corresponding socket.
  • POLLOUT data can be written to the corresponding socket.
  • POLLINOUT data can be read and written (POLLIN and POLLOUT).
Returns:
POLLNOTHING, POLLIN, POLLOUT or POLLINOUT, depending on the events added and removed for aSocket' with addCheck and removeCheck''.

getCheck

const func integer: getCheck (inout pollData: pData, in file: aFile)

Return the checkedEvents field from pData for aFile. The poll function uses the checkedEvents as input. The following checkedEvents can be returned:

  • POLLNOTHING no data can be read or written.
  • POLLIN data can be read from the corresponding socket.
  • POLLOUT data can be written to the corresponding socket.
  • POLLINOUT data can be read and written (POLLIN and POLLOUT).
Returns:
POLLNOTHING, POLLIN, POLLOUT or POLLINOUT, depending on the events added and removed for aFile' with addCheck and removeCheck''.

poll

const proc: poll (inout pollData: pData)

Waits for one or more of the checkedEvents from pData. Poll waits until one of the checkedEvents for a corresponding socket occurs. If a checkedEvents occurs the eventFindings field is assigned a value. The following eventFindings values are assigned:

  • POLLIN data can be read from the corresponding socket.
  • POLLOUT data can be written to the corresponding socket.
  • POLLINOUT data can be read and written (POLLIN and POLLOUT).
Raises:
FILE_ERROR - The system function returns an error.

getFinding

const func integer: getFinding (inout pollData: pData, in PRIMITIVE_SOCKET: aSocket)

Return the eventFindings field from pData for aSocket. The poll function assigns the eventFindings for aSocket to pData. The following eventFindings can be returned:

  • POLLNOTHING no data can be read or written.
  • POLLIN data can be read from the corresponding socket.
  • POLLOUT data can be written to the corresponding socket.
  • POLLINOUT data can be read and written (POLLIN and POLLOUT).
Returns:
POLLNOTHING, POLLIN, POLLOUT or POLLINOUT, depending on the findings of poll concerning aSocket.

getFinding

const func integer: getFinding (inout pollData: pData, in file: aFile)

Return the eventFindings field from pData for aFile. The poll function assigns the eventFindings for aFile to pData. The following eventFindings can be returned:

  • POLLNOTHING no data can be read or written.
  • POLLIN data can be read from the corresponding socket.
  • POLLOUT data can be written to the corresponding socket.
  • POLLINOUT data can be read and written (POLLIN and POLLOUT).
Returns:
POLLNOTHING, POLLIN, POLLOUT or POLLINOUT, depending on the findings of poll concerning aFile.

iterChecks

const proc: iterChecks (in pollData: pData, in integer: pollMode)

Reset the pollData iterator to process checkedEvents. The following calls of hasNext and nextFile refer to the checkedEvents of the given pollMode. PollMode can have one of the following values:

  • POLLNOTHING don't iterate (hasNext returns FALSE).
  • POLLIN data can be read from the corresponding socket.
  • POLLOUT data can be written to the corresponding socket.
  • POLLINOUT data can be read or written (POLLIN and POLLOUT).
Raises:
RANGE_ERROR - Illegal value for pollMode.

iterFindings

const proc: iterFindings (in pollData: pData, in integer: pollMode)

Reset the pollData iterator to process eventFindings. The following calls of hasNext and nextFile refer to the eventFindings of the given pollMode. PollMode can have one of the following values:

  • POLLNOTHING don't iterate (hasNext returns FALSE).
  • POLLIN data can be read from the corresponding socket.
  • POLLOUT data can be written to the corresponding socket.
  • POLLINOUT data can be read or written (POLLIN and POLLOUT).
Raises:
RANGE_ERROR - Illegal value for pollMode.

hasNext

const func boolean: hasNext (inout pollData: pData)

Determine if the pData iterator can deliver another file.

Returns:
TRUE if nextFile would return another file from the pData iterator, FALSE otherwise.

nextFile

const func file: nextFile (inout pollData: pData)

Get the next file from the pData iterator. Successive calls of nextFile return all files from the pData iterator. The file returned by nextFile is determined with the function addCheck. The files covered by the pData iterator are determined with iterChecks or iterFindings.

Returns:
the next file from the pData iterator, or STD_NULL, if no file from the pData iterator is available.

for

const proc: for (inout file: forVar) range (inout pollData: pData) do (in proc: statements) end for

For-loop to loop over the values of the pData iterator. The for-loop loops over the values determined by the pollMode. With iterCheck or iterFindings the pollMode of the iterator is determined.



 previous   up   next