CSWPySubmarine Class Reference

Inheritance diagram for CSWPySubmarine:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 CSWPySubmarine (std::string strName, double fLength)
virtual void initialize ()
virtual void update ()
virtual bool processEvent (boost::shared_ptr< CSWEvent > pEvent)
virtual void finalize ()
boost::shared_ptr< ARSTD::CommandProcessorgetCommandProcessor ()
boost::shared_ptr< CSWEnginegetMainEngine ()
boost::shared_ptr< CSWEnginegetBowsJetOar ()
boost::shared_ptr< CSWEnginegetInclinationJetOar ()
boost::shared_ptr< CSWEnginegetAxialInclinationJetOar ()
boost::shared_ptr< CSWEnginegetBuoyancyTank ()
boost::shared_ptr< CSWControlCentergetControlCenter ()
boost::shared_ptr< CSWWeaponBatterygetFrontLeftWeaponBattery ()
boost::shared_ptr< CSWWeaponBatterygetFrontRightWeaponBattery ()
boost::shared_ptr< CSWWeaponBatterygetBackWeaponBattery ()
const double & getHealth () const
void setColor (const Vector4D &vecColor)
const Vector4D & getColor ()
Vector3D makeLocalDirection (const Vector3D &vecWorldTDirection)
Vector3D makeGlobalDirection (const Vector3D &vecObjectTDirection)
Vector3D makeLocalPosition (const Vector3D &vecWorldTPosition)
Vector3D makeGlobalPosition (const Vector3D &vecObjectTPosition)

Detailed Description

This is the base class for submarines defined in python. Submarines are the main actors in the world. Specialized submarines are defined in python. Therefore its behavior is very different. All submarines have the same equipment and the same types of weapons on bord. They are identically except its length. The length must be given in the constructor and must be in range [30, 110] m. The power of engines and the capacity of the weapon batteries is depend on the submarine length. Larger submarines have more powerful engines and a higher capacity of the weapon batteries. But larger submarines can be better hit and detected by sonar than smaller ones. Smaller ones are a bit faster in controlling rotation and position.
Submarines are equipped with:


Constructor & Destructor Documentation

CSWPySubmarine::CSWPySubmarine ( std::string  strName,
double  fLength 
)

Constructs a new submarine.

Parameters:
strName The name of the new submarine.
fLength The length of the new submarine.
Warning:
At this point the sensors have not correct values!


Member Function Documentation

virtual void CSWPySubmarine::initialize (  )  [virtual]

This method should be overriden if initializations must be done. Here all sensors return correct values. Its ensured that this method is called before any other method (except constructor) is called.

Reimplemented from CSWObject.

virtual void CSWPySubmarine::update (  )  [virtual]

This method must be overriden in the specialized class. This methode is called periodically about every 10ms. The main function should be checking sensors, seting up commands or something like that. The specialized class can implement everything here, but the execution time must not exceed 6ms in average. If it does the object will be kicked from the world!

Reimplemented from CSWSubmarine.

virtual bool CSWPySubmarine::processEvent ( boost::shared_ptr< CSWEvent pEvent  )  [virtual]

This method must be overriden in the specialized class. This methode is called if an event has been received by the object that should be processed. Returning true reports the eventmanager that the event passed to the object has successfully processed and delete it. When returning false the event will be delivered the next time again until it expires or processed successfully. The main function should be reacting to events e.g. seting up commands or something like that. The specialized class can implement everything here, but the execution time must not exceed 6ms in average. If it does the object will be kicked from the world!

Parameters:
pEvent The incoming event that should be processed.
Returns:
True if the incoming event has been successfully processed. When returning false the event will be delivered next time again.

Reimplemented from CSWSubmarine.

virtual void CSWPySubmarine::finalize (  )  [virtual]

This method should be overriden if finalizations must be done. Its ensured that this method is called directly before destructing.

Reimplemented from CSWObject.

boost::shared_ptr<ARSTD::CommandProcessor> CSWPySubmarine::getCommandProcessor (  )  [virtual]

Returns the command processor. The behavior is like in real life your 1st commander. You (the captain) makes a list of commands that must be done. This list is given to the commander. He cares about the correct execution. Ones you give him the list of commands you are able to do other things while your commander do the execution.

Returns:
The command processor.

Reimplemented from CSWSubmarine.

boost::shared_ptr<CSWEngine> CSWPySubmarine::getMainEngine (  ) 

Returns the main engine.

Returns:
The main engine.

Reimplemented from CSWSubmarine.

boost::shared_ptr<CSWEngine> CSWPySubmarine::getBowsJetOar (  ) 

Returns the bows jet oar.

Returns:
The bows jet oar.

Reimplemented from CSWSubmarine.

boost::shared_ptr<CSWEngine> CSWPySubmarine::getInclinationJetOar (  ) 

Returns the inclination jet oar.

Returns:
The inclination jet oar.

Reimplemented from CSWSubmarine.

boost::shared_ptr<CSWEngine> CSWPySubmarine::getAxialInclinationJetOar (  ) 

Returns the axial inclination jet oar.

Returns:
The axial inclination jet oar.

Reimplemented from CSWSubmarine.

boost::shared_ptr<CSWEngine> CSWPySubmarine::getBuoyancyTank (  ) 

Returns the buoyancy tank.

Returns:
The buoyancy tank.

Reimplemented from CSWSubmarine.

boost::shared_ptr<CSWControlCenter> CSWPySubmarine::getControlCenter (  ) 

Returns the control center.

Returns:
The control center.

Reimplemented from CSWSubmarine.

boost::shared_ptr<CSWWeaponBattery> CSWPySubmarine::getFrontLeftWeaponBattery (  ) 

Returns the front left weapon battery.

Returns:
The front left weapon battery.

Reimplemented from CSWSubmarine.

boost::shared_ptr<CSWWeaponBattery> CSWPySubmarine::getFrontRightWeaponBattery (  ) 

Returns the front right weapon battery.

Returns:
The front right weapon battery.

Reimplemented from CSWSubmarine.

boost::shared_ptr<CSWWeaponBattery> CSWPySubmarine::getBackWeaponBattery (  ) 

Returns the back weapon battery.

Returns:
The back weapon battery.

Reimplemented from CSWSubmarine.

const double& CSWPySubmarine::getHealth (  )  const [virtual]

Returns the current health of the submarine.

Returns:
The current health in range [0, 1] where 0 is dead and 1 is maximum.

Reimplemented from CSWDamDynSolCol.

void CSWPySubmarine::setColor ( const Vector4D &  vecColor  )  [virtual]

Sets the color of the submarine.

Parameters:
vecColor The new red-green-blue-alpha - color. each color component in range [0, 1].

Reimplemented from CSWDynSolCol.

const Vector4D& CSWPySubmarine::getColor (  )  [virtual]

Returns the color of the object.

Returns:
The red-green-blue-alpha - color of the object.

Reimplemented from CSWDynSolCol.

Vector3D CSWPySubmarine::makeLocalDirection ( const Vector3D &  vecWorldTDirection  ) 

Transforms a direction given in world coordinate system into the local system.

Parameters:
vecWorldTDirection The direction in world coordinate system.
Returns:
The direction in object coordinate system.

Reimplemented from CSWSubmarine.

Vector3D CSWPySubmarine::makeGlobalDirection ( const Vector3D &  vecObjectTDirection  ) 

Transforms a direction given in local coordinate system into the world coordinate system.

Parameters:
vecObjectTDirection The direction in local coordinate system.
Returns:
The direction in world coordinate system.

Reimplemented from CSWSubmarine.

Vector3D CSWPySubmarine::makeLocalPosition ( const Vector3D &  vecWorldTPosition  ) 

Transforms a position given in world coordinate system into the local system.

Parameters:
vecWorldTPosition The position in world coordinate system.
Returns:
The position in object coordinate system.

Reimplemented from CSWSubmarine.

Vector3D CSWPySubmarine::makeGlobalPosition ( const Vector3D &  vecObjectTPosition  ) 

Transforms a position given in local coordinate system into the world coordinate system.

Parameters:
vecObjectTPosition The position in local coordinate system.
Returns:
The position in world coordinate system.

Reimplemented from CSWSubmarine.


Generated at 2 Jan 2007 for project CodeSubWars. www.codesubwars.org