| IGLib 1.7.2 The IGLib base library for development of numerical, technical and business applications.

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Public Member Functions | Public Attributes | Protected Attributes | Properties | Private Attributes | Static Private Attributes | List of all members
IG.Lib.IpcStreamClientServerBase Class Reference

Base class for client and server classes with stream-based communication. More...

Inheritance diagram for IG.Lib.IpcStreamClientServerBase:
[legend]
Collaboration diagram for IG.Lib.IpcStreamClientServerBase:
[legend]

## 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]`

## Private Attributes
StringBuilder | _sb = new StringBuilder()
int | _otputLevel = DefaultOutputLevel
string | _messagePrefix = DefaultMessagePrefix
char | _messageSeparator = DefaultMessageSeparator
char | _messageFalseSeparator = DefaultMessageFalseSeparator
string | _messagePrefixWithSeparator = null
string | _msgRequestBegin = DefaultMsgRequestBegin
| Message that begins any multiline request (only when multiline requests are allowed). More...
string | _msgRequestEnd = DefaultMsgRequestEnd
| Message that ends any multiline request (only when multiline requests are allowed). More...
string | _msgResponseBegin = DefaultMsgResponseBegin
string | _msgResponseEnd = DefaultMsgResponseEnd
string | _msgTestSquare = DefaultMsgTestSquare
string | _msgTestSpeed = DefaultMsgTestSpeed
string | _stopRequest = DefaultStopRequest
string | _genericResponse = DefaultGenericResponse
string | _stoppedResponse = DefaultStoppedResponse
bool | _isMultilineRequest = DefaultIsMultilineRequest
bool | _isMultilineResponse = DefaultIsMultilineResponse

## 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

## Detailed Description

Base class for client and server classes with stream-based communication.

$A Igor xx Aug14;

## Member Function Documentation

delegate string IG.Lib.IpcStreamClientServerBase.ResponseDelegate | ( | string | request | ) |

Provides an answer string to the specified request string.

Parameters

  request | Request string.

Returns
  Answer to the request.

void IG.Lib.IpcStreamClientServerBase.SetMessagePreix | ( | string | messagePrefix | ) |
| inline

Changes message prefix for the current object.

This setter method is provided in order to keep the MessagePrefix setter protected.

Parameters

  messagePrefix | New message prefix. Must be at least MinimalMessagePreffixLength characters long.

void IG.Lib.IpcStreamClientServerBase.messageSeparator | ( | char | messageSeparator | ) |
| inline

Changes message separator for the current object.

This setter method is provided in order to keep the MessageSeparator setter protected.

Parameters

  messageSeparator | New message separator must not be a separator or a white space character.

void IG.Lib.IpcStreamClientServerBase.SetMessageFalseSeparator | ( | char | messageFalseSeparator | ) |
| inline

Changes message false separator for the current object.

This setter method is provided in order to keep the MessageFalseSeparator setter protected.

Parameters

  messageFalseSeparator | New message false separator must not be a separator or a white space character.

string IG.Lib.IpcStreamClientServerBase.CreateMessage | ( | string | messageName,
|  | string[] | messageArguments
| ) |  |
| 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.

Parameters

  messageName | Name of the message (a kind of command name).
  messageArguments | Optional arguments of the message.

Returns

string IG.Lib.IpcStreamClientServerBase.CreateResponseOrRequestString | ( | string | originalResponseOrRequestString,
|  | bool | multiLine
| ) |  |
| 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).

Parameters

  originalResponseOrRequestString | Original response string that is sent to the other side.
  multiLine | Specifies whether request or response, respectively, can be a multiline string.

Returns
  The created request string that can be distinguished form a command.

void IG.Lib.IpcStreamClientServerBase.InterpretRequestOrResponseLine | ( | ref string | responseOrRequestString,
|  | out bool | isMessage,
|  | out string | messageOrCommandName,
|  | out string[] | messageArguments
| ) |  |
| 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.

Parameters

  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.

void IG.Lib.IpcStreamClientServerBase.WriteMessage | ( | StreamWriter | outputStream,
|  | string | message,
|  | string[] | args
| ) |  |
| inline

Writes a mesage to the output stream. What is written is decorated message (including the standard message prefix and separator) and message arguments.

Parameters

  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.

virtual void IG.Lib.IpcStreamClientServerBase.WorkMessage | ( | string | messageName,
|  | string[] | messageArguments,
|  | IpcStage | context,
|  | ref bool | worked
| ) |  |
| inline virtual

virtual void IG.Lib.IpcStreamClientServerBase.RespondToMessage | ( | string | messageName,
|  | string[] | messageArguments,
|  | ref bool | responded
| ) |  |
| inline virtual

Responds to a received message.

Parameters

  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.

## Member Data Documentation

object IG.Lib.IpcStreamClientServerBase._lock = new object()
| protected

object IG.Lib.IpcStreamClientServerBase._lockGlobal = null
| static private

StringBuilder IG.Lib.IpcStreamClientServerBase._sb = new StringBuilder()
| private

int IG.Lib.IpcStreamClientServerBase._defatultOutputLevel = 1
| static private

int IG.Lib.IpcStreamClientServerBase._otputLevel = DefaultOutputLevel
| private

const int IG.Lib.IpcStreamClientServerBase.MinimalMessagePreffixLength = 3

string IG.Lib.IpcStreamClientServerBase._defaultMessagePrefix = "IGLibMsg"
| static private

char IG.Lib.IpcStreamClientServerBase._defaultMessageSeparator = '_'
| static private

char IG.Lib.IpcStreamClientServerBase._defaultMessageFalseSeparator = '.'
| static private

string IG.Lib.IpcStreamClientServerBase._messagePrefix = DefaultMessagePrefix
| private

char IG.Lib.IpcStreamClientServerBase._messageSeparator = DefaultMessageSeparator
| private

char IG.Lib.IpcStreamClientServerBase._messageFalseSeparator = DefaultMessageFalseSeparator
| private

string IG.Lib.IpcStreamClientServerBase._messagePrefixWithSeparator = null
| private

string IG.Lib.IpcStreamClientServerBase._defaultMsgRequestBegin = "RequestBegin"
| static private

string IG.Lib.IpcStreamClientServerBase._defaultMsgRequestEnd = "RequestEnd"
| static private

string IG.Lib.IpcStreamClientServerBase._defaultMsgResponseBegin = "ResponseBegin"
| static private

string IG.Lib.IpcStreamClientServerBase._defaultMsgResponseEnd = "ResponseEnd"
| static private

string IG.Lib.IpcStreamClientServerBase._defaultMsgTestSquare = "TestStuare"
| static private

string IG.Lib.IpcStreamClientServerBase._defaultMsgTestSpeed = "TestSpeed"
| static private

string IG.Lib.IpcStreamClientServerBase._msgRequestBegin = DefaultMsgRequestBegin
| private

Message that begins any multiline request (only when multiline requests are allowed).

string IG.Lib.IpcStreamClientServerBase._msgRequestEnd = DefaultMsgRequestEnd
| private

Message that ends any multiline request (only when multiline requests are allowed).

string IG.Lib.IpcStreamClientServerBase._msgResponseBegin = DefaultMsgResponseBegin
| private

string IG.Lib.IpcStreamClientServerBase._msgResponseEnd = DefaultMsgResponseEnd
| private

string IG.Lib.IpcStreamClientServerBase._msgTestSquare = DefaultMsgTestSquare
| private

string IG.Lib.IpcStreamClientServerBase._msgTestSpeed = DefaultMsgTestSpeed
| private

string IG.Lib.IpcStreamClientServerBase._defaultStopRequest = "stop"
| static private

string IG.Lib.IpcStreamClientServerBase._stopRequest = DefaultStopRequest
| private

string IG.Lib.IpcStreamClientServerBase._defaultGenericResponse = "IGLib_PipeServer_GenericResponse"
| static private

string IG.Lib.IpcStreamClientServerBase._genericResponse = DefaultGenericResponse
| private

string IG.Lib.IpcStreamClientServerBase._defaultStoppedResponse = "IGLib_PipeServer_StoppedResponse"
| static private

string IG.Lib.IpcStreamClientServerBase._stoppedResponse = DefaultStoppedResponse
| private

bool IG.Lib.IpcStreamClientServerBase._defaultIsMultilineResponse = true
| static private

bool IG.Lib.IpcStreamClientServerBase._defaultIsMultilineRequest = true
| static private

bool IG.Lib.IpcStreamClientServerBase._isMultilineRequest = DefaultIsMultilineRequest
| private

bool IG.Lib.IpcStreamClientServerBase._isMultilineResponse = DefaultIsMultilineResponse
| private

## Property Documentation

object IG.Lib.IpcStreamClientServerBase.Lock
| get

Objectt for locking the current object.

object IG.Lib.IpcStreamClientServerBase.LockGlobal
| static get

Static lock object used by all instances of this class (and possibly by other classes).

StringBuilder IG.Lib.IpcStreamClientServerBase.StringBuilderInternal
| get protected

int IG.Lib.IpcStreamClientServerBase.DefaultOutputLevel
| static get set

Default level of output for this kind of class.

virtual int IG.Lib.IpcStreamClientServerBase.OutputLevel
| get set

Level of output generated by operatins.

Referenced by IG.Lib.CommandLineApplicationInterpreter.CreatePipeClient(), and IG.Lib.CommandLineApplicationInterpreter.CreatePipeServer().

string IG.Lib.IpcStreamClientServerBase.DefaultMessagePrefix
| static get set

char IG.Lib.IpcStreamClientServerBase.DefaultMessageSeparator
| static get set

char IG.Lib.IpcStreamClientServerBase.DefaultMessageFalseSeparator
| static get set

string IG.Lib.IpcStreamClientServerBase.MessagePrefix
| get protected set

char IG.Lib.IpcStreamClientServerBase.MessageSeparator
| get protected set

char IG.Lib.IpcStreamClientServerBase.MessageFalseSeparator
| get protected set

string IG.Lib.IpcStreamClientServerBase.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.

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.

string IG.Lib.IpcStreamClientServerBase.DefaultMsgRequestBegin
| static get

Default message that begins any mulltiline request.

string IG.Lib.IpcStreamClientServerBase.DefaultMsgRequestEnd
| static get

Default message that ends any mulltiline request.

string IG.Lib.IpcStreamClientServerBase.DefaultMsgResponseBegin
| static get

Default message that begins any multiline response.

string IG.Lib.IpcStreamClientServerBase.DefaultMsgResponseEnd
| static get

Default message that ends any multiline response.

string IG.Lib.IpcStreamClientServerBase.DefaultMsgTestSquare
| static get

Default message that requests a test computation of square to be performed on the other side (a sort of ping command).

string IG.Lib.IpcStreamClientServerBase.DefaultMsgTestSpeed
| static get

Default message that requests a speed test to be performed on the other side (a sort of ping command).

string IG.Lib.IpcStreamClientServerBase.MsgRequestBegin
| get protected set

string IG.Lib.IpcStreamClientServerBase.MsgRequestEnd
| get protected set

string IG.Lib.IpcStreamClientServerBase.MsgResponseBegin
| get protected set

Message that begins any multiline response (only when multiline responses are allowed).

string IG.Lib.IpcStreamClientServerBase.MsgResponseEnd
| get protected set

Message that ends any multiline response (only when multiline responses are allowed).

string IG.Lib.IpcStreamClientServerBase.MsgTestSquare
| get protected set

Message that requests square of its argument to be sent back. Used as a kind of verifiable ping.

string IG.Lib.IpcStreamClientServerBase.MsgTestSpeed
| get protected set

Message that requires a kind of speed test to be performed on the other side.

string IG.Lib.IpcStreamClientServerBase.DefaultStopRequest
| static get set

Default stop request string - request string that will stop the server.

string IG.Lib.IpcStreamClientServerBase.StopRequest
| get set

Request that causes the server stop listening and closing the pipe.

string IG.Lib.IpcStreamClientServerBase.DefaultGenericResponse
| static get set

Default generic response (sent in absence of any other method to generate the response).

string IG.Lib.IpcStreamClientServerBase.GenericResponse
| get protected set

Generic response that is sent back to the client in abscence of any method generating responses to specific requests.

string IG.Lib.IpcStreamClientServerBase.DefaultStoppedResponse
| static get set

Default stopped response (sent after the srver has sttopped on request).

string IG.Lib.IpcStreamClientServerBase.StoppedResponse
| get protected set

Stopped response that is sent back to the client after the server stops on its request.

bool IG.Lib.IpcStreamClientServerBase.DefaultIsMultilineResponse
| static get

Default pipe name.

bool IG.Lib.IpcStreamClientServerBase.DefaultIsMultilineRequest
| static get

Default pipe name.

virtual bool IG.Lib.IpcStreamClientServerBase.IsMultilineRequest
| get protected set

Whether or not multi line requests are allowed.

virtual bool IG.Lib.IpcStreamClientServerBase.IsMultilineResponse
| get protected set

Whether or not multi line responses are allowed.

The documentation for this class was generated from the following file:

- igbase/data/streams/IpcStreamClientServerBase.cs