-
Notifications
You must be signed in to change notification settings - Fork 7
create_static_agent
create_static_agent(Agent_name,(IP,Port),Handler).
Agent_name: <atom ? > IP: <atom +>, Port: <integer +> Handler: <atom + >
Creates a static agent within the platform specified by the IP and Port, confers it a name and allocates its handler.
This predicate creates a static agent with the name Agent_name given by the user. It allocates the handler (which is a predicate specified by the user) Handler. The agent is created in the platform running at the IP and Port specified within. This predicate automatically creates the agent-specific predicates and asserts them within the specified platform. If the platform already contains an agent with the same name, it overwrites the same with this new agent having the specified name and handler.
?- create_static_agent(myagent, (localhost, 4545), function).
?- create_static_agent (Agent_name, (localhost, 4545), function).
In 1., the predicate creates all the agent-specific predicates and asserts them within the platform running on the localhost at port 4545. The agent name is myagent. In the second example, the name of the agent is unbound. The predicate automatically calls get_new_name_alpha/1 and then assigns a new name to this agent.