#include <agent.h>
Collaboration diagram for Agent:
Public Methods | |
Agent (Client *, const Point3d &position, const char *creationMessage, unsigned long int messageSize) | |
Creates an empty agent. The Client pointer is the agent owner. | |
Agent (Client *, Cylinder *, const char *creationMessage, unsigned long int messageSize) | |
Creates an agent based on a cylinder and it's old-agent properties. | |
~Agent () | |
Destroy the client. | |
void | receiveMessage (unsigned long int _agentId, const char *message, unsigned long int size) |
Receives a message from another agent. | |
bool | into (BoundingBox &bbox) |
Checks if the agent is in the bounding box. | |
vector< Cylinder * > | performActions () |
Performs desired intentions, as each cylinder can have only one. | |
some gets | |
some properties that can be consulted | |
unsigned long int | getId (void) |
Client * | getClient () |
short int | getCylinderCount (bool increment=false) |
Returns (and maybe generate) a new cylinder id. | |
short int | getNumCylinders (void) |
Cylinder * | operator() (unsigned short int i) |
Get the specified cylinder. By number (see numCylinders()). | |
Cylinder * | operator[] (unsigned short int i) |
Get specified cylinder by id. | |
World * | getWorld () |
Protected Attributes | |
unsigned long int | id |
The id of the actual agent. | |
Cylinder * | cylinder |
Client * | client |
short int | cylinderCount |
Static Protected Attributes | |
unsigned long int | agentMaxId = 0 |
Definition at line 40 of file agent.h.
|
Creates an empty agent. The Client pointer is the agent owner. Creates an empty agent; default sizes and energies, position... Just to begin an agentClient Definition at line 37 of file agent.cc. References agentMaxId, client, cylinder, cylinderCount, getId(), baseClient::getWorld(), id, messageNewAgent, Cylinder::movePosition(), Point3d, Client::sendMessage(), and Cylinder::setNewAgent(). |
|
Creates an agent based on a cylinder and it's old-agent properties. Creates an Agent based on a dropCylinder cylinder drop. Position, energy... all is deduced from cylinder Definition at line 56 of file agent.cc. References agentMaxId, client, cylinder, cylinderCount, getId(), id, log, messageNewAgent, Client::sendMessage(), and Cylinder::setNewAgent(). |
|
Destroy the client.
Definition at line 71 of file agent.cc. References cylinder. |
|
Definition at line 71 of file agent.h. Referenced by World::newAgent(). |
|
Returns (and maybe generate) a new cylinder id.
Definition at line 73 of file agent.h. References cylinderCount. Referenced by Cylinder::Cylinder(), and Client::newCylinder(). |
|
Definition at line 70 of file agent.h. References id. Referenced by Agent(), and Cylinder::sendMessage(). |
|
Definition at line 74 of file agent.h. References Cylinder::getNumCylinders(). |
|
Return the world in which the agent lives Definition at line 97 of file agent.cc. References client, and baseClient::getWorld(). |
|
Checks if the agent is in the bounding box.
Definition at line 86 of file agent.h. References BoundingBox::contains(), and Cylinder::getPosition(). |
|
Get the specified cylinder. By number (see numCylinders()).
|
|
Get specified cylinder by id.
|
|
Performs desired intentions, as each cylinder can have only one. Performs the actions that cylinders said they wanted to perform. As usually this involves energy consumption, a list of energy cylinders created is returned Definition at line 81 of file agent.cc. References Cylinder::performAction(). |
|
Receives a message from another agent.
Referenced by Cylinder::sendMessage(). |
|
Max id reached by agents. Each new agent need to have a brand new id Definition at line 31 of file agent.cc. Referenced by Agent(). |
|
The client to which the agent belongs |
|
The parent cylinder in the agent, all the rest cylinder hangs from it |
|
The count of cylinders, if a new cylinder is created in this agent this number increases, and the old number is returned. Definition at line 56 of file agent.h. Referenced by Agent(), and getCylinderCount(). |
|
The id of the actual agent.
|