Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: Overview of Agent Interaction Up: Events Previous: What is an ``Event"?

Subsections



Agents

An agent is an entity that generates and responds to events. Typically it's a process running either locally or on a remote computer; these agents are called clients.

Agents generate events in order to communicate with the rest of the world, namely the Glish program and any other agents the program may have created. By saying that agents respond to events means that they expect to receive certain types of events, and then they perform some action based on the name and value of the received event. The action may entail generating one or more new events or it may not. In general, the events an agent receives and those it generates need not be related, though often they are.


The agent Type

Glish provides an agent type for values corresponding to agents.

The client function provides a way to create an agent associated with a running process. For example,

    demo := client("demo_client")
assigns to demo an agent value corresponding to an instance of the program demo_client running on the local host.
    demo := client("demo_client", host="mars")
does the same thing except demo_client runs on the remote host mars. (See § 7.8, page [*], for a full discussion of the client function.)

You can also create agents that correspond to autonomous entities running within the context of a Glish program. The create_agent function takes no arguments and returns an agent value corresponding to a new, unique agent:

    my_agent := create_agent()
This agent can then be sent events using the mechanisms discussed in § 7.4, page [*], and respond to those events using whenever statements, as discussed in § 7.5, page [*].


Agent Records

Each agent value is also a record. Whenever the agent generates an event, Glish sets a field in the record with the same name to the value of the event. So, for example, if an agent a generates a hello event with a value of [F, F], then a.hello is set to [F, F].

For the most part, an agent's record can be used just like any other. In particular, you can create new fields in it or modify existing ones. Neither of these operations generates an event, though.


next up previous contents index
Next: Overview of Agent Interaction Up: Events Previous: What is an ``Event"?   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15