PhysicsObjectManager Class Reference

#include <PhysicsObjectManager.h>

Inherited by SingleServerPhysicsObjectManager.

Collaboration diagram for PhysicsObjectManager:

List of all members.


Public Member Functions

 PhysicsObjectManager ()
virtual ~PhysicsObjectManager ()
virtual void getLocalSimulatedObjects (std::vector< PhysicsObjectInterface * > &dst)
virtual void getRemoteSimulatedObjects (std::vector< PhysicsObjectInterface * > &dst)
virtual PhysicsObjectInterfacegetObjectById (PhysicsObjectID id)
virtual bool isSimulatingRigidBody (OopsObjectID rigidBodyID)=0
virtual bool isSimulatingJoint (OopsObjectID jointID)=0

Protected Member Functions

virtual void getLocalSimulatedRigidBodies (std::vector< oops::RigidBody * > &dst)=0
virtual void getLocalSimulatedJoints (std::vector< oops::Joint * > &dst)=0
virtual void getRemoteSimulatedRigidBodies (std::vector< oops::RigidBody * > &dst)=0
virtual void getRemoteSimulatedJoints (std::vector< oops::Joint * > &dst)=0
virtual oops::RigidBodygetRigidBodyById (OopsObjectID id)
virtual oops::JointgetJointById (OopsObjectID id)
virtual void init (Physics *physics)
virtual oops::SimulationgetSimulation ()
virtual unsigned int getSimulationTime ()
virtual bool addPhysicsObject (PhysicsObjectInterface *object)
virtual bool addPhysicsObjectInternal (PhysicsObjectInterface *object)
virtual bool removePhysicsObject (PhysicsObjectInterface *object)
virtual PhysicsObjectInterfaceremovePhysicsObject (PhysicsObjectID physicsObjectID)
virtual void step (float dt)=0
virtual NetMessagecreateSynchronisationMessage ()=0
virtual void handleSynchronisationMessage (NetMessage *msg)=0
virtual bool isServer ()=0

Protected Attributes

Physicsphysics
 Pointer to the physics Module.
OSG::Lock * addObjectListLock
 Lock for list of objects to add.
std::vector
< PhysicsObjectInterface * > 
objectList
 List of all objects in the simulation.
std::vector< oops::RigidBody * > rigidBodyList
std::vector< oops::Joint * > jointList
std::vector
< PhysicsObjectInterface * > 
addObjectList
 List of objects to add.

Friends

class Physics
class SynchronisationModel
class SynchronisePhysicsEvent

Detailed Description

Manager class for simulated objects in Physics Module. This class is used as a template for Manager classes which handle the PhysicsObjects used in the Physics Module. The class therefore has to store all objects which are relevant for the local User. It also has the function to add or remove objects from the simulation. Better Management classes can also allow to migrate objects to other servers.

Constructor & Destructor Documentation

PhysicsObjectManager::PhysicsObjectManager (  ) 

Constructor initializes members. The constructor initializes the members to NULL. The real initialization is done in the init method.

PhysicsObjectManager::~PhysicsObjectManager (  )  [virtual]

Empty destructor. The destructor has no work yet.


Member Function Documentation

bool PhysicsObjectManager::addPhysicsObject ( PhysicsObjectInterface object  )  [protected, virtual]

Adds a PhysicsObject to the Simulation. The method adds the passed object to a list of objects which should be added to the Simulation. The entries of this list are then added to the Simulation before the next simulation step occurs.

Parameters:
object Object to add to simulation.
Returns:
true if the object could be added, false otherwise

bool PhysicsObjectManager::addPhysicsObjectInternal ( PhysicsObjectInterface object  )  [protected, virtual]

Adds a PhysicsObject to the Simulation. The method adds the passed object to the simulation and to the list of simulated objects.

Parameters:
object Object to add to simulation.
Returns:
true if the object could be added, false otherwise

virtual NetMessage* PhysicsObjectManager::createSynchronisationMessage (  )  [protected, pure virtual]

Creates a SynchronisationMessage for the current PhysicsObjectManager. The method returns a message containing information for the initial synchronisation of the PhysicsObjectManager. It is called from the Physics-Module in the Physics::createSyncEvent method. The returned message is then appended to the PhysicsSynchronisationEvent and sent to the new connected User.

Returns:
Synchronisation message for new User.

Implemented in SingleServerPhysicsObjectManager.

Joint * PhysicsObjectManager::getJointById ( OopsObjectID  id  )  [protected, virtual]

virtual void PhysicsObjectManager::getLocalSimulatedJoints ( std::vector< oops::Joint * > &  dst  )  [protected, pure virtual]

void PhysicsObjectManager::getLocalSimulatedObjects ( std::vector< PhysicsObjectInterface * > &  dst  )  [virtual]

Handles the method call to a PhysicsObject. The method is called by the PhysicsObjects when a client input occurs. A client input is a method call on a PhysicsObject which has to be distributed to the responsible server(s). The PhysicsObject encodes its method call by itself and passes it to this method.

Parameters:
msg Encoded method call
dst ID of the PhysicsObject which was called DEPRECATED: WILL BE REMOVED SOON!!! Creates a list of all PhysicsObjects which are locally simulated. The method adds all PhysicsObjects for which the current machine is the server to the passed vector.
dst List where to add all locally simulated objects.

virtual void PhysicsObjectManager::getLocalSimulatedRigidBodies ( std::vector< oops::RigidBody * > &  dst  )  [protected, pure virtual]

PhysicsObjectInterface * PhysicsObjectManager::getObjectById ( PhysicsObjectID  id  )  [virtual]

Returns the PhysicsObject with the passed ID

virtual void PhysicsObjectManager::getRemoteSimulatedJoints ( std::vector< oops::Joint * > &  dst  )  [protected, pure virtual]

void PhysicsObjectManager::getRemoteSimulatedObjects ( std::vector< PhysicsObjectInterface * > &  dst  )  [virtual]

DEPRECATED: WILL BE REMOVED SOON!!! Creates a list of all PhysicsObjects which are NOT simulated locally. The method adds all PhysicsObjects for which any remote machine is the server to the passed vector.

Parameters:
dst List where to add all remote simulated objects.

virtual void PhysicsObjectManager::getRemoteSimulatedRigidBodies ( std::vector< oops::RigidBody * > &  dst  )  [protected, pure virtual]

RigidBody * PhysicsObjectManager::getRigidBodyById ( OopsObjectID  id  )  [protected, virtual]

Simulation * PhysicsObjectManager::getSimulation (  )  [protected, virtual]

Returns the Simulation class instance from the Physics Module. The method returns the Simulation class instance used by the Physics Module.

Returns:
Pointer to the used Simulation instance

unsigned int PhysicsObjectManager::getSimulationTime (  )  [protected, virtual]

Returns the current simulation time. The method returns the current simulation time from the Physics Module.

Returns:
current simulation time

virtual void PhysicsObjectManager::handleSynchronisationMessage ( NetMessage msg  )  [protected, pure virtual]

Handles a received SynchronisationMessage. The method is called by the Physics-Module when a PhysicsSynchronisationEvent is received. The passed method contains information used to synchronise the current PhysicsObjectManager. The message is encoded by the createSynchronisationMessage method.

Parameters:
msg Synchronisation message for PhysicsObjectManager

Implemented in SingleServerPhysicsObjectManager.

void PhysicsObjectManager::init ( Physics physics  )  [protected, virtual]

Initializes the PhysicsObjectManager. The method is called from the Physics Module and initializes the pointer to the Module. This is needed to get access to the oops::Simulation class or to the current simulation time.

Parameters:
physics Pointer to the Physics Module

Reimplemented in SingleServerPhysicsObjectManager.

virtual bool PhysicsObjectManager::isServer (  )  [protected, pure virtual]

Returns if the local machine has to do physics calculations.

Implemented in SingleServerPhysicsObjectManager.

virtual bool PhysicsObjectManager::isSimulatingJoint ( OopsObjectID  jointID  )  [pure virtual]

virtual bool PhysicsObjectManager::isSimulatingRigidBody ( OopsObjectID  rigidBodyID  )  [pure virtual]

PhysicsObjectInterface * PhysicsObjectManager::removePhysicsObject ( PhysicsObjectID  physicsObjectID  )  [protected, virtual]

Removes a PhysicsObject from the Simulation. The method removes the object with the passed ID from the list of simulated objects.

Parameters:
physicsObjectID ID of the object to remove
Returns:
object which was removed, NULL if not found

bool PhysicsObjectManager::removePhysicsObject ( PhysicsObjectInterface object  )  [protected, virtual]

Removes a PhysicsObject from the Simulation. The method removes the passed object from the list of simulated objects.

Parameters:
object Object to remove from simulation.
Returns:
true if the object could be removed, false otherwise

virtual void PhysicsObjectManager::step ( float  dt  )  [protected, pure virtual]

Handles the incoming network messages. The method is called before each simulation step. It should receive all incoming messages from the Network Module and execute them. Handles a simulation step. The method is called after the handleMessages method and before the Physics::handleSimulationStepListener method. It is used to add PhysicsObjects to the Simulation. The added objects are then already simulated in this step the first time. The method is equal to the one of a SimulationStepListenerInterface but it has to to called before the Physics::handleSimulationStepListener method is executed to allow PhysicsObjects which implement this interface to be notified in the same simulation step the first time.

Parameters:
dt Timestep of the current simulation step

Implemented in SingleServerPhysicsObjectManager.


Friends And Related Function Documentation

friend class Physics [friend]

friend class SynchronisationModel [friend]

friend class SynchronisePhysicsEvent [friend]


Member Data Documentation

List of objects to add.

Lock for list of objects to add.

std::vector<oops::Joint*> PhysicsObjectManager::jointList [protected]

List of all objects in the simulation.

Pointer to the physics Module.


The documentation for this class was generated from the following files:

Generated on Wed Oct 20 16:11:59 2010 for inVRs by doxygen 1.5.8