| # Section 8.10.3.3: OUT |

###### class OUT < $OUT_DEVICE

#### Formal Types

types
SAME = OUT ;

This class implements a connection to the standard operating system output channel -- for output only! (see also the class ERR for error channel output).

#### External specifications

The following routine is required to be implemented for this class in accordance with the specification given in $OUT_DEVICE :-

- output_possible : BOOL

Since the output channel is only for output, this will vacuously return true for this class.

#### create

This feature produces a new connection to the program environment standard output channel for use in output of text to that channel.

create | : SAME

##### Formal Signature

create() res : SAME

##### Pre-condition

This is vacuously true for creation without arguments.

##### Post-condition

The result, not being an optional object is the newly created connection and the post-condition is true.

This creation creates a new connection to the program environment standard output channel for appending text data only.

#### plus

This is the first of four variants of the channel append operation. It appends the single character argument to the channel.

plus | (
| ch : CHAR
| )

##### Formal Signature

plus(self : SAME, ch : CHAR)

##### Pre-condition

pretrue

##### Post-condition

The character has been sent to the standard output channel.

This operation appends the character argument to the program environment defined standard output channel as a code which is assumed to be in the program environment default encoding and repertoire. If this is not the case then the result is undefined.

#### plus

This second variant of the channel append operation first appends the single character argument to the channel and then returns the connection.

plus | (
| ch : CHAR
| ) : SAME

##### Formal Signature

Note that the name of the formal operation has been changed since over-loading is not permitted in vdm-sl.

plus2(self : SAME, ch : CHAR) res : SAME

##### Pre-condition

pretrue

##### Post-condition

The character has been sent to the standard output channel.

postres = self

This operation appends the character argument to the program environment standard output channel as a code which is assumed to be in the program environment default encoding and repertoire. If this is not the case then the result is undefined although self is returned irrespective of this.

#### plus

This variant of the channel append operation takes a text string argument - which it appends to the channel.

plus | (
| str : STR
| )

##### Formal Signature

Note that the name of the formal operation has been changed since over-loading is not permitted in vdm-sl.

plus3(self : SAME, str : STR)

##### Pre-condition

preSTR.size(str) > 0

##### Post-condition

The string has been sent to the standard output channel.

This operation appends the string argument to the program environment defined standard output channel as a sequence of codes which are assumed to be in the program environment default encoding and repertoire (see also STR::index_lib). If this is not the case then the result is undefined.

#### plus

This final variant of the channel append operation first appends the string argument to the channel and then returns the connection.

plus | (
| str : STR
| ) : SAME

##### Formal Signature

Note that the name of the formal operation has been changed since over-loading is not permitted in vdm-sl.

plus4(self : SAME, str : STR) res : SAME

##### Pre-condition

pretrue

##### Post-condition

The given text string has been sent to the standard output channel.

postres = self

This operation appends the given string to the program environment standard output channel as a sequence of codes which are assumed to be in the program environment default encoding and repertoire (see also STR::index_lib). If this is not the case then the result is undefined although self is returned irrespective of this.

#### flush

This feature ensures that any pending output to the channel has been delivered.

flush

##### Formal Signature

flush(self : SAME)

##### Pre-condition

This is vacuously true.

##### Post-condition

Any output which has been sent to the channel since either it was opened or the most recent previous call of this routine, will be forced out before any other output can be queued for the channel. It is equivalent to a synchronise of the channel between program and environment.

This routine flushes any output queue/buffer which may be associated with the channel, ensuring that channel and program are synchronised.

| Language Index |  | Library Index |  | Input/Output Index

Comments or enquiries should be made to Keith Hopper. Page last modified: Thursday, 13 July 2000. |