|
From: Markus R. <rol...@us...> - 2006-02-12 11:39:24
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29616 Modified Files: property.cpp Log Message: - use const references to property nodes to avoid repeated dereferencing of shared_ptrs Index: property.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/property.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** property.cpp 12 Feb 2006 11:19:25 -0000 1.5 --- property.cpp 12 Feb 2006 11:39:09 -0000 1.6 *************** *** 120,127 **** void Property::GenClassEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const { ! shared_ptr<Class> cl = shared_static_cast<Class>(leaf); // originating bundle ! shared_ptr<salt::SharedLibrary> bundle = cl->GetBundle(); entries.push_back( Entry( --- 120,127 ---- void Property::GenClassEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const { ! const Class& cl = *shared_static_cast<Class>(leaf); // originating bundle ! shared_ptr<salt::SharedLibrary> bundle = cl.GetBundle(); entries.push_back( Entry( *************** *** 132,136 **** // base classes ! const Class::TStringList& baseCl = cl->GetBaseClasses(); for ( --- 132,136 ---- // base classes ! const Class::TStringList& baseCl = cl.GetBaseClasses(); for ( *************** *** 144,148 **** // supported functions ! const Class::TCommandMap& cmds = cl->GetCommandMap(); for ( --- 144,148 ---- // supported functions ! const Class::TCommandMap& cmds = cl.GetCommandMap(); for ( *************** *** 158,180 **** void Property::GenTransformEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const { ! shared_ptr<Transform> trans = shared_static_cast<Transform>(leaf); ! entries.push_back(Entry(_T("GetChangedMark"), FormatInt(trans->GetChangedMark()))); ! entries.push_back(Entry(_T("GetLocalTransform"), FormatMatrix(trans->GetLocalTransform()))); ! entries.push_back(Entry(_T("GetWorldTransform"), FormatMatrix(trans->GetWorldTransform()))); } void Property::GenBodyEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const { ! shared_ptr<Body> body = shared_static_cast<Body>(leaf); ! entries.push_back(Entry(_T("GetMass"),FormatFloat(body->GetMass()))); ! entries.push_back(Entry(_T("GetVelocity"),FormatVector3(body->GetVelocity()))); ! entries.push_back(Entry(_T("GetAngularVelocity"),FormatVector3(body->GetAngularVelocity()))); ! entries.push_back(Entry(_T("GetPosition"),FormatVector3(body->GetPosition()))); } void Property::GenJointEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const { ! shared_ptr<Joint> joint = shared_static_cast<Joint>(leaf); ! entries.push_back(Entry(_T("FeedBackEnabled"),FormatBool(joint->FeedBackEnabled()))); for (int i=0;i<2;++i) --- 158,180 ---- void Property::GenTransformEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const { ! const Transform& trans = *shared_static_cast<Transform>(leaf); ! entries.push_back(Entry(_T("GetChangedMark"), FormatInt(trans.GetChangedMark()))); ! entries.push_back(Entry(_T("GetLocalTransform"), FormatMatrix(trans.GetLocalTransform()))); ! entries.push_back(Entry(_T("GetWorldTransform"), FormatMatrix(trans.GetWorldTransform()))); } void Property::GenBodyEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const { ! const Body& body = *shared_static_cast<Body>(leaf); ! entries.push_back(Entry(_T("GetMass"),FormatFloat(body.GetMass()))); ! entries.push_back(Entry(_T("GetVelocity"),FormatVector3(body.GetVelocity()))); ! entries.push_back(Entry(_T("GetAngularVelocity"),FormatVector3(body.GetAngularVelocity()))); ! entries.push_back(Entry(_T("GetPosition"),FormatVector3(body.GetPosition()))); } void Property::GenJointEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const { ! const Joint& joint = *shared_static_cast<Joint>(leaf); ! entries.push_back(Entry(_T("FeedBackEnabled"),FormatBool(joint.FeedBackEnabled()))); for (int i=0;i<2;++i) *************** *** 183,188 **** const Joint::EBodyIndex idx = static_cast<Joint::EBodyIndex>(i); ! entries.push_back(Entry(_T("GetFeedbackForce")+strIdx,FormatVector3(joint->GetFeedbackForce(idx)))); ! entries.push_back(Entry(_T("GetFeedbackTorque")+strIdx,FormatVector3(joint->GetFeedbackTorque(idx)))); } --- 183,188 ---- const Joint::EBodyIndex idx = static_cast<Joint::EBodyIndex>(i); ! entries.push_back(Entry(_T("GetFeedbackForce")+strIdx,FormatVector3(joint.GetFeedbackForce(idx)))); ! entries.push_back(Entry(_T("GetFeedbackTorque")+strIdx,FormatVector3(joint.GetFeedbackTorque(idx)))); } *************** *** 192,208 **** const Joint::EAxisIndex idx = static_cast<Joint::EAxisIndex>(i); ! entries.push_back(Entry(_T("GetBounce")+strIdx,FormatFloat(joint->GetBounce(idx)))); ! entries.push_back(Entry(_T("GetLowStopDeg")+strIdx,FormatFloat(joint->GetLowStopDeg(idx)))); ! entries.push_back(Entry(_T("GetHighStopDeg")+strIdx,FormatFloat(joint->GetHighStopDeg(idx)))); ! entries.push_back(Entry(_T("GetLowStopPos")+strIdx,FormatFloat(joint->GetLowStopPos(idx)))); ! entries.push_back(Entry(_T("GetHighStopPos")+strIdx,FormatFloat(joint->GetHighStopPos(idx)))); ! entries.push_back(Entry(_T("GetCFM")+strIdx,FormatFloat(joint->GetCFM(idx)))); ! entries.push_back(Entry(_T("GetStopCFM")+strIdx,FormatFloat(joint->GetStopCFM(idx)))); ! entries.push_back(Entry(_T("GetSuspensionCFM")+strIdx,FormatFloat(joint->GetSuspensionCFM(idx)))); ! entries.push_back(Entry(_T("GetStopERP")+strIdx,FormatFloat(joint->GetStopERP(idx)))); ! entries.push_back(Entry(_T("GetSuspensionERP")+strIdx,FormatFloat(joint->GetSuspensionERP(idx)))); ! entries.push_back(Entry(_T("GetLinearMotorVelocity")+strIdx,FormatFloat(joint->GetLinearMotorVelocity(idx)))); ! entries.push_back(Entry(_T("GetAngularMotorVelocity")+strIdx,FormatFloat(joint->GetAngularMotorVelocity(idx)))); ! entries.push_back(Entry(_T("GetMaxMotorForce")+strIdx,FormatFloat(joint->GetMaxMotorForce(idx)))); } } --- 192,208 ---- const Joint::EAxisIndex idx = static_cast<Joint::EAxisIndex>(i); ! entries.push_back(Entry(_T("GetBounce")+strIdx,FormatFloat(joint.GetBounce(idx)))); ! entries.push_back(Entry(_T("GetLowStopDeg")+strIdx,FormatFloat(joint.GetLowStopDeg(idx)))); ! entries.push_back(Entry(_T("GetHighStopDeg")+strIdx,FormatFloat(joint.GetHighStopDeg(idx)))); ! entries.push_back(Entry(_T("GetLowStopPos")+strIdx,FormatFloat(joint.GetLowStopPos(idx)))); ! entries.push_back(Entry(_T("GetHighStopPos")+strIdx,FormatFloat(joint.GetHighStopPos(idx)))); ! entries.push_back(Entry(_T("GetCFM")+strIdx,FormatFloat(joint.GetCFM(idx)))); ! entries.push_back(Entry(_T("GetStopCFM")+strIdx,FormatFloat(joint.GetStopCFM(idx)))); ! entries.push_back(Entry(_T("GetSuspensionCFM")+strIdx,FormatFloat(joint.GetSuspensionCFM(idx)))); ! entries.push_back(Entry(_T("GetStopERP")+strIdx,FormatFloat(joint.GetStopERP(idx)))); ! entries.push_back(Entry(_T("GetSuspensionERP")+strIdx,FormatFloat(joint.GetSuspensionERP(idx)))); ! entries.push_back(Entry(_T("GetLinearMotorVelocity")+strIdx,FormatFloat(joint.GetLinearMotorVelocity(idx)))); ! entries.push_back(Entry(_T("GetAngularMotorVelocity")+strIdx,FormatFloat(joint.GetAngularMotorVelocity(idx)))); ! entries.push_back(Entry(_T("GetMaxMotorForce")+strIdx,FormatFloat(joint.GetMaxMotorForce(idx)))); } } *************** *** 210,217 **** void Property::GenWorldEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const { ! shared_ptr<World> world = shared_static_cast<World>(leaf); ! entries.push_back(Entry(_T("GetGravity"),FormatVector3(world->GetGravity()))); ! entries.push_back(Entry(_T("GetERP"),FormatFloat(world->GetERP()))); ! entries.push_back(Entry(_T("GetCFM"),FormatFloat(world->GetCFM()))); } --- 210,217 ---- void Property::GenWorldEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const { ! const World& world = *shared_static_cast<World>(leaf); ! entries.push_back(Entry(_T("GetGravity"),FormatVector3(world.GetGravity()))); ! entries.push_back(Entry(_T("GetERP"),FormatFloat(world.GetERP()))); ! entries.push_back(Entry(_T("GetCFM"),FormatFloat(world.GetCFM()))); } *************** *** 224,230 **** void Property::GenContactJointEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const { ! shared_ptr<ContactJointHandler> cjh = shared_static_cast<ContactJointHandler>(leaf); ! int mode = cjh->GetContactMode(); wxString strMode = FORMAT_FLAG(mode, dContactMu2) + --- 224,230 ---- void Property::GenContactJointEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const { ! const ContactJointHandler& cjh = *shared_static_cast<ContactJointHandler>(leaf); ! int mode = cjh.GetContactMode(); wxString strMode = FORMAT_FLAG(mode, dContactMu2) + *************** *** 243,264 **** entries.push_back(Entry(_T("GetContactMode"),strMode)); ! entries.push_back(Entry(_T("GetBounceValue"),FormatFloat(cjh->GetBounceValue()))); ! entries.push_back(Entry(_T("GetMinBounceVel"),FormatFloat(cjh->GetMinBounceVel()))); ! entries.push_back(Entry(_T("GetContactSoftERP"),FormatFloat(cjh->GetContactSoftERP()))); ! entries.push_back(Entry(_T("GetContactSoftCFM"),FormatFloat(cjh->GetContactSoftCFM()))); ! entries.push_back(Entry(_T("GetContactSlip1"),FormatFloat(cjh->GetContactSlip1()))); ! entries.push_back(Entry(_T("GetContactSlip2"),FormatFloat(cjh->GetContactSlip2()))); ! entries.push_back(Entry(_T("GetContactMu"),FormatFloat(cjh->GetContactMu()))); } void Property::GenDragControllerEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const { ! shared_ptr<DragController> dc = shared_static_cast<DragController>(leaf); ! entries.push_back(Entry(_T("GetLinearDrag"),FormatFloat(dc->GetLinearDrag()))); ! entries.push_back(Entry(_T("GetAngularDrag"),FormatFloat(dc->GetAngularDrag()))); } - void Property::GetClassList(boost::shared_ptr<Class> cl, TClassList& clList) const { --- 243,263 ---- entries.push_back(Entry(_T("GetContactMode"),strMode)); ! entries.push_back(Entry(_T("GetBounceValue"),FormatFloat(cjh.GetBounceValue()))); ! entries.push_back(Entry(_T("GetMinBounceVel"),FormatFloat(cjh.GetMinBounceVel()))); ! entries.push_back(Entry(_T("GetContactSoftERP"),FormatFloat(cjh.GetContactSoftERP()))); ! entries.push_back(Entry(_T("GetContactSoftCFM"),FormatFloat(cjh.GetContactSoftCFM()))); ! entries.push_back(Entry(_T("GetContactSlip1"),FormatFloat(cjh.GetContactSlip1()))); ! entries.push_back(Entry(_T("GetContactSlip2"),FormatFloat(cjh.GetContactSlip2()))); ! entries.push_back(Entry(_T("GetContactMu"),FormatFloat(cjh.GetContactMu()))); } void Property::GenDragControllerEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const { ! const DragController& dc = *shared_static_cast<DragController>(leaf); ! entries.push_back(Entry(_T("GetLinearDrag"),FormatFloat(dc.GetLinearDrag()))); ! entries.push_back(Entry(_T("GetAngularDrag"),FormatFloat(dc.GetAngularDrag()))); } void Property::GetClassList(boost::shared_ptr<Class> cl, TClassList& clList) const { |