Next: ReadNext
Up: Player Type
Previous: PLBundle
ReadFile
Semantics
The player type ReadFile corresponds to the capability of performing input from a file. It captures the semantics of a Module performing input from a file via a FileIO connection (as opposed to a Filter performing input from a file via a Pipe connection). In a UniCon architectural description, the ReadFile player is used to create an abstraction for an input 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, read, and close that perform some capability in the application).
Component Types In
A player of type ReadFile can legally be defined in components of the following types:
Role Type
Associations
A player of type ReadFile 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 ReadFile player:
- The syntax for the MaxAssocs property in a ReadFile player is a single <integer> surrounded by parentheses:
- MAXASSOCS (1)
- The syntax for the MinAssocs property in a ReadFile player is a single <integer> surrounded by parentheses:
- MINASSOCS (1)
- The syntax for the Signature property in a ReadFile 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 ReadFile is implemented as a set of language constructs or system calls that implement some input capability in the application. For example, a player of type ReadFile might consist of a set of function calls to open, read, and close that reads the data from a file into a buffer in memory:
#include <stdio.h>
#include <fcntl.h>
#define MAX_BUF_LEN 256
#define FOR_INPUT "r"
/* external data definitions required to support the code fragments below */
char input_buffer[MAX_BUF_LEN + 1];
int i, fd;
fd = open ("datafile", O_RDONLY);
for (i = 0;
i < MAX_BUF_LEN;
i++)
if (read (fd, &input_buffer[i], ONE_CHARACTER) == 0)
break;
close (fd);
Next: ReadNext
Up: Player Type
Previous: PLBundle
Comments?
Mail the current maintainer of this page.
Author:
Gregory Zelesnik
Last Modified: May 12, 1996