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

World Class Reference

#include <world.h>

Collaboration diagram for World:

Collaboration graph
[legend]
List of all members.

Public Methods

 World (CommCenter *_commCenter, BoundingBox _bbox=BoundingBox())
 Creates a world that is contained in the bounding box.

void newAgent (Cylinder *cyl, const char *creationMessage, unsigned long int messageSize)
 Creates and adds a new agent to the world.

void newAgent (Agent *)
 Adds a existing agent to this world.

void clientOut (Client *)
 Delete the agents that depend on this client.

void setQuit ()
 Make this world disappear.

bool getQuit ()
 Do I wanna quit?

AgentgetAgent (unsigned long int agentId)
 Get an Agent.

vector< Agent * > getAgents (BoundingBox box=BoundingBox())
 Get agents in this area.

string getStats ()
 Get a string with stats about the world.

void step ()
 Run a time step (move objects...).

void step (double lowerLimit, double upperLimit)
 Seccond part of step, this is the collision detection/response part.

void addCylinder (Cylinder *)
 Adds a new cylinder to the cylinders in the world.

void delCylinder (Cylinder *)
 Deletes a new cylinder to the cylinders in the world.

void addMessage (const char *data, unsigned long int size, Agent *agent)
 Adds a message to the air.

unsigned long int getNumCylinders ()
 Number of world owned cylinders.

CylindergetCylinder (unsigned long int i)
 Get a world cylinder.


Static Public Methods

Get some constant properties of the world
double getGravity ()
 Get the gravitation of this world.

double getLinearDragCoefficient ()
 Get the linear drag coefficient of this world.

double getAngularDragCoefficient ()
 Get the angular drag coefficient of this world.

double getGroundRestitutionCoefficient ()
 Get the coefficient of restitution of ground of this world.

double getGroundFrictionCoefficient ()
 Get the coefficient of friction of ground of this world.

double getSpringCoefficient ()
 Get the coefficient spring (glue).

double getDamperCoefficient ()
 Get the coefficient of damper (resistance to motion in glue).


Public Attributes

ost::AtomicCounter numClients
 Number of clients to wait for.


Protected Attributes

vector< Agent * > agents
 The agents that are in this world.

vector< Cylinder * > cylinders
BoundingBox bbox
 The limits of this world.

bool quit
 If I want to destroy this world.

CommCentercommCenter
 The commCenter that communicates this world.

vector< MessageAirmessages
 The messages that are in the air in current cycle.


Static Protected Attributes

some constants of this universe
double gravity = -0.0005
 gravity of this world

double linearDragCoefficient = 0.20
 Linear drag coefficient.

double angularDragCoefficient = 0.20
 Angular drag coefficient.

double groundRestitutionCoefficient = 0.02
 Ground restitution coefficient.

double groundFrictionCoefficient = 0.09
 Ground friction coefficient.

double springCoefficient = 10
 Spring coefficient (glue).

double damperCoefficient = 2
 Damper coefficient (resistance to union/separation in glue).


Detailed Description

The world where the agents live in. The world have agents, and the agents are composed of cylinders. The world have size limits (or not).

Definition at line 58 of file world.h.


Constructor & Destructor Documentation

World::World CommCenter   _commCenter,
BoundingBox    _bbox = BoundingBox()
 

Creates a world that is contained in the bounding box.

creates a world that comprehen this bounding box

Definition at line 52 of file world.cc.

References bbox, commCenter, log, quit, and BoundingBox::toString().


Member Function Documentation

void World::addCylinder Cylinder   c
 

Adds a new cylinder to the cylinders in the world.

Add a new cylinder. All cylinders are in this vector, and are here until they finally dissapear.

Definition at line 241 of file world.cc.

References cylinders.

Referenced by Cylinder::Cylinder().

void World::addMessage const char *    data,
unsigned long int    size,
Agent   agent
[inline]
 

Adds a message to the air.

Definition at line 125 of file world.h.

References messages.

Referenced by Cylinder::sendMessage().

void World::clientOut Client   client
 

Delete the agents that depend on this client.

When a client go out it's agents are deleted.

They should be drop to the world. FIXME

Definition at line 101 of file world.cc.

References agents.

Referenced by Client::~Client().

void World::delCylinder Cylinder   c
 

Deletes a new cylinder to the cylinders in the world.

Add a new cylinder. All cylinders are in this vector, and are here until they finally dissapear.

Definition at line 249 of file world.cc.

References cylinders.

Referenced by Cylinder::~Cylinder().

Agent * World::getAgent unsigned long int    agentId
 

Get an Agent.

Gets and agents given a agentId. If none is found returns a NULL pointer.

Definition at line 115 of file world.cc.

References agents.

Referenced by Client::dropCylinder(), Client::grow(), Client::move(), Client::newCylinder(), Client::sendEnergy(), Cylinder::sendMessage(), and Client::sendMessage().

vector< Agent * > World::getAgents BoundingBox    box = BoundingBox()
 

Get agents in this area.

Get a vector of agents that it's center is into the bounding box

Definition at line 127 of file world.cc.

References agents.

double World::getAngularDragCoefficient   [inline, static]
 

Get the angular drag coefficient of this world.

Definition at line 141 of file world.h.

References angularDragCoefficient.

Referenced by Cylinder::newCycle().

Cylinder* World::getCylinder unsigned long int    i [inline]
 

Get a world cylinder.

Definition at line 130 of file world.h.

References cylinders.

Referenced by Cylinder::checkCollisions(), and GraphicClient::Run().

double World::getDamperCoefficient   [inline, static]
 

Get the coefficient of damper (resistance to motion in glue).

Definition at line 149 of file world.h.

References damperCoefficient.

Referenced by Cylinder::newCycle().

double World::getGravity   [inline, static]
 

Get the gravitation of this world.

Definition at line 137 of file world.h.

References gravity.

Referenced by Cylinder::newCycle().

double World::getGroundFrictionCoefficient   [inline, static]
 

Get the coefficient of friction of ground of this world.

Definition at line 145 of file world.h.

References groundFrictionCoefficient.

Referenced by Collision::resolveGroundCollision().

double World::getGroundRestitutionCoefficient   [inline, static]
 

Get the coefficient of restitution of ground of this world.

Definition at line 143 of file world.h.

References groundRestitutionCoefficient.

double World::getLinearDragCoefficient   [inline, static]
 

Get the linear drag coefficient of this world.

Definition at line 139 of file world.h.

References linearDragCoefficient.

Referenced by Cylinder::newCycle().

unsigned long int World::getNumCylinders void    [inline]
 

Number of world owned cylinders.

Definition at line 128 of file world.h.

References cylinders.

Referenced by Cylinder::checkCollisions(), and GraphicClient::Run().

bool World::getQuit   [inline]
 

Do I wanna quit?

Definition at line 109 of file world.h.

References quit.

Referenced by CommCenter::loop().

double World::getSpringCoefficient   [inline, static]
 

Get the coefficient spring (glue).

Definition at line 147 of file world.h.

References springCoefficient.

Referenced by Cylinder::newCycle().

string World::getStats  
 

Get a string with stats about the world.

Prints several stats about the world. Each one is a variable with an equal (=) between the variable and the value. Semicolon (;) is used as separator.

Definition at line 145 of file world.cc.

References agents, cylinders, and sTime().

Referenced by ControlClient::Run().

void World::newAgent Agent   agent
 

Adds a existing agent to this world.

Is simply adds the agent to the list of agents

Definition at line 64 of file world.cc.

References agents, and log.

void World::newAgent Cylinder   cyl,
const char *    creationMessage,
unsigned long int    messageSize
 

Creates and adds a new agent to the world.

It searchs for a suitable client and creates the agent for that client

Definition at line 73 of file world.cc.

References agents, commCenter, Cylinder::getAgent(), Agent::getClient(), CommCenter::getClientForMigration(), Client::getName(), log, newAgent(), and Cylinder::setNewAgent().

Referenced by Cylinder::drop(), Client::initialize(), and newAgent().

void World::setQuit   [inline]
 

Make this world disappear.

Definition at line 107 of file world.h.

References quit.

Referenced by ControlClient::Run().

void World::step double    lowerLimit,
double    upperLimit
 

Seccond part of step, this is the collision detection/response part.

Runs a collision detection/reponse step of upper-lower time units. This is so to detect correctly all collisions.

Definition at line 191 of file world.cc.

References COLLISION_TIME_EPSILUM, cylinders, penetrating, and step().

void World::step  
 

Run a time step (move objects...).

Runs a time step; first tell all cylinders to acomplish intentions, and later move according to forces, velocities and collisions.

Definition at line 159 of file world.cc.

References agents, cylinders, and messages.

Referenced by CommCenter::makeMovements(), and step().


Member Data Documentation

vector<Agent *> World::agents [protected]
 

The agents that are in this world.

Definition at line 61 of file world.h.

Referenced by clientOut(), getAgent(), getAgents(), getStats(), newAgent(), and step().

double World::angularDragCoefficient = 0.20 [static, protected]
 

Angular drag coefficient.

Definition at line 38 of file world.cc.

Referenced by getAngularDragCoefficient().

BoundingBox World::bbox [protected]
 

The limits of this world.

Definition at line 66 of file world.h.

Referenced by World().

CommCenter* World::commCenter [protected]
 

The commCenter that communicates this world.

Definition at line 70 of file world.h.

Referenced by newAgent(), and World().

vector<Cylinder *> World::cylinders [protected]
 

Some cylinders are not attached to agents, as the energy cylinders, and those on the ground

Definition at line 64 of file world.h.

Referenced by addCylinder(), delCylinder(), getCylinder(), getNumCylinders(), getStats(), and step().

double World::damperCoefficient = 2 [static, protected]
 

Damper coefficient (resistance to union/separation in glue).

Definition at line 46 of file world.cc.

Referenced by getDamperCoefficient().

double World::gravity = -0.0005 [static, protected]
 

gravity of this world

Definition at line 34 of file world.cc.

Referenced by getGravity().

double World::groundFrictionCoefficient = 0.09 [static, protected]
 

Ground friction coefficient.

Definition at line 42 of file world.cc.

Referenced by getGroundFrictionCoefficient().

double World::groundRestitutionCoefficient = 0.02 [static, protected]
 

Ground restitution coefficient.

Definition at line 40 of file world.cc.

Referenced by getGroundRestitutionCoefficient().

double World::linearDragCoefficient = 0.20 [static, protected]
 

Linear drag coefficient.

Definition at line 36 of file world.cc.

Referenced by getLinearDragCoefficient().

vector<MessageAir> World::messages [protected]
 

The messages that are in the air in current cycle.

Definition at line 72 of file world.h.

Referenced by addMessage(), and step().

ost::AtomicCounter World::numClients
 

Number of clients to wait for.

Definition at line 153 of file world.h.

Referenced by CommCenter::checkForDeadClients(), baseClient::dontWalk(), and CommCenter::waitForClients().

bool World::quit [protected]
 

If I want to destroy this world.

Definition at line 68 of file world.h.

Referenced by getQuit(), setQuit(), and World().

double World::springCoefficient = 10 [static, protected]
 

Spring coefficient (glue).

Definition at line 44 of file world.cc.

Referenced by getSpringCoefficient().


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