IGLib
1.7.2
The IGLib base library for development of numerical, technical and business applications.
|
Base class for client and server classes with stream-based communication. More...
Public Member Functions | |
delegate string | ResponseDelegate (string request) |
Provides an answer string to the specified request string. More... | |
void | SetMessagePreix (string messagePrefix) |
Changes message prefix for the current object. More... | |
void | messageSeparator (char messageSeparator) |
Changes message separator for the current object. More... | |
void | SetMessageFalseSeparator (char messageFalseSeparator) |
Changes message false separator for the current object. More... | |
string | CreateMessage (string messageName, string[] messageArguments) |
Creates a built-in message (possibly with arguments) that is to be interpreted directly by the receiver (stream client or server) and is not executed via ordinary path. More... | |
string | CreateResponseOrRequestString (string originalResponseOrRequestString, bool multiLine) |
Generates request and response string in such a way that it can not be mixed up with a message. More... | |
void | InterpretRequestOrResponseLine (ref string responseOrRequestString, out bool isMessage, out string messageOrCommandName, out string[] messageArguments) |
Returns the (eventually decoded) request or response string corresponding to the stirng that is read form the communication pipeline, and also parameters that specify whether the request string represents a message or not. Eventual command or message parameters are also returned. More... | |
void | WriteMessage (StreamWriter outputStream, string message, string[] args) |
Writes a mesage to the output stream. What is written is decorated message (including the standard message prefix and separator) and message arguments. More... | |
virtual void | WorkMessage (string messageName, string[] messageArguments, IpcStage context, ref bool worked) |
virtual void | RespondToMessage (string messageName, string[] messageArguments, ref bool responded) |
Responds to a received message. More... | |
Public Attributes | |
const int | MinimalMessagePreffixLength = 3 |
Protected Attributes | |
object | _lock = new object() |
Properties | |
object | Lock [get] |
Objectt for locking the current object. More... | |
static object | LockGlobal [get] |
Static lock object used by all instances of this class (and possibly by other classes). More... | |
StringBuilder | StringBuilderInternal [get] |
static int | DefaultOutputLevel [get, set] |
Default level of output for this kind of class. More... | |
virtual int | OutputLevel [get, set] |
Level of output generated by operatins. More... | |
static string | DefaultMessagePrefix [get, set] |
static char | DefaultMessageSeparator [get, set] |
static char | DefaultMessageFalseSeparator [get, set] |
string | MessagePrefix [get, protected set] |
char | MessageSeparator [get, protected set] |
char | MessageFalseSeparator [get, protected set] |
string | MessagePrefixWithSeparator [get, protected set] |
Gets the mesage prefix with separator. If some string is a message, everything that follows this string until the first separator is a message name. More... | |
static string | DefaultMsgRequestBegin [get] |
Default message that begins any mulltiline request. More... | |
static string | DefaultMsgRequestEnd [get] |
Default message that ends any mulltiline request. More... | |
static string | DefaultMsgResponseBegin [get] |
Default message that begins any multiline response. More... | |
static string | DefaultMsgResponseEnd [get] |
Default message that ends any multiline response. More... | |
static string | DefaultMsgTestSquare [get] |
Default message that requests a test computation of square to be performed on the other side (a sort of ping command). More... | |
static string | DefaultMsgTestSpeed [get] |
Default message that requests a speed test to be performed on the other side (a sort of ping command). More... | |
string | MsgRequestBegin [get, protected set] |
string | MsgRequestEnd [get, protected set] |
string | MsgResponseBegin [get, protected set] |
Message that begins any multiline response (only when multiline responses are allowed). More... | |
string | MsgResponseEnd [get, protected set] |
Message that ends any multiline response (only when multiline responses are allowed). More... | |
string | MsgTestSquare [get, protected set] |
Message that requests square of its argument to be sent back. Used as a kind of verifiable ping. More... | |
string | MsgTestSpeed [get, protected set] |
Message that requires a kind of speed test to be performed on the other side. More... | |
static string | DefaultStopRequest [get, set] |
Default stop request string - request string that will stop the server. More... | |
string | StopRequest [get, set] |
Request that causes the server stop listening and closing the pipe. More... | |
static string | DefaultGenericResponse [get, set] |
Default generic response (sent in absence of any other method to generate the response). More... | |
string | GenericResponse [get, protected set] |
Generic response that is sent back to the client in abscence of any method generating responses to specific requests. More... | |
static string | DefaultStoppedResponse [get, set] |
Default stopped response (sent after the srver has sttopped on request). More... | |
string | StoppedResponse [get, protected set] |
Stopped response that is sent back to the client after the server stops on its request. More... | |
static bool | DefaultIsMultilineResponse [get] |
Default pipe name. More... | |
static bool | DefaultIsMultilineRequest [get] |
Default pipe name. More... | |
virtual bool | IsMultilineRequest [get, protected set] |
Whether or not multi line requests are allowed. More... | |
virtual bool | IsMultilineResponse [get, protected set] |
Whether or not multi line responses are allowed. More... | |
Properties inherited from IG.Lib.ILockable | |
object | Lock [get] |
Static Private Attributes | |
static object | _lockGlobal = null |
static int | _defatultOutputLevel = 1 |
static string | _defaultMessagePrefix = "IGLibMsg" |
static char | _defaultMessageSeparator = '_' |
static char | _defaultMessageFalseSeparator = '.' |
static string | _defaultMsgRequestBegin = "RequestBegin" |
static string | _defaultMsgRequestEnd = "RequestEnd" |
static string | _defaultMsgResponseBegin = "ResponseBegin" |
static string | _defaultMsgResponseEnd = "ResponseEnd" |
static string | _defaultMsgTestSquare = "TestStuare" |
static string | _defaultMsgTestSpeed = "TestSpeed" |
static string | _defaultStopRequest = "stop" |
static string | _defaultGenericResponse = "IGLib_PipeServer_GenericResponse" |
static string | _defaultStoppedResponse = "IGLib_PipeServer_StoppedResponse" |
static bool | _defaultIsMultilineResponse = true |
static bool | _defaultIsMultilineRequest = true |
Base class for client and server classes with stream-based communication.
$A Igor xx Aug14;
delegate string IG.Lib.IpcStreamClientServerBase.ResponseDelegate | ( | string | request | ) |
Provides an answer string to the specified request string.
request | Request string. |
|
inline |
Changes message prefix for the current object.
This setter method is provided in order to keep the MessagePrefix setter protected.
messagePrefix | New message prefix. Must be at least MinimalMessagePreffixLength characters long. |
|
inline |
Changes message separator for the current object.
This setter method is provided in order to keep the MessageSeparator setter protected.
messageSeparator | New message separator must not be a separator or a white space character. |
|
inline |
Changes message false separator for the current object.
This setter method is provided in order to keep the MessageFalseSeparator setter protected.
messageFalseSeparator | New message false separator must not be a separator or a white space character. |
|
inline |
Creates a built-in message (possibly with arguments) that is to be interpreted directly by the receiver (stream client or server) and is not executed via ordinary path.
Messages commands are composed of message prefix, separator (jointly MessagePrefixWithSeparator), and message name. The first two are fixed parts whire the latter varies and defines the message.
messageName | Name of the message (a kind of command name). |
messageArguments | Optional arguments of the message. |
|
inline |
Generates request and response string in such a way that it can not be mixed up with a message.
If the original string begins with the message prefix theen a false separator is inserted after the part that is the same as message prefix. In this way the string can be distinguished form a message and can be correctly decoded on the other side of the communication pipeline (simply by removng the false separator).
originalResponseOrRequestString | Original response string that is sent to the other side. |
multiLine | Specifies whether request or response, respectively, can be a multiline string. |
|
inline |
Returns the (eventually decoded) request or response string corresponding to the stirng that is read form the communication pipeline, and also parameters that specify whether the request string represents a message or not. Eventual command or message parameters are also returned.
responseOrRequestString | Original response or request string that is to be decoded. |
isMessage | Output flag telling whether the string is a message or not. |
messageOrCommandName | Name of the message or command extracted from the string. |
messageArguments | Message or command arguments. |
|
inline |
Writes a mesage to the output stream. What is written is decorated message (including the standard message prefix and separator) and message arguments.
outputStream | Stream where the message is written to. |
message | Message name. The name is decorated with prefix and separator when message is written to a stream. |
args | Arguments of the message. Can be null for message without arguments. |
|
inlinevirtual |
|
inlinevirtual |
Responds to a received message.
messageName | Name of the message upon which action is taken. |
messageArguments | Arguments of the message. |
responded | Set to true if message has already been responded. |
|
protected |
|
staticprivate |
|
private |
|
staticprivate |
|
private |
const int IG.Lib.IpcStreamClientServerBase.MinimalMessagePreffixLength = 3 |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
private |
Message that begins any multiline request (only when multiline requests are allowed).
|
private |
Message that ends any multiline request (only when multiline requests are allowed).
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
|
private |
|
staticprivate |
|
private |
|
staticprivate |
|
private |
|
staticprivate |
|
staticprivate |
|
private |
|
private |
|
get |
Objectt for locking the current object.
|
staticget |
Static lock object used by all instances of this class (and possibly by other classes).
|
getprotected |
|
staticgetset |
Default level of output for this kind of class.
|
getset |
Level of output generated by operatins.
Referenced by IG.Lib.CommandLineApplicationInterpreter.CreatePipeClient(), and IG.Lib.CommandLineApplicationInterpreter.CreatePipeServer().
|
staticgetset |
|
staticgetset |
|
staticgetset |
|
getprotected set |
|
getprotected set |
|
getprotected set |
|
getprotected set |
Gets the mesage prefix with separator. If some string is a message, everything that follows this string until the first separator is a message name.
A protected getter is defined that is only allowed to set the property to null (invalidate it). If a non-null value is set then an exception is thrown.
|
staticget |
Default message that begins any mulltiline request.
|
staticget |
Default message that ends any mulltiline request.
|
staticget |
Default message that begins any multiline response.
|
staticget |
Default message that ends any multiline response.
|
staticget |
Default message that requests a test computation of square to be performed on the other side (a sort of ping command).
|
staticget |
Default message that requests a speed test to be performed on the other side (a sort of ping command).
|
getprotected set |
|
getprotected set |
|
getprotected set |
Message that begins any multiline response (only when multiline responses are allowed).
|
getprotected set |
Message that ends any multiline response (only when multiline responses are allowed).
|
getprotected set |
Message that requests square of its argument to be sent back. Used as a kind of verifiable ping.
|
getprotected set |
Message that requires a kind of speed test to be performed on the other side.
|
staticgetset |
Default stop request string - request string that will stop the server.
|
getset |
Request that causes the server stop listening and closing the pipe.
|
staticgetset |
Default generic response (sent in absence of any other method to generate the response).
|
getprotected set |
Generic response that is sent back to the client in abscence of any method generating responses to specific requests.
|
staticgetset |
Default stopped response (sent after the srver has sttopped on request).
|
getprotected set |
Stopped response that is sent back to the client after the server stops on its request.
|
staticget |
Default pipe name.
|
staticget |
Default pipe name.
|
getprotected set |
Whether or not multi line requests are allowed.
|
getprotected set |
Whether or not multi line responses are allowed.