classPiiNetworkOperation
#include <PiiNetworkOperation.h>
A base class for network input/output operations.
Inherits PiiDefaultOperation
Inherited by PiiNetworkInputOperation, PiiNetworkOutputOperation
Description
Subclasses of this class work as end points to network connections and make it possible to send/receive data to and from remote computers.
Inputs
body and content type must be left
disconnected. The operation will encode the objects as defined by
the #messageEncoding property. Use the inputNames property to change the number of inputs and
their names.
Outputs
Properties
|
The MIME type of the request/response body. |
|
|
bool
|
Control the behavior of the operation in error conditions. |
|
Input socket names. |
|
|
Output socket names. |
|
|
int
|
The maximum number of millisecond response data will be waited for. |
Constructors and destructor
Public member functions
|
virtual void
|
(
Checks the operation for execution. |
|
( )
|
|
|
bool
|
( )
|
|
virtual PiiInputSocket *
|
Finds input sockets by their alias names. |
|
( )
Returns the names of all inputs. |
|
|
virtual PiiOutputSocket *
|
Finds output sockets by their alias names. |
|
( )
Returns the names of all outputs. |
|
|
int
|
( )
|
|
void
|
|
|
void
|
(
|
|
void
|
|
|
void
|
|
|
void
|
(
|
Protected member functions
|
void
|
Read and decode an object from |
|
void
|
Add a variable to the output map. |
|
void
|
(
Add variables to the output map. |
|
bool
|
Read and decode objects from |
|
void
|
( )
Emit collected output values to named output sockets. |
Property details
-
QString contentType
[read, write]The MIME type of the request/response body.
Used only if the
bodyinput is connected. If thecontent typeinput is connected, it overrides this value. The default value istext/plain. -
bool ignoreErrors
[read, write]Control the behavior of the operation in error conditions.
If the flag is
false(the default) the operation will signal an error and stop if the network connection is lost or the server/client sends invalid data. -
QStringList inputNames
[read, write]Input socket names.
In PiiNetworkInputOperation, objects received in the named inputs will be encoded and sent back to the HTTP client as a response. In PiiNetworkOutputOperation, object received in the inputs will be encoded and sent to the server as a request.
-
QStringList outputNames
[read, write]Output socket names.
In PiiNetworkInputOperation, decoded HTTP request variables will be sent to the corresponding named outputs. In PiiNetworkOutputOperation, the variables decoded from the server's response will be sent.
-
int responseTimeout
[read, write]The maximum number of millisecond response data will be waited for.
In PiiNetworkInputOperation this is the time the operation will wait for data to appear in its loop-back input socket. If a response object is not received within time limits, the client will be sent an error message. In PiiNetworkOutputOperation, this is the time the operation will wait for a HTTP server to respond after the operation has sent a request.
The default value is 5000.
Function details
-
~PiiNetworkOperation
() -
virtual void check
(- bool reset
[virtual]Checks the operation for execution.
This function creates a suitable flow controller by calling createFlowController(). It then sets the flow controller to the active processor and sets the processor as the input controller for all inputs.
If you change socket groupings in your overridden implementation, please call PiiDefaultOperation::check() after that. Otherwise, your new groupings will not be in effect.
Reimplemented from PiiDefaultOperation.
-
QString contentType
() -
bool ignoreErrors
() -
Finds input sockets by their alias names.
Reimplemented from PiiBasicOperation.
-
QStringList inputNames
()Returns the names of all inputs.
Reimplemented from PiiOperation.
-
Finds output sockets by their alias names.
Reimplemented from PiiBasicOperation.
-
QStringList outputNames
()Returns the names of all outputs.
Reimplemented from PiiOperation.
-
int responseTimeout
() -
void setContentType
-
void setIgnoreErrors
(- bool ignoreErrors
-
void setInputNames
-
void setOutputNames
-
void setResponseTimeout
(- int responseTimeout
-
Read and decode an object from
deviceand add it to the output value map withname. -
Add a variable to the output map.
This function tries to convert
valueinto a PiiVariant. It recognizes integers, doubles and strings. -
void addToOutputMap
(- const QVariantMap & variables
[protected]Add variables to the output map.
-
Read and decode objects from
hand add them to the output value map. -
void emitOutputValues
()[protected]Emit collected output values to named output sockets.
Add a note
Not a single note added yet. Be the first, add yours.