Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Client Class Reference

#include <client.h>

Inheritance diagram for Client:

Inheritance graph
[legend]
Collaboration diagram for Client:

Collaboration graph
[legend]
List of all members.

Public Methods

 Client (ost::TCPSocket &sock, World *w)
 ~Client ()
void sendMessage (const Message &msg)
virtual void Run (void)
void initialize ()
string getName ()

Protected Methods

Functions
The functions that the protocol may need

void newCylinder (Message &msg)
void grow (Message &msg)
void sendEnergy (Message &msg)
void move (Message &msg)
void dropCylinder (Message &msg)
void sendMessage (Message &msg)
void clientLog (Message &msg)
void endOfTurn (Message &msg)

Protected Attributes

string name

Constructor & Destructor Documentation

Client::Client (  ost::TCPSocket &    sock,
World *    w
) 
 

Definition at line 39 of file client.cc.

References initialize().

Client::~Client (    ) 
 

Definition at line 35 of file client.cc.

References World::clientOut(), and baseClient::world.


Member Function Documentation

void Client::clientLog (  Message &    msg )  [protected]
 

Log a message

Definition at line 372 of file client.cc.

References log, Message::msg, Message::petition, Message::sendTo(), Message::size, and baseClient::stream.

Referenced by Run().

void Client::dropCylinder (  Message &    msg )  [protected]
 

Make a cylinder get droped from agent, includes the creation message of the new agent son

Definition at line 164 of file client.cc.

References World::getAgent(), Cylinder::getFather(), log, Message::msg, Cylinder::newIntention(), Message::organismId, Message::petition, Message::sendTo(), Message::size, baseClient::stream, Message::umsg, and baseClient::world.

Referenced by Run().

void Client::endOfTurn (  Message &    msg )  [protected]
 

Definition at line 386 of file client.cc.

References baseClient::dontWalk(), Message::petition, Message::sendTo(), and baseClient::stream.

Referenced by Run().

string Client::getName (    )  [inline]
 

Definition at line 57 of file client.h.

References name.

Referenced by World::newAgent(), and CommCenter::newClient().

void Client::grow (  Message &    msg )  [protected]
 

Make the client grow a little bit

Definition at line 274 of file client.cc.

References World::getAgent(), Cylinder::getEnergy(), growHorizontal, GrowType, growVertical, log, Cylinder::newIntention(), Message::organismId, Message::petition, Message::sendTo(), Message::size, baseClient::stream, Message::umsg, and baseClient::world.

Referenced by Run().

void Client::initialize (    ) 
 

Definition at line 89 of file client.cc.

References baseClient::alive, log, name, World::newAgent(), Point3d, baseClient::stream, and baseClient::world.

Referenced by Client().

void Client::move (  Message &    msg )  [protected]
 

Moves a cylinder, around it's father

Definition at line 316 of file client.cc.

References World::getAgent(), Cylinder::getEnergy(), log, moveHorizontalCCW, moveHorizontalCW, MoveType, moveUnknown, moveVerticalCCW, moveVerticalCW, Message::msg, Cylinder::newIntention(), Message::organismId, Message::petition, Message::sendTo(), Message::size, baseClient::stream, Message::umsg, and baseClient::world.

Referenced by Run().

void Client::newCylinder (  Message &    msg )  [protected]
 

Make a cylinder appear near any other cylinder

Definition at line 119 of file client.cc.

References World::getAgent(), Agent::getCylinderCount(), Cylinder::getEnergy(), log, M_PI, Message::msg, Cylinder::newIntention(), Message::organismId, Message::petition, Message::sendTo(), Message::size, baseClient::stream, Message::umsg, and baseClient::world.

Referenced by Run().

void Client::Run (  void    )  [virtual]
 

Runs the wait-for-messages loop

Reimplemented from baseClient.

Definition at line 43 of file client.cc.

References baseClient::alive, clientLog(), dropCylinder(), endOfTurn(), grow(), log, messageDrop, messageEndOfTurn, messageGrow, messageLog, messageMove, messageNewCylinder, messageSendEnergy, messageSendMessage, move(), newCylinder(), sendEnergy(), sendMessage(), baseClient::stream, and Message::type.

void Client::sendEnergy (  Message &    msg )  [protected]
 

Send some energy from a parent cylinder to one of his sons, or from son to his father

Definition at line 230 of file client.cc.

References Cylinder::dist(), World::getAgent(), Cylinder::getEnergy(), log, Cylinder::newIntention(), Message::organismId, Message::petition, Message::sendTo(), Message::size, baseClient::stream, Message::umsg, and baseClient::world.

Referenced by Run().

void Client::sendMessage (  const Message &    msg )  [inline]
 

Definition at line 53 of file client.h.

References baseClient::stream.

void Client::sendMessage (  Message &    msg )  [protected]
 

Send a message to another agent, and maybe some clients can get it from the air. This message is sent by cylinder n. zero, always.

Definition at line 201 of file client.cc.

References World::getAgent(), log, Message::msg, Cylinder::newIntention(), Message::organismId, Message::petition, Message::sendTo(), Message::size, baseClient::stream, Message::umsg, and baseClient::world.

Referenced by Agent::Agent(), and Run().


Member Data Documentation

string Client::name [protected]
 

The name and version of the client

Definition at line 32 of file client.h.

Referenced by getName(), and initialize().


The documentation for this class was generated from the following files:
Generated on Mon Jun 17 19:54:14 2002 for Svas Server by doxygen1.2.16