Next: WriteNext
Up: Player Type
Previous: StreamOut
WriteFile
Semantics
The player type WriteFile corresponds to the capability of performing output to a file. It captures the semantics of a Module performing output to a file via a FileIO connection (as opposed to a Filter performing output to a file via a Pipe connection). In a UniCon architectural description, the WriteFile player is used to create an abstraction for an output operation in the underlying implementation of a system. The word operation here is not meant to refer to a specific function call or language construct, but refers to a group of language constructs or system calls that implement some capability (e.g., in C, a sequence of function calls to open, write, and close that perform some capability in the application).
Component Types In
A player of type WriteFile can legally be defined in components of the following types:
Role Type
Associations
A player of type WriteFile can legally be associated with the following role type in a FileIO connection:
Properties
The following properties can be legally included in the property list of a WriteFile player:
- The syntax for the MaxAssocs property in a WriteFile player is a single <integer> surrounded by parentheses:
- MAXASSOCS (1)
- The syntax for the MinAssocs property in a WriteFile player is a single <integer> surrounded by parentheses:
- MINASSOCS (1)
- The syntax for the Signature property in a WriteFile player is a list of items that are either <identifier>s or "string"s, surrounded by parentheses:
- SIGNATURE (int)
SIGNATURE (int, "char *", double)
Implementation Considerations
In the source code implementation of a system, a player of type WriteFile is implemented as a set of language constructs or system calls that implement some output capability in the application. For example, a player of type WriteFile might consist of a set of function calls to open, write, and close that writes the data to a file from a buffer in memory:
#include <stdio.h>
#include <fcntl.h>
#define MAX_BUF_LEN 256
#define ONE_CHARACTER 1
/* external data definitions required to support the code fragments below */
char output_buffer[MAX_BUF_LEN + 1];
int i, fd;
fd = open ("datafile", O_WRONLY);
for (i = 0;
output_buffer[i] != `\0' && i < MAX_BUF_LEN;
i++)
write (fd, &output_buffer[i++], ONE_CHARACTER);
close (fd);
Next: WriteNext
Up: Player Type
Previous: StreamOut
Comments?
Mail the current maintainer of this page.
Author:
Gregory Zelesnik
Last Modified: May 12, 1996