Revision: 6442
http://playerstage.svn.sourceforge.net/playerstage/?rev=6442&view=rev
Author: robotos
Date: 2008-05-15 09:05:54 -0700 (Thu, 15 May 2008)
Log Message:
-----------
Some silly optimizations recommended by valgrind.
Modified Paths:
--------------
code/gazebo/trunk/server/Entity.cc
code/gazebo/trunk/server/Entity.hh
code/gazebo/trunk/server/Quatern.cc
code/gazebo/trunk/server/Simulator.cc
code/gazebo/trunk/server/Simulator.hh
Modified: code/gazebo/trunk/server/Entity.cc
===================================================================
--- code/gazebo/trunk/server/Entity.cc 2008-05-15 03:00:00 UTC (rev 6441)
+++ code/gazebo/trunk/server/Entity.cc 2008-05-15 16:05:54 UTC (rev 6442)
@@ -36,13 +36,12 @@
Entity::Entity(Entity *parent)
+: parent(parent),
+ id(++idCounter),
+ isStatic(false),
+ visualNode(0)
{
- // Set the parent and the id
- this->parent = parent;
- this->id = idCounter++;
- this->isStatic = false;
- this->visualNode=0;
-
+
if (this->parent)
{
this->parent->AddChild(this);
@@ -61,7 +60,6 @@
Entity::~Entity()
{
GZ_DELETE(this->visualNode);
-
World::Instance()->GetPhysicsEngine()->RemoveEntity(this);
}
@@ -100,7 +98,7 @@
}
// Get all children
-std::vector< Entity* > &Entity::GetChildren()
+std::vector< Entity* > &Entity::GetChildren()
{
return this->children;
}
@@ -151,14 +149,14 @@
////////////////////////////////////////////////////////////////////////////////
// Return whether this entity is static
-bool Entity::IsStatic() const
+inline bool Entity::IsStatic() const
{
return this->isStatic;
}
////////////////////////////////////////////////////////////////////////////////
/// Returns true if the entities are the same. Checks only the name
-bool Entity::operator==(const Entity &ent)
+bool Entity::operator==(const Entity &ent) const
{
return ent.GetName() == this->GetName();
}
Modified: code/gazebo/trunk/server/Entity.hh
===================================================================
--- code/gazebo/trunk/server/Entity.hh 2008-05-15 03:00:00 UTC (rev 6441)
+++ code/gazebo/trunk/server/Entity.hh 2008-05-15 16:05:54 UTC (rev 6442)
@@ -75,7 +75,7 @@
/// \brief Get all children
/// \return Vector of children entities
- public: std::vector< Entity* > &GetChildren();
+ public: std::vector< Entity* > &GetChildren();
/// \brief Return this entity's sceneNode
/// \return Ogre scene node
@@ -106,13 +106,13 @@
public: bool IsStatic() const;
/// \brief Returns true if the entities are the same. Checks only the name
- public: bool operator==(const Entity &ent);
+ public: bool operator==(const Entity &ent) const;
/// \brief Parent of this entity
protected: Entity *parent;
/// \brief Children of this entity
- public: std::vector< Entity* > children;
+ private: std::vector< Entity* > children;
/// \brief This entities ID
private: unsigned int id;
@@ -120,16 +120,18 @@
/// \brief Used to automaticaly chose a unique ID on creation
private: static unsigned int idCounter;
- /// \brief OGRE stuff
+ // is this an static entity
+ private: bool isStatic;
+
+ /// \brief Visual stuff
protected: OgreVisual *visualNode;
- /// \brief ODE Stuff
+ /// \brief ODE Stuff (should be go somewhere else)
public: dSpaceID spaceId;
/// \brief Name of the entity
private: std::string name;
- private: bool isStatic;
};
/// \}
Modified: code/gazebo/trunk/server/Quatern.cc
===================================================================
--- code/gazebo/trunk/server/Quatern.cc 2008-05-15 03:00:00 UTC (rev 6441)
+++ code/gazebo/trunk/server/Quatern.cc 2008-05-15 16:05:54 UTC (rev 6442)
@@ -93,7 +93,7 @@
////////////////////////////////////////////////////////////////////////////////
// Get the inverse of this quaternion
-Quatern Quatern::GetInverse() const
+Quatern Quatern::GetInverse() const
{
Quatern q;
Modified: code/gazebo/trunk/server/Simulator.cc
===================================================================
--- code/gazebo/trunk/server/Simulator.cc 2008-05-15 03:00:00 UTC (rev
6441)
+++ code/gazebo/trunk/server/Simulator.cc 2008-05-15 16:05:54 UTC (rev
6442)
@@ -50,28 +50,23 @@
////////////////////////////////////////////////////////////////////////////////
// Constructor
Simulator::Simulator()
+: xmlFile(NULL),
+ gui(NULL),
+ gazeboConfig(NULL),
+ loaded(false),
+ pause(false),
+ iterations(0),
+ simTime(0.0),
+ pauseTime(0.0),
+ startTime(0.0),
+ physicsUpdates(0),
+ checkpoint(0.0),
+ renderUpdates(0),
+ userPause(false),
+ userStep(false),
+ userStepInc(false),
+ userQuit(false)
{
- this->gui=NULL;
-
- this->loaded = false;
- this->pause = false;
-
- this->iterations = 0;
- this->pauseTime = 0.0;
- this->startTime = 0.0;
- this->simTime = 0.0;
-
- this->userQuit = false;
- this->userPause = false;
- this->userStep = false;
- this->userStepInc = false;
-
- this->xmlFile=NULL;
- this->gazeboConfig=NULL;
- this->checkpoint=0.0;
- this->physicsUpdates=0;
- this->renderUpdates=0;
-
}
////////////////////////////////////////////////////////////////////////////////
@@ -259,7 +254,7 @@
(this->GetUserStep() && this->GetUserStepInc()))
{
this->simTime += step;
- this->iterations++;
+ ++this->iterations;
this->pause=false;
this->SetUserStepInc(!this->GetUserStepInc());
}
@@ -271,7 +266,7 @@
World::Instance()->Update(); //physics
- this->physicsUpdates++;
+ ++this->physicsUpdates;
updated=true;
}
@@ -281,7 +276,7 @@
{
gazebo::OgreAdaptor::Instance()->Render();
this->gui->Update();
- this->renderUpdates++;
+ ++this->renderUpdates;
updated=true;
}
Modified: code/gazebo/trunk/server/Simulator.hh
===================================================================
--- code/gazebo/trunk/server/Simulator.hh 2008-05-15 03:00:00 UTC (rev
6441)
+++ code/gazebo/trunk/server/Simulator.hh 2008-05-15 16:05:54 UTC (rev
6442)
@@ -163,10 +163,14 @@
//upper limits on updating
//how many updates we have done in this slot
- private: int physicsUpdates, renderUpdates;
+ private: int physicsUpdates;
+
// when the slot started
private: double checkpoint;
+ // render updates
+ private: int renderUpdates;
+
// UserIteractions
/// \brief Set to true to pause the simulation
private: bool userPause;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit