Qore Programming Language Reference Manual 1.19.2
Loading...
Searching...
No Matches
Qore::FilePollOperation Class Reference

File poll operation object returned by File polling methods. More...

#include <QC_FilePollOperation.dox.h>

Inheritance diagram for Qore::FilePollOperation:
[legend]

Public Member Methods

 constructor (ReadOnlyFile file, string path, bool to_string, int num_bytes=-1)
 Creates the object with the given goal. More...
 
*hash< SocketPollInfocontinuePoll ()
 Returns a socket poll hash if polling should continue or NOTHING if complete. More...
 
 copy ()
 Throws an exception; objects of this class cannot be copied. More...
 
 destructor ()
 Destroys the object. More...
 
- Public Member Methods inherited from Qore::SocketPollOperationBase
 constructor ()
 Throws an exception; this class is not usable by Qore classes. More...
 
 destructor ()
 Destroys the object.
 
string getGoal ()
 Returns the goal. More...
 
auto getOutput ()
 Returns any output generated by any completed poll action. More...
 
string getState ()
 Returns the current state. More...
 
bool goalReached ()
 Returns True when the goal as been reached. More...
 
- Public Member Methods inherited from Qore::AbstractPollOperation
abstract *hash< SocketPollInfocontinuePoll ()
 Returns a socket poll hash if polling should continue or NOTHING if complete. More...
 
abstract string getGoal ()
 Returns the goal. More...
 
auto getOutput ()
 Returns any output generated by any completed poll action. More...
 
abstract string getState ()
 Returns the current state. More...
 
abstract bool goalReached ()
 Returns True when the goal as been reached. More...
 

Detailed Description

File poll operation object returned by File polling methods.

This class implements the polling logic for Files and the state machine behind it

private members:

  • File sock: the File being polled
  • string goal: the goal of the poll operation
Since
Qore 1.19

Member Function Documentation

◆ constructor()

Qore::FilePollOperation::constructor ( ReadOnlyFile  file,
string  path,
bool  to_string,
int  num_bytes = -1 
)

Creates the object with the given goal.

Parameters
filethe File object to poll
paththe path to read
to_stringif the output should be a string or not; if so, the string's encoding will be the same as the File's encoding
num_bytesthe number of bytes to read; < 0 means read the entire file

◆ continuePoll()

*hash< SocketPollInfo > Qore::FilePollOperation::continuePoll ( )
virtual

Returns a socket poll hash if polling should continue or NOTHING if complete.

Returns
NOTHING if there is no more to poll and the poll operation was successful (i.e. the goal was reached), otherwise this method must return a new socket poll hash to continue the polling operation with another operation, after which this method will be called again if a matching event is received for the socket. If a socket poll hash is returned, then the internal state is also updated.

Implements Qore::AbstractPollOperation.

◆ copy()

Qore::FilePollOperation::copy ( )

Throws an exception; objects of this class cannot be copied.

Exceptions
FILEPOLLOPERATION-COPY-ERRORobjects of this class cannot be copied

◆ destructor()

Qore::FilePollOperation::destructor ( )

Destroys the object.

Destroys the object